From b4ea7855bc47eac2a7ad39a4f93a46731feed689 Mon Sep 17 00:00:00 2001
From: Anton Timmermans <email@atimmer.com>
Date: Thu, 7 Jul 2016 16:44:45 +0200
Subject: [PATCH 1/5] Add documentation to wp-admin/js/postbox.js
---
src/wp-admin/js/postbox.js | 105 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 105 insertions(+)
diff --git a/src/wp-admin/js/postbox.js b/src/wp-admin/js/postbox.js
index a8222ee..74f5def 100644
|
a
|
b
|
|
| 1 | 1 | /* global ajaxurl, postBoxL10n */ |
| 2 | 2 | |
| | 3 | /** |
| | 4 | * This object contains all function to handle the behaviour of the post boxes. The post boxes are the boxes you see |
| | 5 | * around the content on the edit page. |
| | 6 | * |
| | 7 | * @namespace postboxes |
| | 8 | * |
| | 9 | * @type {Object} |
| | 10 | */ |
| 3 | 11 | var postboxes; |
| 4 | 12 | |
| 5 | 13 | (function($) { |
| 6 | 14 | var $document = $( document ); |
| 7 | 15 | |
| 8 | 16 | postboxes = { |
| | 17 | |
| | 18 | /** |
| | 19 | * Handles a click on either the postbox heading or the postbox open/close icon. Opens or closes the postbox. |
| | 20 | * Expects this to equal the clicked element. |
| | 21 | * |
| | 22 | * Triggers postboxes.pbshow if the postbox has just been opened, triggers postboxes.pbhide if the postbox has |
| | 23 | * just been closed. |
| | 24 | * |
| | 25 | * @memberof postboxes |
| | 26 | * @fires postboxes#postbox-toggled |
| | 27 | */ |
| 9 | 28 | handle_click : function () { |
| 10 | 29 | var $el = $( this ), |
| 11 | 30 | p = $el.parent( '.postbox' ), |
| … |
… |
var postboxes;
|
| 41 | 60 | } |
| 42 | 61 | } |
| 43 | 62 | |
| | 63 | /** |
| | 64 | * Fires when the postbox has been opened or closed. Contains a jQuery object with the postbox element in |
| | 65 | * it. |
| | 66 | * |
| | 67 | * @event postboxes#postbox-toggled |
| | 68 | * @type {Object} |
| | 69 | */ |
| 44 | 70 | $document.trigger( 'postbox-toggled', p ); |
| 45 | 71 | }, |
| 46 | 72 | |
| | 73 | /** |
| | 74 | * Adds event handlers to all postboxes and screen option on the current page. |
| | 75 | * |
| | 76 | * @memberof postboxes |
| | 77 | * |
| | 78 | * @param {string} page The page we are currently on. |
| | 79 | * @param {Object} [args] |
| | 80 | * @param {Function} args.pbshow A callback that is called when a postbox opens. |
| | 81 | * @param {Function} args.pbhide A callback that is called when a postbox closes. |
| | 82 | */ |
| 47 | 83 | add_postbox_toggles : function (page, args) { |
| 48 | 84 | var $handles = $( '.postbox .hndle, .postbox .handlediv' ); |
| 49 | 85 | |
| … |
… |
var postboxes;
|
| 56 | 92 | e.stopPropagation(); |
| 57 | 93 | }); |
| 58 | 94 | |
| | 95 | /** |
| | 96 | * Adds an event handler to the dismissal of a postbox. Event handler completely hides the postbox element |
| | 97 | * and it cannot be closed or opened afterwards. |
| | 98 | */ |
| 59 | 99 | $( '.postbox a.dismiss' ).on( 'click.postboxes', function( e ) { |
| 60 | 100 | var hide_id = $(this).parents('.postbox').attr('id') + '-hide'; |
| 61 | 101 | e.preventDefault(); |
| 62 | 102 | $( '#' + hide_id ).prop('checked', false).triggerHandler('click'); |
| 63 | 103 | }); |
| 64 | 104 | |
| | 105 | /** |
| | 106 | * Adds an event handler to the screen option checkboxes. Event handler completely hides the postbox element |
| | 107 | * |
| | 108 | * @fires postboxes#postbox-toggled |
| | 109 | */ |
| 65 | 110 | $('.hide-postbox-tog').bind('click.postboxes', function() { |
| 66 | 111 | var $el = $(this), |
| 67 | 112 | boxId = $el.val(), |
| … |
… |
var postboxes;
|
| 78 | 123 | postboxes.pbhide( boxId ); |
| 79 | 124 | } |
| 80 | 125 | } |
| | 126 | |
| 81 | 127 | postboxes.save_state( page ); |
| 82 | 128 | postboxes._mark_area(); |
| 83 | 129 | $document.trigger( 'postbox-toggled', $postbox ); |
| 84 | 130 | }); |
| 85 | 131 | |
| | 132 | /** |
| | 133 | * Adds an event handler to the screen options layout preferences. |
| | 134 | */ |
| 86 | 135 | $('.columns-prefs input[type="radio"]').bind('click.postboxes', function(){ |
| 87 | 136 | var n = parseInt($(this).val(), 10); |
| 88 | 137 | |
| … |
… |
var postboxes;
|
| 93 | 142 | }); |
| 94 | 143 | }, |
| 95 | 144 | |
| | 145 | /** |
| | 146 | * Initializes all the postboxes, mainly their sortable behaviour. |
| | 147 | * |
| | 148 | * @memberof postboxes |
| | 149 | * |
| | 150 | * @param {string} page The page we are currently on. |
| | 151 | * @param {Object} [args] |
| | 152 | * @param {Function} args.pbshow A callback that is called when a postbox opens. |
| | 153 | * @param {Function} args.pbhide A callback that is called when a postbox closes. |
| | 154 | */ |
| 96 | 155 | init : function(page, args) { |
| 97 | 156 | var isMobile = $( document.body ).hasClass( 'mobile' ), |
| 98 | 157 | $handleButtons = $( '.postbox .handlediv' ); |
| … |
… |
var postboxes;
|
| 157 | 216 | }); |
| 158 | 217 | }, |
| 159 | 218 | |
| | 219 | /** |
| | 220 | * Saves the state of the postboxes to the server. It sends two lists, one with all the closed postboxes, one |
| | 221 | * with all the hidden postboxes. |
| | 222 | * |
| | 223 | * @memberof postboxes |
| | 224 | * |
| | 225 | * @param {string} page The page we are currently on. |
| | 226 | */ |
| 160 | 227 | save_state : function(page) { |
| 161 | 228 | var closed, hidden; |
| 162 | 229 | |
| … |
… |
var postboxes;
|
| 177 | 244 | }); |
| 178 | 245 | }, |
| 179 | 246 | |
| | 247 | /** |
| | 248 | * Saves the order of the postboxes to the server. Sends a list of all postboxes inside a sortable area to the |
| | 249 | * server. |
| | 250 | * |
| | 251 | * @memberof postboxes |
| | 252 | * |
| | 253 | * @param {string} page The page we are currently on. |
| | 254 | */ |
| 180 | 255 | save_order : function(page) { |
| 181 | 256 | var postVars, page_columns = $('.columns-prefs input:checked').val() || 0; |
| 182 | 257 | |
| … |
… |
var postboxes;
|
| 186 | 261 | page_columns: page_columns, |
| 187 | 262 | page: page |
| 188 | 263 | }; |
| | 264 | |
| 189 | 265 | $('.meta-box-sortables').each( function() { |
| 190 | 266 | postVars[ 'order[' + this.id.split( '-' )[0] + ']' ] = $( this ).sortable( 'toArray' ).join( ',' ); |
| 191 | 267 | } ); |
| | 268 | |
| 192 | 269 | $.post( ajaxurl, postVars ); |
| 193 | 270 | }, |
| 194 | 271 | |
| | 272 | /** |
| | 273 | * Adds a message to empty sortable areas on the dashboard page. Also adds a border around the side area on the |
| | 274 | * post edit screen if there are no postboxes present. |
| | 275 | * |
| | 276 | * @memberof postboxes |
| | 277 | * @private |
| | 278 | */ |
| 195 | 279 | _mark_area : function() { |
| 196 | 280 | var visible = $('div.postbox:visible').length, side = $('#post-body #side-sortables'); |
| 197 | 281 | |
| … |
… |
var postboxes;
|
| 215 | 299 | } |
| 216 | 300 | }, |
| 217 | 301 | |
| | 302 | /** |
| | 303 | * Changes the amount of columns on the post edit page. |
| | 304 | * |
| | 305 | * @memberof postboxes |
| | 306 | * @fires postboxes#postboxes-columnchange |
| | 307 | * @private |
| | 308 | * |
| | 309 | * @param {number} n The amount of columns to divide the post edit page in. |
| | 310 | */ |
| 218 | 311 | _pb_edit : function(n) { |
| 219 | 312 | var el = $('.metabox-holder').get(0); |
| 220 | 313 | |
| … |
… |
var postboxes;
|
| 222 | 315 | el.className = el.className.replace(/columns-\d+/, 'columns-' + n); |
| 223 | 316 | } |
| 224 | 317 | |
| | 318 | /** |
| | 319 | * Fires when the amount of columns on the post edit page has been changed. |
| | 320 | * |
| | 321 | * @event postboxes#postboxes-columnchange |
| | 322 | */ |
| 225 | 323 | $( document ).trigger( 'postboxes-columnchange' ); |
| 226 | 324 | }, |
| 227 | 325 | |
| | 326 | /** |
| | 327 | * Changes the postboxes based on the current orientation of the browser. Meant to be called when the |
| | 328 | * orientation of the browser changes. |
| | 329 | * |
| | 330 | * @memberof postboxes |
| | 331 | * @private |
| | 332 | */ |
| 228 | 333 | _pb_change : function() { |
| 229 | 334 | var check = $( 'label.columns-prefs-1 input[type="radio"]' ); |
| 230 | 335 | |
From 68e82d0105e03727cda2850bd6e2a49acdacaa11 Mon Sep 17 00:00:00 2001
From: Anton Timmermans <email@atimmer.com>
Date: Thu, 7 Jul 2016 16:54:46 +0200
Subject: [PATCH 2/5] Add documentation to pbshow and pbhide
---
src/wp-admin/js/postbox.js | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/wp-admin/js/postbox.js b/src/wp-admin/js/postbox.js
index 74f5def..0b0be34 100644
|
a
|
b
|
var postboxes;
|
| 352 | 352 | }, |
| 353 | 353 | |
| 354 | 354 | /* Callbacks */ |
| | 355 | |
| | 356 | /** |
| | 357 | * @property {Function|boolean} pbshow A callback that is called when a postbox is opened. |
| | 358 | * @memberof postboxes |
| | 359 | */ |
| 355 | 360 | pbshow : false, |
| 356 | 361 | |
| | 362 | /** |
| | 363 | * @property {Function|boolean} pbhide A callback that is called when a postbox is closed. |
| | 364 | * @memberof postboxes |
| | 365 | */ |
| 357 | 366 | pbhide : false |
| 358 | 367 | }; |
| 359 | 368 | |
From dbc91371f87df6aec7a69af4d027b71abbe7ccc5 Mon Sep 17 00:00:00 2001
From: Anton Timmermans <email@atimmer.com>
Date: Thu, 14 Jul 2016 15:20:03 +0200
Subject: [PATCH 3/5] Add comment to duplicate event trigger
---
src/wp-admin/js/postbox.js | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/wp-admin/js/postbox.js b/src/wp-admin/js/postbox.js
index 0b0be34..2b713f2 100644
|
a
|
b
|
var postboxes;
|
| 126 | 126 | |
| 127 | 127 | postboxes.save_state( page ); |
| 128 | 128 | postboxes._mark_area(); |
| | 129 | |
| | 130 | /** |
| | 131 | * @see postboxes.handle_click |
| | 132 | */ |
| 129 | 133 | $document.trigger( 'postbox-toggled', $postbox ); |
| 130 | 134 | }); |
| 131 | 135 | |
From b852e8c059b1e43154e232898a504c4ed2b82127 Mon Sep 17 00:00:00 2001
From: Anton Timmermans <email@atimmer.com>
Date: Thu, 14 Jul 2016 21:53:24 +0200
Subject: [PATCH 4/5] Add @since tags
---
src/wp-admin/js/postbox.js | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/wp-admin/js/postbox.js b/src/wp-admin/js/postbox.js
index 2b713f2..767a4d6 100644
|
a
|
b
|
|
| 4 | 4 | * This object contains all function to handle the behaviour of the post boxes. The post boxes are the boxes you see |
| 5 | 5 | * around the content on the edit page. |
| 6 | 6 | * |
| | 7 | * @since 2.7.0 |
| | 8 | * |
| 7 | 9 | * @namespace postboxes |
| 8 | 10 | * |
| 9 | 11 | * @type {Object} |
| … |
… |
var postboxes;
|
| 22 | 24 | * Triggers postboxes.pbshow if the postbox has just been opened, triggers postboxes.pbhide if the postbox has |
| 23 | 25 | * just been closed. |
| 24 | 26 | * |
| | 27 | * @since 4.4.0 |
| 25 | 28 | * @memberof postboxes |
| 26 | 29 | * @fires postboxes#postbox-toggled |
| 27 | 30 | */ |
| … |
… |
var postboxes;
|
| 64 | 67 | * Fires when the postbox has been opened or closed. Contains a jQuery object with the postbox element in |
| 65 | 68 | * it. |
| 66 | 69 | * |
| | 70 | * @since 4.0.0 |
| 67 | 71 | * @event postboxes#postbox-toggled |
| 68 | 72 | * @type {Object} |
| 69 | 73 | */ |
| … |
… |
var postboxes;
|
| 73 | 77 | /** |
| 74 | 78 | * Adds event handlers to all postboxes and screen option on the current page. |
| 75 | 79 | * |
| | 80 | * @since 2.7.0 |
| 76 | 81 | * @memberof postboxes |
| 77 | 82 | * |
| 78 | 83 | * @param {string} page The page we are currently on. |
| … |
… |
var postboxes;
|
| 128 | 133 | postboxes._mark_area(); |
| 129 | 134 | |
| 130 | 135 | /** |
| | 136 | * @since 4.0.0 |
| 131 | 137 | * @see postboxes.handle_click |
| 132 | 138 | */ |
| 133 | 139 | $document.trigger( 'postbox-toggled', $postbox ); |
| … |
… |
var postboxes;
|
| 149 | 155 | /** |
| 150 | 156 | * Initializes all the postboxes, mainly their sortable behaviour. |
| 151 | 157 | * |
| | 158 | * @since 2.7.0 |
| 152 | 159 | * @memberof postboxes |
| 153 | 160 | * |
| 154 | 161 | * @param {string} page The page we are currently on. |
| … |
… |
var postboxes;
|
| 224 | 231 | * Saves the state of the postboxes to the server. It sends two lists, one with all the closed postboxes, one |
| 225 | 232 | * with all the hidden postboxes. |
| 226 | 233 | * |
| | 234 | * @since 2.7.0 |
| 227 | 235 | * @memberof postboxes |
| 228 | 236 | * |
| 229 | 237 | * @param {string} page The page we are currently on. |
| … |
… |
var postboxes;
|
| 252 | 260 | * Saves the order of the postboxes to the server. Sends a list of all postboxes inside a sortable area to the |
| 253 | 261 | * server. |
| 254 | 262 | * |
| | 263 | * @since 2.8.0 |
| 255 | 264 | * @memberof postboxes |
| 256 | 265 | * |
| 257 | 266 | * @param {string} page The page we are currently on. |
| … |
… |
var postboxes;
|
| 277 | 286 | * Adds a message to empty sortable areas on the dashboard page. Also adds a border around the side area on the |
| 278 | 287 | * post edit screen if there are no postboxes present. |
| 279 | 288 | * |
| | 289 | * @since 3.3.0 |
| 280 | 290 | * @memberof postboxes |
| 281 | 291 | * @private |
| 282 | 292 | */ |
| … |
… |
var postboxes;
|
| 306 | 316 | /** |
| 307 | 317 | * Changes the amount of columns on the post edit page. |
| 308 | 318 | * |
| | 319 | * @since 3.3.0 |
| 309 | 320 | * @memberof postboxes |
| 310 | 321 | * @fires postboxes#postboxes-columnchange |
| 311 | 322 | * @private |
| … |
… |
var postboxes;
|
| 331 | 342 | * Changes the postboxes based on the current orientation of the browser. Meant to be called when the |
| 332 | 343 | * orientation of the browser changes. |
| 333 | 344 | * |
| | 345 | * @since 3.3.0 |
| 334 | 346 | * @memberof postboxes |
| 335 | 347 | * @private |
| 336 | 348 | */ |
| … |
… |
var postboxes;
|
| 358 | 370 | /* Callbacks */ |
| 359 | 371 | |
| 360 | 372 | /** |
| | 373 | * @since 2.7.0 |
| 361 | 374 | * @property {Function|boolean} pbshow A callback that is called when a postbox is opened. |
| 362 | 375 | * @memberof postboxes |
| 363 | 376 | */ |
| 364 | 377 | pbshow : false, |
| 365 | 378 | |
| 366 | 379 | /** |
| | 380 | * @since 2.7.0 |
| 367 | 381 | * @property {Function|boolean} pbhide A callback that is called when a postbox is closed. |
| 368 | 382 | * @memberof postboxes |
| 369 | 383 | */ |
From e762ed0b8d7c27b15da5ff42bb0e88cdc2969963 Mon Sep 17 00:00:00 2001
From: Anton Timmermans <email@atimmer.com>
Date: Thu, 14 Jul 2016 22:48:58 +0200
Subject: [PATCH 5/5] Follow WordPress JS Documentation standards
---
src/wp-admin/js/postbox.js | 104 +++++++++++++++++++++++++++++++--------------
1 file changed, 71 insertions(+), 33 deletions(-)
diff --git a/src/wp-admin/js/postbox.js b/src/wp-admin/js/postbox.js
index 767a4d6..ce4cf85 100644
|
a
|
b
|
|
| | 1 | /** |
| | 2 | * Contains the postboxes logic, opening and closing postboxes, reordering and saving |
| | 3 | * the state and ordering to the database. |
| | 4 | * |
| | 5 | * @summary Contains postboxes logic |
| | 6 | * |
| | 7 | * @since 2.4.0 |
| | 8 | * @requires jQuery |
| | 9 | */ |
| | 10 | |
| 1 | 11 | /* global ajaxurl, postBoxL10n */ |
| 2 | 12 | |
| 3 | 13 | /** |
| … |
… |
var postboxes;
|
| 18 | 28 | postboxes = { |
| 19 | 29 | |
| 20 | 30 | /** |
| 21 | | * Handles a click on either the postbox heading or the postbox open/close icon. Opens or closes the postbox. |
| 22 | | * Expects this to equal the clicked element. |
| | 31 | * @summary Handles a click on either the postbox heading or the postbox open/close icon. |
| 23 | 32 | * |
| 24 | | * Triggers postboxes.pbshow if the postbox has just been opened, triggers postboxes.pbhide if the postbox has |
| 25 | | * just been closed. |
| | 33 | * Opens or closes the postbox. Expects `this` to equal the clicked element. |
| | 34 | * Calls postboxes.pbshow if the postbox has been opened, calls postboxes.pbhide |
| | 35 | * if the postbox has been closed. |
| 26 | 36 | * |
| 27 | 37 | * @since 4.4.0 |
| 28 | 38 | * @memberof postboxes |
| … |
… |
var postboxes;
|
| 64 | 74 | } |
| 65 | 75 | |
| 66 | 76 | /** |
| 67 | | * Fires when the postbox has been opened or closed. Contains a jQuery object with the postbox element in |
| 68 | | * it. |
| | 77 | * @summary Fires when a postbox has been opened or closed. |
| | 78 | * |
| | 79 | * Contains a jQuery object with the relevant postbox element. |
| 69 | 80 | * |
| 70 | 81 | * @since 4.0.0 |
| 71 | 82 | * @event postboxes#postbox-toggled |
| … |
… |
var postboxes;
|
| 93 | 104 | |
| 94 | 105 | $handles.on( 'click.postboxes', this.handle_click ); |
| 95 | 106 | |
| | 107 | /** |
| | 108 | * @since 2.7.0 |
| | 109 | */ |
| 96 | 110 | $('.postbox .hndle a').click( function(e) { |
| 97 | 111 | e.stopPropagation(); |
| 98 | 112 | }); |
| 99 | 113 | |
| 100 | 114 | /** |
| 101 | | * Adds an event handler to the dismissal of a postbox. Event handler completely hides the postbox element |
| 102 | | * and it cannot be closed or opened afterwards. |
| | 115 | * @summary Hides a postbox. |
| | 116 | * |
| | 117 | * Event handler for the postbox dismiss button. After clicking the button |
| | 118 | * the postbox will be hidden. |
| | 119 | * |
| | 120 | * @since 3.2.0 |
| 103 | 121 | */ |
| 104 | 122 | $( '.postbox a.dismiss' ).on( 'click.postboxes', function( e ) { |
| 105 | 123 | var hide_id = $(this).parents('.postbox').attr('id') + '-hide'; |
| … |
… |
var postboxes;
|
| 108 | 126 | }); |
| 109 | 127 | |
| 110 | 128 | /** |
| 111 | | * Adds an event handler to the screen option checkboxes. Event handler completely hides the postbox element |
| | 129 | * @summary Hides the postbox element |
| | 130 | * |
| | 131 | * Event handler for the screen options checkboxes. When a checkbox is |
| | 132 | * clicked this function will hide or show the relevant postboxes. |
| 112 | 133 | * |
| | 134 | * @since 2.7.0 |
| 113 | 135 | * @fires postboxes#postbox-toggled |
| 114 | 136 | */ |
| 115 | 137 | $('.hide-postbox-tog').bind('click.postboxes', function() { |
| … |
… |
var postboxes;
|
| 140 | 162 | }); |
| 141 | 163 | |
| 142 | 164 | /** |
| 143 | | * Adds an event handler to the screen options layout preferences. |
| | 165 | * @summary Changes the amount of columns based on the layout preferences. |
| | 166 | * |
| | 167 | * @since 2.8.0 |
| 144 | 168 | */ |
| 145 | 169 | $('.columns-prefs input[type="radio"]').bind('click.postboxes', function(){ |
| 146 | 170 | var n = parseInt($(this).val(), 10); |
| … |
… |
var postboxes;
|
| 153 | 177 | }, |
| 154 | 178 | |
| 155 | 179 | /** |
| 156 | | * Initializes all the postboxes, mainly their sortable behaviour. |
| | 180 | * @summary Initializes all the postboxes, mainly their sortable behaviour. |
| 157 | 181 | * |
| 158 | 182 | * @since 2.7.0 |
| 159 | 183 | * @memberof postboxes |
| 160 | 184 | * |
| 161 | 185 | * @param {string} page The page we are currently on. |
| 162 | | * @param {Object} [args] |
| | 186 | * @param {Object} [args={}] The arguments for the postbox initializer. |
| 163 | 187 | * @param {Function} args.pbshow A callback that is called when a postbox opens. |
| 164 | | * @param {Function} args.pbhide A callback that is called when a postbox closes. |
| | 188 | * @param {Function} args.pbhide A callback that is called when a postbox |
| | 189 | * closes. |
| 165 | 190 | */ |
| 166 | 191 | init : function(page, args) { |
| 167 | 192 | var isMobile = $( document.body ).hasClass( 'mobile' ), |
| … |
… |
var postboxes;
|
| 180 | 205 | tolerance: 'pointer', |
| 181 | 206 | forcePlaceholderSize: true, |
| 182 | 207 | helper: function( event, element ) { |
| 183 | | // `helper: 'clone'` is equivalent to `return element.clone();` |
| 184 | | // Cloning a checked radio and then inserting that clone next to the original |
| 185 | | // radio unchecks the original radio (since only one of the two can be checked). |
| 186 | | // We get around this by renaming the helper's inputs' name attributes so that, |
| 187 | | // when the helper is inserted into the DOM for the sortable, no radios are |
| 188 | | // duplicated, and no original radio gets unchecked. |
| | 208 | /* `helper: 'clone'` is equivalent to `return element.clone();` |
| | 209 | * Cloning a checked radio and then inserting that clone next to the original |
| | 210 | * radio unchecks the original radio (since only one of the two can be checked). |
| | 211 | * We get around this by renaming the helper's inputs' name attributes so that, |
| | 212 | * when the helper is inserted into the DOM for the sortable, no radios are |
| | 213 | * duplicated, and no original radio gets unchecked. |
| | 214 | */ |
| 189 | 215 | return element.clone() |
| 190 | 216 | .find( ':input' ) |
| 191 | 217 | .attr( 'name', function( i, currentName ) { |
| … |
… |
var postboxes;
|
| 228 | 254 | }, |
| 229 | 255 | |
| 230 | 256 | /** |
| 231 | | * Saves the state of the postboxes to the server. It sends two lists, one with all the closed postboxes, one |
| 232 | | * with all the hidden postboxes. |
| | 257 | * @summary Saves the state of the postboxes to the server. |
| | 258 | * |
| | 259 | * Saves the state of the postboxes to the server. It sends two lists, one with |
| | 260 | * all the closed postboxes, one with all the hidden postboxes. |
| 233 | 261 | * |
| 234 | 262 | * @since 2.7.0 |
| 235 | 263 | * @memberof postboxes |
| … |
… |
var postboxes;
|
| 257 | 285 | }, |
| 258 | 286 | |
| 259 | 287 | /** |
| 260 | | * Saves the order of the postboxes to the server. Sends a list of all postboxes inside a sortable area to the |
| 261 | | * server. |
| | 288 | * @summary Saves the order of the postboxes to the server. |
| | 289 | * |
| | 290 | * Saves the order of the postboxes to the server. Sends a list of all postboxes |
| | 291 | * inside a sortable area to the server. |
| 262 | 292 | * |
| 263 | 293 | * @since 2.8.0 |
| 264 | 294 | * @memberof postboxes |
| … |
… |
var postboxes;
|
| 283 | 313 | }, |
| 284 | 314 | |
| 285 | 315 | /** |
| 286 | | * Adds a message to empty sortable areas on the dashboard page. Also adds a border around the side area on the |
| 287 | | * post edit screen if there are no postboxes present. |
| | 316 | * @summary Marks empty postbox areas. |
| | 317 | * |
| | 318 | * Adds a message to empty sortable areas on the dashboard page. Also adds a |
| | 319 | * border around the side area on the post edit screen if there are no postboxes |
| | 320 | * present. |
| 288 | 321 | * |
| 289 | 322 | * @since 3.3.0 |
| 290 | 323 | * @memberof postboxes |
| 291 | | * @private |
| | 324 | * @access private |
| 292 | 325 | */ |
| 293 | 326 | _mark_area : function() { |
| 294 | 327 | var visible = $('div.postbox:visible').length, side = $('#post-body #side-sortables'); |
| … |
… |
var postboxes;
|
| 314 | 347 | }, |
| 315 | 348 | |
| 316 | 349 | /** |
| 317 | | * Changes the amount of columns on the post edit page. |
| | 350 | * @summary Changes the amount of columns on the post edit page. |
| 318 | 351 | * |
| 319 | 352 | * @since 3.3.0 |
| 320 | 353 | * @memberof postboxes |
| 321 | 354 | * @fires postboxes#postboxes-columnchange |
| 322 | | * @private |
| | 355 | * @access private |
| 323 | 356 | * |
| 324 | 357 | * @param {number} n The amount of columns to divide the post edit page in. |
| 325 | 358 | */ |
| … |
… |
var postboxes;
|
| 333 | 366 | /** |
| 334 | 367 | * Fires when the amount of columns on the post edit page has been changed. |
| 335 | 368 | * |
| | 369 | * @since 4.0.0 |
| 336 | 370 | * @event postboxes#postboxes-columnchange |
| 337 | 371 | */ |
| 338 | 372 | $( document ).trigger( 'postboxes-columnchange' ); |
| 339 | 373 | }, |
| 340 | 374 | |
| 341 | 375 | /** |
| 342 | | * Changes the postboxes based on the current orientation of the browser. Meant to be called when the |
| 343 | | * orientation of the browser changes. |
| | 376 | * @summary Changes the amount of columns the postboxes are in based on the |
| | 377 | * current orientation of the browser. |
| 344 | 378 | * |
| 345 | 379 | * @since 3.3.0 |
| 346 | 380 | * @memberof postboxes |
| 347 | | * @private |
| | 381 | * @access private |
| 348 | 382 | */ |
| 349 | 383 | _pb_change : function() { |
| 350 | 384 | var check = $( 'label.columns-prefs-1 input[type="radio"]' ); |
| … |
… |
var postboxes;
|
| 371 | 405 | |
| 372 | 406 | /** |
| 373 | 407 | * @since 2.7.0 |
| 374 | | * @property {Function|boolean} pbshow A callback that is called when a postbox is opened. |
| 375 | 408 | * @memberof postboxes |
| | 409 | * @access public |
| | 410 | * @property {Function|boolean} pbshow A callback that is called when a postbox |
| | 411 | * is opened. |
| 376 | 412 | */ |
| 377 | 413 | pbshow : false, |
| 378 | 414 | |
| 379 | 415 | /** |
| 380 | 416 | * @since 2.7.0 |
| 381 | | * @property {Function|boolean} pbhide A callback that is called when a postbox is closed. |
| 382 | 417 | * @memberof postboxes |
| | 418 | * @access public |
| | 419 | * @property {Function|boolean} pbhide A callback that is called when a postbox |
| | 420 | * is closed. |
| 383 | 421 | */ |
| 384 | 422 | pbhide : false |
| 385 | 423 | }; |