Remove enquire.js usage
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 13 Mar 2019 18:40:02 +0000 (19:40 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 13 Mar 2019 18:40:51 +0000 (19:40 +0100)
see discussion in #2866

wcfsetup/install/files/js/WCF.ImageViewer.js
wcfsetup/install/files/js/WCF.Location.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js

index 10ad8da41c3b4d9321ef198b9be973493bce338c..16b635fca6cba2d59f72ae8e2647d7d336215726 100644 (file)
@@ -923,10 +923,12 @@ $.widget('ui.wcfImageViewer', {
                
                WCF.DOMNodeInsertedHandler.execute();
                
-               enquire.register('(max-width: 767px)', {
-                       match: $.proxy(this._enableMobileView, this),
-                       unmatch: $.proxy(this._disableMobileView, this)
-               });
+               require(['Ui/Screen'], function(UiScreen) {
+                       UiScreen.on('screen-sm-down', {
+                               match: $.proxy(this._enableMobileView, this),
+                               unmatch: $.proxy(this._disableMobileView, this)
+                       });
+               }.bind(this));
                
                return true;
        },
index 82bd9a22e92bbfa072e17104000d0ce9987870c5..fec9bca6505ffcac904a2c760b6ce743210898aa 100644 (file)
@@ -131,10 +131,11 @@ WCF.Location.GoogleMaps.Map = Class.extend({
                // fix maps in mobile sidebars by refreshing the map when displaying
                // the map
                if (this._mapContainer.parents('.sidebar').length) {
-                       enquire.register('(max-width: 767px)', {
-                               setup: $.proxy(this._addSidebarMapListener, this),
-                               deferSetup: true
-                       });
+                       require(['Ui/Screen'], function(UiScreen) {
+                               UiScreen.on('screen-sm-down', {
+                                       setup: $.proxy(this._addSidebarMapListener, this)
+                               });
+                       }.bind(this));
                }
                
                this.refresh();
index c1984c3d0f14e8a97d529d1e74e04f04c834af7b..91bf65aac935da86c8f1f1cec2bd09eaf06a9c66 100644 (file)
@@ -8,13 +8,13 @@
  */
 define(
        [
-               'enquire',      'Ajax',       'Core',      'Dictionary',
+               'Ajax',         'Core',       'Dictionary',
                'Environment',  'Language',   'ObjectMap', 'Dom/ChangeListener',
                'Dom/Traverse', 'Dom/Util',   'Ui/Confirmation', 'Ui/Screen', 'Ui/SimpleDropdown',
                'EventHandler', 'List',       'EventKey'
        ],
        function(
-               enquire,        Ajax,         Core,        Dictionary,
+               Ajax,           Core,         Dictionary,
                Environment,    Language,     ObjectMap,   DomChangeListener,
                DomTraverse,    DomUtil,      UiConfirmation, UiScreen, UiSimpleDropdown,
                EventHandler,   List,         EventKey