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: http://core.svn.wordpress.org/trunk@20677 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6670a497dd
commit
08924f3439
|
@ -63,6 +63,8 @@ var postboxes;
|
||||||
},
|
},
|
||||||
|
|
||||||
init : function(page, args) {
|
init : function(page, args) {
|
||||||
|
var isMobile = $(document.body).hasClass('mobile');
|
||||||
|
|
||||||
$.extend( this, args || {} );
|
$.extend( this, args || {} );
|
||||||
$('#wpbody-content').css('overflow','hidden');
|
$('#wpbody-content').css('overflow','hidden');
|
||||||
$('.meta-box-sortables').sortable({
|
$('.meta-box-sortables').sortable({
|
||||||
|
@ -71,7 +73,7 @@ var postboxes;
|
||||||
items: '.postbox',
|
items: '.postbox',
|
||||||
handle: '.hndle',
|
handle: '.hndle',
|
||||||
cursor: 'move',
|
cursor: 'move',
|
||||||
delay: ( $('body').hasClass('mobile') ? 200 : 0 ),
|
delay: ( isMobile ? 200 : 0 ),
|
||||||
distance: 2,
|
distance: 2,
|
||||||
tolerance: 'pointer',
|
tolerance: 'pointer',
|
||||||
forcePlaceholderSize: true,
|
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(); });
|
$(document.body).bind('orientationchange.postboxes', function(){ postboxes._pb_change(); });
|
||||||
this._pb_change();
|
this._pb_change();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue