Move the check for body.mobile in postbox.js to a variable as it's used in more than one place, props georgestephanis, scribu, fixes #20561

git-svn-id: https://develop.svn.wordpress.org/trunk@20677 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2012-05-01 22:50:47 +00:00
parent 8dca40f570
commit 06ede87876
1 changed files with 4 additions and 2 deletions

View File

@ -63,6 +63,8 @@ var postboxes;
},
init : function(page, args) {
var isMobile = $(document.body).hasClass('mobile');
$.extend( this, args || {} );
$('#wpbody-content').css('overflow','hidden');
$('.meta-box-sortables').sortable({
@ -71,7 +73,7 @@ var postboxes;
items: '.postbox',
handle: '.hndle',
cursor: 'move',
delay: ( $('body').hasClass('mobile') ? 200 : 0 ),
delay: ( isMobile ? 200 : 0 ),
distance: 2,
tolerance: 'pointer',
forcePlaceholderSize: true,
@ -93,7 +95,7 @@ var postboxes;
}
});
if ( navigator.userAgent.match(/mobile/i) ) {
if ( isMobile ) {
$(document.body).bind('orientationchange.postboxes', function(){ postboxes._pb_change(); });
this._pb_change();
}