From 818d71a48ac3e1a163b08b661a3d21efd84f7f13 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Sun, 15 May 2016 09:59:55 +0200 Subject: [PATCH] Replace removed `$.browser.mobile` --- wcfsetup/install/files/js/WCF.js | 42 ++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index a34d32a353..5b64b87e32 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -1137,12 +1137,14 @@ WCF.Dropdown.Interactive.Instance = Class.extend({ this._pointer = $('').appendTo(this._container); - if (!$.browser.mobile && $itemContainer !== null) { - // use jQuery scrollbar on desktop, mobile browsers have a similar display built-in - $itemContainer.perfectScrollbar({ - suppressScrollX: true - }); - } + require(['Environment'], function(Environment) { + if (Environment.platform() !== 'desktop' && $itemContainer !== null) { + // use jQuery scrollbar on desktop, mobile browsers have a similar display built-in + $itemContainer.perfectScrollbar({ + suppressScrollX: true + }); + } + }); this._container.appendTo(dropdownContainer); }, @@ -1249,15 +1251,17 @@ WCF.Dropdown.Interactive.Instance = Class.extend({ * Rebuilds the desktop scrollbar. */ rebuildScrollbar: function() { - if (!$.browser.mobile) { - var $itemContainer = this._itemList.parent(); - - // do NOT use 'update', seems to be broken - $itemContainer.perfectScrollbar('destroy'); - $itemContainer.perfectScrollbar({ - suppressScrollX: true - }); - } + require(['Environment'], function(Environment) { + if (Environment.platform() !== 'desktop') { + var $itemContainer = this._itemList.parent(); + + // do NOT use 'update', seems to be broken + $itemContainer.perfectScrollbar('destroy'); + $itemContainer.perfectScrollbar({ + suppressScrollX: true + }); + } + }.bind(this)); } }); @@ -6907,7 +6911,13 @@ WCF.Popover = Class.extend({ * @param string selector */ init: function(selector) { - if ($.browser.mobile) return; + var mobile = false; + require(['Environment'], function(Environment) { + if (Environment.platform() !== 'desktop') { + mobile = true; + } + }.bind(this)); + if (mobile) return; // assign default values this._activeElementID = ''; -- 2.20.1