wp/wp-admin/js/postbox.js
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    65 			if ( postboxes.page !== 'press-this' ) {
    65 			if ( postboxes.page !== 'press-this' ) {
    66 				postboxes.save_state( postboxes.page );
    66 				postboxes.save_state( postboxes.page );
    67 			}
    67 			}
    68 
    68 
    69 			if ( id ) {
    69 			if ( id ) {
    70 				if ( !p.hasClass('closed') && $.isFunction( postboxes.pbshow ) ) {
    70 				if ( !p.hasClass('closed') && typeof postboxes.pbshow === 'function' ) {
    71 					postboxes.pbshow( id );
    71 					postboxes.pbshow( id );
    72 				} else if ( p.hasClass('closed') && $.isFunction( postboxes.pbhide ) ) {
    72 				} else if ( p.hasClass('closed') && typeof postboxes.pbhide === 'function' ) {
    73 					postboxes.pbhide( id );
    73 					postboxes.pbhide( id );
    74 				}
    74 				}
    75 			}
    75 			}
    76 
    76 
    77 			/**
    77 			/**
   125 					postboxes.handleOrderBetweenSortables( 'previous', button, postbox );
   125 					postboxes.handleOrderBetweenSortables( 'previous', button, postbox );
   126 					return;
   126 					return;
   127 				}
   127 				}
   128 
   128 
   129 				postbox.prevAll( '.postbox:visible' ).eq( 0 ).before( postbox );
   129 				postbox.prevAll( '.postbox:visible' ).eq( 0 ).before( postbox );
   130 				button.focus();
   130 				button.trigger( 'focus' );
   131 				postboxes.updateOrderButtonsProperties();
   131 				postboxes.updateOrderButtonsProperties();
   132 				postboxes.save_order( postboxes.page );
   132 				postboxes.save_order( postboxes.page );
   133 			}
   133 			}
   134 
   134 
   135 			// Move a postbox down.
   135 			// Move a postbox down.
   139 					postboxes.handleOrderBetweenSortables( 'next', button, postbox );
   139 					postboxes.handleOrderBetweenSortables( 'next', button, postbox );
   140 					return;
   140 					return;
   141 				}
   141 				}
   142 
   142 
   143 				postbox.nextAll( '.postbox:visible' ).eq( 0 ).after( postbox );
   143 				postbox.nextAll( '.postbox:visible' ).eq( 0 ).after( postbox );
   144 				button.focus();
   144 				button.trigger( 'focus' );
   145 				postboxes.updateOrderButtonsProperties();
   145 				postboxes.updateOrderButtonsProperties();
   146 				postboxes.save_order( postboxes.page );
   146 				postboxes.save_order( postboxes.page );
   147 			}
   147 			}
   148 
   148 
   149 		},
   149 		},
   265 			$orderButtons.on( 'click.postboxes', this.handleOrder );
   265 			$orderButtons.on( 'click.postboxes', this.handleOrder );
   266 
   266 
   267 			/**
   267 			/**
   268 			 * @since 2.7.0
   268 			 * @since 2.7.0
   269 			 */
   269 			 */
   270 			$('.postbox .hndle a').click( function(e) {
   270 			$('.postbox .hndle a').on( 'click', function(e) {
   271 				e.stopPropagation();
   271 				e.stopPropagation();
   272 			});
   272 			});
   273 
   273 
   274 			/**
   274 			/**
   275 			 * Hides a postbox.
   275 			 * Hides a postbox.
   300 			 *
   300 			 *
   301 			 * @fires postboxes#postbox-toggled
   301 			 * @fires postboxes#postbox-toggled
   302 			 *
   302 			 *
   303 			 * @return {void}
   303 			 * @return {void}
   304 			 */
   304 			 */
   305 			$('.hide-postbox-tog').bind('click.postboxes', function() {
   305 			$('.hide-postbox-tog').on('click.postboxes', function() {
   306 				var $el = $(this),
   306 				var $el = $(this),
   307 					boxId = $el.val(),
   307 					boxId = $el.val(),
   308 					$postbox = $( '#' + boxId );
   308 					$postbox = $( '#' + boxId );
   309 
   309 
   310 				if ( $el.prop( 'checked' ) ) {
   310 				if ( $el.prop( 'checked' ) ) {
   311 					$postbox.show();
   311 					$postbox.show();
   312 					if ( $.isFunction( postboxes.pbshow ) ) {
   312 					if ( typeof postboxes.pbshow === 'function' ) {
   313 						postboxes.pbshow( boxId );
   313 						postboxes.pbshow( boxId );
   314 					}
   314 					}
   315 				} else {
   315 				} else {
   316 					$postbox.hide();
   316 					$postbox.hide();
   317 					if ( $.isFunction( postboxes.pbhide ) ) {
   317 					if ( typeof postboxes.pbhide === 'function' ) {
   318 						postboxes.pbhide( boxId );
   318 						postboxes.pbhide( boxId );
   319 					}
   319 					}
   320 				}
   320 				}
   321 
   321 
   322 				postboxes.save_state( page );
   322 				postboxes.save_state( page );
   334 			 *
   334 			 *
   335 			 * @since 2.8.0
   335 			 * @since 2.8.0
   336 			 *
   336 			 *
   337 			 * @return {void}
   337 			 * @return {void}
   338 			 */
   338 			 */
   339 			$('.columns-prefs input[type="radio"]').bind('click.postboxes', function(){
   339 			$('.columns-prefs input[type="radio"]').on('click.postboxes', function(){
   340 				var n = parseInt($(this).val(), 10);
   340 				var n = parseInt($(this).val(), 10);
   341 
   341 
   342 				if ( n ) {
   342 				if ( n ) {
   343 					postboxes._pb_edit(n);
   343 					postboxes._pb_edit(n);
   344 					postboxes.save_order( page );
   344 					postboxes.save_order( page );
   418 					$document.trigger( 'postbox-moved', ui.item );
   418 					$document.trigger( 'postbox-moved', ui.item );
   419 				}
   419 				}
   420 			});
   420 			});
   421 
   421 
   422 			if ( isMobile ) {
   422 			if ( isMobile ) {
   423 				$(document.body).bind('orientationchange.postboxes', function(){ postboxes._pb_change(); });
   423 				$(document.body).on('orientationchange.postboxes', function(){ postboxes._pb_change(); });
   424 				this._pb_change();
   424 				this._pb_change();
   425 			}
   425 			}
   426 
   426 
   427 			this._mark_area();
   427 			this._mark_area();
   428 
   428