Transformed singletons into object literals
authorAlexander Ebert <ebert@woltlab.com>
Sat, 30 May 2015 23:39:49 +0000 (01:39 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 30 May 2015 23:39:49 +0000 (01:39 +0200)
26 files changed:
wcfsetup/install/files/js/WoltLab/WCF/Ajax.js
wcfsetup/install/files/js/WoltLab/WCF/Ajax/Jsonp.js
wcfsetup/install/files/js/WoltLab/WCF/Ajax/Status.js
wcfsetup/install/files/js/WoltLab/WCF/Bootstrap.js
wcfsetup/install/files/js/WoltLab/WCF/BootstrapFrontend.js
wcfsetup/install/files/js/WoltLab/WCF/CallbackList.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/Notice/Dismiss.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/Sitemap.js
wcfsetup/install/files/js/WoltLab/WCF/Controller/Style/Changer.js
wcfsetup/install/files/js/WoltLab/WCF/Core.js
wcfsetup/install/files/js/WoltLab/WCF/DOM/Change/Listener.js
wcfsetup/install/files/js/WoltLab/WCF/DOM/Traverse.js
wcfsetup/install/files/js/WoltLab/WCF/DOM/Util.js
wcfsetup/install/files/js/WoltLab/WCF/Date/Time/Relative.js
wcfsetup/install/files/js/WoltLab/WCF/Environment.js
wcfsetup/install/files/js/WoltLab/WCF/Event/Handler.js
wcfsetup/install/files/js/WoltLab/WCF/Language.js
wcfsetup/install/files/js/WoltLab/WCF/NumberUtil.js
wcfsetup/install/files/js/WoltLab/WCF/StringUtil.js
wcfsetup/install/files/js/WoltLab/WCF/UI/Alignment.js
wcfsetup/install/files/js/WoltLab/WCF/UI/Dialog.js
wcfsetup/install/files/js/WoltLab/WCF/UI/Dropdown/Simple.js
wcfsetup/install/files/js/WoltLab/WCF/UI/Mobile.js
wcfsetup/install/files/js/WoltLab/WCF/UI/TabMenu.js
wcfsetup/install/files/js/WoltLab/WCF/UI/Tooltip.js

index eaf6bb8b2c27924df664c0b6c291ae23abd20aef..1d32756690069bb184e98b466d4fe6b66c09809b 100644 (file)
@@ -12,10 +12,9 @@ define(['AjaxRequest', 'Core', 'ObjectMap'], function(AjaxRequest, Core, ObjectM
        var _requests = new ObjectMap();
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Ajax
         */
-       function Ajax() {};
-       Ajax.prototype = {
+       var Ajax = {
                /**
                 * Shorthand function to perform a request against the WCF-API with overrides
                 * for success and failure callbacks.
@@ -87,5 +86,5 @@ define(['AjaxRequest', 'Core', 'ObjectMap'], function(AjaxRequest, Core, ObjectM
                }
        };
        
-       return new Ajax();
+       return Ajax;
 });
index 12a7de89ea1a36b38ca844b144c882d2251266c3..6f501d513ff8f124407ff54b914ba9f78d2f79f6 100644 (file)
@@ -10,10 +10,9 @@ define(['Core'], function(Core) {
        "use strict";
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Ajax/Jsonp
         */
-       function AjaxJsonp() {};
-       AjaxJsonp.prototype = {
+       var AjaxJsonp = {
                /**
                 * Issues a JSONP request.
                 * 
@@ -57,12 +56,12 @@ define(['Core'], function(Core) {
                        url += options.parameterName + '=' + callbackName;
                        
                        var script = document.createElement('script');
-                       script.setAttribute('async', true);
+                       script.async = true;
                        script.setAttribute('src', url);
                        
                        document.head.appendChild(script);
                }
        };
        
-       return new AjaxJsonp();
+       return AjaxJsonp;
 });
index 7eedcc80ac6ccb63b1b800483f3dd5834d1a9e6b..ef0425f3b4d3177fa606345f3b087c280c66f92e 100644 (file)
@@ -14,10 +14,9 @@ define(['Language'], function(Language) {
        var _timeoutShow = null;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Ajax/Status
         */
-       function AjaxStatus() {}
-       AjaxStatus.prototype = {
+       var AjaxStatus = {
                /**
                 * Initializes the status overlay on first usage.
                 */
@@ -73,5 +72,5 @@ define(['Language'], function(Language) {
                }
        };
        
-       return new AjaxStatus();
+       return AjaxStatus;
 });
index 659313b7a87967c99fb76d52465b4862b38a10b6..cc9ac288f658b9c236e696adf00cdad490304596 100644 (file)
@@ -33,10 +33,9 @@ define(
        window.WCF.Language.addObject = Language.addObject;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Bootstrap
         */
-       function Bootstrap() {}
-       Bootstrap.prototype = {
+       var Bootstrap = {
                /**
                 * Initializes the core UI modifications and unblocks jQuery's ready event.
                 */
@@ -76,5 +75,5 @@ define(
                }
        };
        
-       return new Bootstrap();
+       return Bootstrap;
 });
index 20dfb362878b8891bf038f99f38f2d3833195e30..c0db4f006a858407ef769fbd7c200b1ca58b058e 100644 (file)
@@ -10,10 +10,9 @@ define(['Ajax', 'WoltLab/WCF/Bootstrap', 'WoltLab/WCF/Controller/Sitemap', 'Wolt
        "use strict";
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/BootstrapFrontend
         */
-       function BootstrapFrontend() {}
-       BootstrapFrontend.prototype = {
+       var BootstrapFrontend = {
                /**
                 * Bootstraps general modules and frontend exclusive ones.
                 * 
@@ -54,5 +53,5 @@ define(['Ajax', 'WoltLab/WCF/Bootstrap', 'WoltLab/WCF/Controller/Sitemap', 'Wolt
                }
        };
        
-       return new BootstrapFrontend();
+       return BootstrapFrontend;
 });
index 35921724ac73c424b1779f64e1854a97e312e624..0aa106ea35f8404dd211bdefb8087053545be822 100644 (file)
@@ -40,7 +40,7 @@ define(['Dictionary'], function(Dictionary) {
                 * @param       {string}        identifier      arbitrary string to group and identify callbacks
                 */
                remove: function(identifier) {
-                       this._dictionary.delete(identifier);
+                       this._dictionary['delete'](identifier);
                },
                
                /**
index 2a0d58645a3b137b53f47ad6a6dbfd6ab6c38f78..502898cb9fe72ed410eb7b7452a3af390968f520 100644 (file)
@@ -10,10 +10,9 @@ define(['Ajax'], function(Ajax) {
        "use strict";
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Controller/Notice/Dismiss
         */
-       function ControllerNoticeDismiss() {};
-       ControllerNoticeDismiss.prototype = {
+       var ControllerNoticeDismiss = {
                /**
                 * Initializes dismiss buttons.
                 */
@@ -53,5 +52,5 @@ define(['Ajax'], function(Ajax) {
                }
        };
        
-       return new ControllerNoticeDismiss();
+       return ControllerNoticeDismiss;
 });
index fec8f529e962b8f2d544d5493cd5a1718c026a54..b106cc0da524bb0306b15aa64e9122522345ca2f 100644 (file)
@@ -36,10 +36,9 @@ define(['Ajax', 'Dictionary', 'Environment', 'DOM/ChangeListener', 'DOM/Util', '
        /** @const */ var DELAY_HIDE = 500;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Controller/Popover
         */
-       function ControllerPopover() {};
-       ControllerPopover.prototype = {
+       var ControllerPopover = {
                /**
                 * Builds popover DOM elements and binds event listeners.
                 */
@@ -418,9 +417,9 @@ define(['Ajax', 'Dictionary', 'Environment', 'DOM/ChangeListener', 'DOM/Util', '
                                throw new TypeError("Expected a valid callback for parameter 'success'.");
                        }
                        
-                       Ajax.apiProxy(this, data, success, failure);
+                       Ajax.api(this, data, success, failure);
                }
        };
        
-       return new ControllerPopover();
+       return ControllerPopover;
 });
index b950051e65ac85e48a4245ff8ee89fb276b57638..7e6c6888c2d54c10d71044849d8bc0e0140a6317 100644 (file)
@@ -13,10 +13,9 @@ define(['Ajax', 'EventHandler', 'Language', 'DOM/Util', 'UI/Dialog', 'UI/TabMenu
        var _dialog = null;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Controller/Sitemap
         */
-       function ControllerSitemap() {};
-       ControllerSitemap.prototype = {
+       var ControllerSitemap = {
                /**
                 * Binds click handler.
                 */
@@ -93,5 +92,5 @@ define(['Ajax', 'EventHandler', 'Language', 'DOM/Util', 'UI/Dialog', 'UI/TabMenu
                } 
        };
        
-       return new ControllerSitemap();
+       return ControllerSitemap;
 });
index 9ea7a3ce823a6eb4363db6ba053b419569eaac79..37240ca4192a2078f9cc2c385f3db00abb9cdc72 100644 (file)
@@ -10,10 +10,9 @@ define(['Ajax', 'Language', 'UI/Dialog'], function(Ajax, Language, UIDialog) {
        "use strict";
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Controller/Style/Changer
         */
-       function ControllerStyleChanger() {};
-       ControllerStyleChanger.prototype = {
+       var ControllerStyleChanger = {
                /**
                 * Adds the style changer to the bottom navigation.
                 */
@@ -89,5 +88,5 @@ define(['Ajax', 'Language', 'UI/Dialog'], function(Ajax, Language, UIDialog) {
                }
        };
        
-       return new ControllerStyleChanger();
+       return ControllerStyleChanger;
 });
index b37850c5432b774113f5fc8a06da0a09c484840e..eab4c836d84028c700a59f0f01fcd8f1ecf94613 100644 (file)
@@ -41,10 +41,9 @@ define([], function() {
        };
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Core
         */
-       function Core() {};
-       Core.prototype = {
+       var Core = {
                /**
                 * Deep clones an object.
                 * 
@@ -195,5 +194,5 @@ define([], function() {
                }
        };
        
-       return new Core();
+       return Core;
 });
index 71972d90eabdfc0a982182bff6b4b683491f0f5a..e295c7dd046af8c893dc2ac151505f7437a25996 100644 (file)
@@ -14,10 +14,9 @@ define(['CallbackList'], function(CallbackList) {
        var _hot = false;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/DOM/Change/Listener
         */
-       function Listener() { };
-       Listener.prototype = {
+       var Listener = {
                /**
                 * @see WoltLab/WCF/CallbackList#add
                 */
@@ -49,5 +48,5 @@ define(['CallbackList'], function(CallbackList) {
                }
        };
        
-       return new Listener();
+       return Listener;
 });
index cc2416bc7abcbc05cb410e358d2885d2f12fd9bc..ea3132f24fb8fcf722d9301f3cf39c921d00491f 100644 (file)
@@ -58,10 +58,9 @@ define(['DOM/Util'], function(DOMUtil) {
        };
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/DOM/Traverse
         */
-       function DOMTraverse() {};
-       DOMTraverse.prototype = {
+       var DOMTraverse = {
                /**
                 * Examines child elements and returns the first child matching the given selector.
                 * 
@@ -248,5 +247,5 @@ define(['DOM/Util'], function(DOMUtil) {
                }
        };
        
-       return new DOMTraverse();
+       return DOMTraverse;
 });
index 596f88370f7eaf07ef17d6a50fef6fdc00c13e3d..34298c55164a0dc5fdcb2a589ee45377f47c46c9 100644 (file)
@@ -21,10 +21,9 @@ define([], function() {
        var _idCounter = 0;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/DOM/Util
         */
-       function DOMUtil() {};
-       DOMUtil.prototype = {
+       var DOMUtil = {
                /**
                 * Returns a DocumentFragment containing the provided HTML string as DOM nodes.
                 * 
@@ -202,11 +201,5 @@ define([], function() {
                }
        };
        
-       var domUtilObj = new DOMUtil();
-       
-       // expose methods on the window object for backwards-compatibility
-       window.domUtilGetUniqueId = domUtilObj.getUniqueId.bind(domUtilObj);
-       window.domUtilIdentify = domUtilObj.identify.bind(domUtilObj);
-       
-       return domUtilObj;
+       return DOMUtil;
 });
index 2fdb2b0b8662cd08ac57e9c7df42748fb7da36ae..3fcb5693cdcbd7c2f6235f9212e2e7d032607871 100644 (file)
@@ -9,20 +9,17 @@
 define(['DOM/ChangeListener', 'Language', 'WoltLab/WCF/Timer/Repeating'], function(DOMChangeListener, Language, Repeating) {
        "use strict";
        
-       var _elements = null;
+       var _elements = document.getElementsByTagName('time');
        var _offset = null;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Date/Time/Relative
         */
-       function DateTimeRelative() {};
-       DateTimeRelative.prototype = {
+       var DateTimeRelative = {
                /**
                 * Transforms <time> elements on init and binds event listeners.
                 */
                setup: function() {
-                       _elements = document.getElementsByTagName('time');
-                       
                        this._refresh();
                        
                        new Repeating(this._refresh.bind(this), 60000);
@@ -81,5 +78,5 @@ define(['DOM/ChangeListener', 'Language', 'WoltLab/WCF/Timer/Repeating'], functi
                }
        };
        
-       return new DateTimeRelative();
+       return DateTimeRelative;
 });
index 528077ef487ec5653fad8dbc8f8aab2f8daf9c16..a0fa0e213dfe6ae60b46eb1c28166f563230caa4 100644 (file)
@@ -15,10 +15,9 @@ define([], function() {
        var _touch = false;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Enviroment
         */
-       function Environment() {};
-       Environment.prototype = {
+       var Environment = {
                /**
                 * Determines environment variables.
                 */
@@ -123,5 +122,5 @@ define([], function() {
                }
        };
        
-       return new Environment();
+       return Environment;
 });
index ae6cd2c6c621fa5da0a443f5388344ecbf05a8b5..c65f09e6bb0405812848411ae1493b425a961e16 100644 (file)
@@ -12,10 +12,9 @@ define(['Core', 'Dictionary'], function(Core, Dictionary) {
        var _listeners = new Dictionary();
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Event/Handler
         */
-       function EventHandler() {};
-       EventHandler.prototype = {
+       var EventHandler = {
                /**
                 * Adds an event listener.
                 * 
@@ -86,7 +85,7 @@ define(['Core', 'Dictionary'], function(Core, Dictionary) {
                                return;
                        }
                        
-                       callbacks.delete(uuid);
+                       callbacks['delete'](uuid);
                },
                
                /**
@@ -105,13 +104,13 @@ define(['Core', 'Dictionary'], function(Core, Dictionary) {
                        }
                        
                        if (typeof action === 'undefined') {
-                               _listeners.delete(identifier);
+                               _listeners['delete'](identifier);
                        }
                        else {
-                               actions.delete(action);
+                               actions['delete'](action);
                        }
                }
        };
        
-       return new EventHandler();
+       return EventHandler;
 });
index c34f31e0c442a68c192d782e4981c7b40f48fe22..69947efc92f7f227e7a39183957627ca55f003af 100644 (file)
@@ -12,10 +12,9 @@ define(['Dictionary', './Template'], function(Dictionary, Template) {
        var _languageItems = new Dictionary();
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/Language
         */
-       function Language() { };
-       Language.prototype = {
+       var Language = {
                /**
                 * Adds all the language items in the given object to the store.
                 * 
@@ -68,5 +67,5 @@ define(['Dictionary', './Template'], function(Dictionary, Template) {
                }
        };
        
-       return new Language();
+       return Language;
 });
index 403681d7decac3f2f30722dc62f670f9776b25a8..8997d8263b303293580c85b911dcbb676e502fdb 100644 (file)
@@ -10,10 +10,9 @@ define([], function() {
        "use strict";
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/NumberUtil
         */
-       function NumberUtil() { };
-       NumberUtil.prototype = {
+       var NumberUtil = {
                /**
                 * Decimal adjustment of a number.
                 *
@@ -45,5 +44,5 @@ define([], function() {
                }
        };
        
-       return new NumberUtil();
+       return NumberUtil;
 });
index 8196b9161e44bb57b75ec51a9c4004c7e91d744d..05699b23164ea907b899e53d953dcfbd2ed90933 100644 (file)
@@ -10,10 +10,9 @@ define(['Language', './NumberUtil'], function(Language, NumberUtil) {
        "use strict";
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/StringUtil
         */
-       function StringUtil() { };
-       StringUtil.prototype = {
+       var StringUtil = {
                /**
                 * Adds thousands separators to a given number.
                 * 
@@ -102,5 +101,5 @@ define(['Language', './NumberUtil'], function(Language, NumberUtil) {
                }
        };
        
-       return new StringUtil();
+       return StringUtil;
 });
index cda84a8d7af83a70acfc1a9fa4c78262ca259b88..20527a7b4245b6548f878334838f7c4c61f8674f 100644 (file)
@@ -10,10 +10,9 @@ define(['Core', 'Language', 'DOM/Traverse', 'DOM/Util'], function(Core, Language
        "use strict";
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/UI/Alignment
         */
-       function UIAlignment() {};
-       UIAlignment.prototype = {
+       var UIAlignment = {
                /**
                 * Sets the alignment for target element relatively to the reference element.
                 * 
@@ -243,5 +242,5 @@ define(['Core', 'Language', 'DOM/Traverse', 'DOM/Util'], function(Core, Language
                }
        };
        
-       return new UIAlignment();
+       return UIAlignment;
 });
index b5ae883db5544438018556579677e7f7754f0f24..7e84faad593d121b0df38fe08f5ec9b154461aac 100644 (file)
@@ -19,10 +19,9 @@ define(
        var _keyupListener = null;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/UI/Dialog
         */
-       function UIDialog() {};
-       UIDialog.prototype = {
+       var UIDialog = {
                /**
                 * Sets up global container and internal variables.
                 */
@@ -406,5 +405,5 @@ define(
                }
        };
        
-       return new UIDialog();
+       return UIDialog;
 });
index 4049390b2ef33732c8e9a58b0ba3eea9ae0135fa..af27780e080c12bda2894439649442a179948fd1 100644 (file)
@@ -19,10 +19,9 @@ define(
        var _menuContainer = null;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/UI/Dropdown/Simple
         */
-       function SimpleDropdown() { };
-       SimpleDropdown.prototype = {
+       var SimpleDropdown = {
                /**
                 * Performs initial setup such as setting up dropdowns and binding listeners.
                 */
@@ -230,8 +229,8 @@ define(
                        var menu = _menus.get(containerId);
                        _menus.parentNode.removeChild(menu);
                        
-                       _menus.delete(containerId);
-                       _dropdowns.delete(containerId);
+                       _menus['delete'](containerId);
+                       _dropdowns['delete'](containerId);
                        
                        return true;
                },
@@ -350,5 +349,5 @@ define(
                }
        };
        
-       return new SimpleDropdown();
+       return SimpleDropdown;
 });
index 56673f1994aa3e854d844e1c0b56ca07d67a3c63..329925c08a1921b7aeb0115e4026e2eb1c06df6d 100644 (file)
@@ -18,10 +18,9 @@ define(
        var _sidebar = null;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/UI/Mobile
         */
-       function UIMobile() {};
-       UIMobile.prototype = {
+       var UIMobile = {
                /**
                 * Initializes the mobile UI using enquire.js.
                 */
@@ -175,5 +174,5 @@ define(
                }
        };
        
-       return new UIMobile();
+       return UIMobile;
 });
index d6110aaf4e6b39da69c63fb76f82bf7c55ce7cbb..aa27b324db3199858635093c0706185a4f4d2479 100644 (file)
@@ -12,10 +12,9 @@ define(['Dictionary', 'DOM/ChangeListener', 'DOM/Util', './TabMenu/Simple'], fun
        var _tabMenus = new Dictionary();
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/UI/TabMenu
         */
-       function UITabMenu() {};
-       UITabMenu.prototype = {
+       var UITabMenu = {
                /**
                 * Sets up tab menus and binds listeners.
                 */
@@ -58,5 +57,5 @@ define(['Dictionary', 'DOM/ChangeListener', 'DOM/Util', './TabMenu/Simple'], fun
                }
        };
        
-       return new UITabMenu();
+       return UITabMenu;
 });
index 591c5fd6985faffbf29912777a8de4744f7db21e..5ba1439be49422c98adb5dedbb7a622f820c797a 100644 (file)
@@ -15,10 +15,9 @@ define(['Environment', 'DOM/ChangeListener', 'UI/Alignment'], function(Environme
        var _tooltip = null;
        
        /**
-        * @constructor
+        * @exports     WoltLab/WCF/UI/Tooltip
         */
-       function UITooltip() {};
-       UITooltip.prototype = {
+       var UITooltip = {
                /**
                 * Initializes the tooltip element and binds event listener.
                 */
@@ -119,5 +118,5 @@ define(['Environment', 'DOM/ChangeListener', 'UI/Alignment'], function(Environme
                }
        };
        
-       return new UITooltip();
+       return UITooltip;
 });