From 08924f343975558a7e9dbb091cf0d6e133d0a208 Mon Sep 17 00:00:00 2001 From: azaozz Date: Tue, 1 May 2012 22:50:47 +0000 Subject: [PATCH] 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 --- wp-admin/js/postbox.dev.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/wp-admin/js/postbox.dev.js b/wp-admin/js/postbox.dev.js index 5471d321d5..95b0cb30e9 100644 --- a/wp-admin/js/postbox.dev.js +++ b/wp-admin/js/postbox.dev.js @@ -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(); }