[BUGFIX] Add missing DOMready checks and streamline code 99/43999/11
authorMarkus Klein <markus.klein@typo3.org>
Sun, 11 Oct 2015 23:30:52 +0000 (01:30 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Thu, 15 Oct 2015 07:53:56 +0000 (09:53 +0200)
Also remove useless closures and public exposure of modules, which are not
used via the TYPO3 global.
Moreover use single quotes for 'use strict' consistently.

Resolves: #70601
Releases: master
Change-Id: If7183f91a5b9fab320cea8eb1759e78b47141984
Reviewed-on: http://review.typo3.org/43999
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
55 files changed:
typo3/sysext/backend/Resources/Public/JavaScript/AjaxDataHandler.js
typo3/sysext/backend/Resources/Public/JavaScript/DebugConsole.js
typo3/sysext/backend/Resources/Public/JavaScript/DocumentHeader.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngineFlexForm.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngineValidation.js
typo3/sysext/backend/Resources/Public/JavaScript/ImageManipulation.js
typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js
typo3/sysext/backend/Resources/Public/JavaScript/LegacyCssClasses.js
typo3/sysext/backend/Resources/Public/JavaScript/LegacyTree.js
typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js
typo3/sysext/backend/Resources/Public/JavaScript/Login.js
typo3/sysext/backend/Resources/Public/JavaScript/LoginRefresh.js
typo3/sysext/backend/Resources/Public/JavaScript/Modal.js
typo3/sysext/backend/Resources/Public/JavaScript/Notification.js
typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js
typo3/sysext/backend/Resources/Public/JavaScript/PageActions.js
typo3/sysext/backend/Resources/Public/JavaScript/SplitButtons.js
typo3/sysext/backend/Resources/Public/JavaScript/ToggleSearchToolbox.js
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ClearCacheMenu.js
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/ShortcutMenu.js
typo3/sysext/backend/Resources/Public/JavaScript/Tooltip.js
typo3/sysext/backend/Resources/Public/JavaScript/UserPassLogin.js
typo3/sysext/backend/Resources/Public/JavaScript/Wizard/Colorpicker.js
typo3/sysext/beuser/Resources/Public/JavaScript/Permissions.js
typo3/sysext/documentation/Resources/Public/JavaScript/Main.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js
typo3/sysext/impexp/Resources/Public/JavaScript/ImportExport.js
typo3/sysext/install/Resources/Private/Templates/Action/Tool/LoadExtensions.html
typo3/sysext/install/Resources/Public/JavaScript/Install.js
typo3/sysext/lang/Resources/Public/JavaScript/LanguageModule.js
typo3/sysext/linkvalidator/Resources/Public/JavaScript/Linkvalidator.js
typo3/sysext/opendocs/Resources/Public/JavaScript/Toolbar/OpendocsMenu.js
typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseDatabase.js
typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFiles.js
typo3/sysext/recordlist/Resources/Public/JavaScript/BrowseFolders.js
typo3/sysext/recordlist/Resources/Public/JavaScript/ElementBrowser.js
typo3/sysext/recordlist/Resources/Public/JavaScript/FieldSelectBox.js
typo3/sysext/recordlist/Resources/Public/JavaScript/FileLinkHandler.js
typo3/sysext/recordlist/Resources/Public/JavaScript/LinkBrowser.js
typo3/sysext/recordlist/Resources/Public/JavaScript/MailLinkHandler.js
typo3/sysext/recordlist/Resources/Public/JavaScript/PageLinkHandler.js
typo3/sysext/recordlist/Resources/Public/JavaScript/Recordlist.js
typo3/sysext/recordlist/Resources/Public/JavaScript/Tooltip.js
typo3/sysext/recordlist/Resources/Public/JavaScript/UrlLinkHandler.js
typo3/sysext/recycler/Resources/Public/JavaScript/Recycler.js
typo3/sysext/rsaauth/Resources/Public/JavaScript/RsaEncryptionModule.js
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/RteLinkBrowser.js
typo3/sysext/scheduler/Resources/Public/JavaScript/Scheduler.js
typo3/sysext/t3editor/Resources/Public/JavaScript/FileEdit.js
typo3/sysext/t3editor/Resources/Public/JavaScript/T3editor.js
typo3/sysext/taskcenter/Resources/Public/JavaScript/Taskcenter.js
typo3/sysext/tstemplate/Resources/Public/JavaScript/ConstantEditor.js
typo3/sysext/viewpage/Resources/Public/JavaScript/Main.js
typo3/sysext/wizard_crpages/Resources/Public/JavaScript/WizardCreatePages.js
typo3/sysext/workspaces/Resources/Public/JavaScript/Toolbar/WorkspacesMenu.js

index ae4a861..367329f 100644 (file)
@@ -242,13 +242,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Notification'],
                $iconElement.removeClass('fa-spin fa-circle-o-notch');
        };
 
-       /**
-        * initialize and return the object
-        */
-       return function() {
-               AjaxDataHandler.initialize();
+       $(AjaxDataHandler.initialize);
 
-               // return the object in the global space
-               return AjaxDataHandler;
-       }();
+       return AjaxDataHandler;
 });
index 1f69726..859b60c 100644 (file)
@@ -15,6 +15,8 @@
  * The debug console shown at the bottom of the backend
  */
 define(['jquery'], function ($) {
+       'use strict';
+
        var DebugConsole = {
                $consoleDom: null,
                settings: {
@@ -255,11 +257,11 @@ define(['jquery'], function ($) {
                DebugConsole.$consoleDom = null;
        };
 
-       return function () {
-               $(document).ready(function() {
-                       DebugConsole.initialize();
-               });
-               TYPO3.DebugConsole = DebugConsole;
-               return DebugConsole;
-       }();
+       $(DebugConsole.initialize);
+
+       // expose as global object
+       TYPO3.DebugConsole = DebugConsole;
+
+       return DebugConsole;
+
 });
index c29b233..a1dd9cc 100644 (file)
@@ -15,7 +15,7 @@
  * Calculates the height of the docHeader and hides it upon scrolling
  */
 define(['jquery'], function($) {
-       "use strict";
+       'use strict';
 
        var DocumentHeader = {
                $documentHeader: null,
index 237b957..894d82e 100644 (file)
@@ -212,7 +212,7 @@ define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function ($) {
        };
 
        // Initialization Code
-       $(document).ready(function() {
+       $(function() {
                // run the flexform functions on all containers (which contains one or more sections)
                $('.t3-flex-container').t3FormEngineFlexFormElement();
        });
index a35a299..9dd42f9 100644 (file)
@@ -1022,7 +1022,7 @@ define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function ($, FormEngine) {
        };
 
        FormEngineValidation.registerReady = function() {
-               $(document).ready(function() {
+               $(function() {
                        FormEngineValidation.initialize();
                        // Start first validation after one second, because all fields are initial empty (typo3form.fieldSet)
                        window.setTimeout(function() {
@@ -1031,11 +1031,7 @@ define(['jquery', 'TYPO3/CMS/Backend/FormEngine'], function ($, FormEngine) {
                });
        };
 
-       /**
-        * Initialize function
-        */
-
-
        FormEngine.Validation = FormEngineValidation;
+
        return FormEngine.Validation;
 });
index e985f4c..543cbea 100644 (file)
@@ -314,8 +314,5 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) {
                });
        };
 
-       return function() {
-               TYPO3.ImageManipulation = ImageManipulation;
-               return ImageManipulation;
-       }();
+       return ImageManipulation;
 });
index dfb33d1..3799284 100644 (file)
@@ -16,6 +16,7 @@
  * based on jQuery UI
  */
 define(['jquery', 'jquery-ui/sortable'], function ($) {
+       'use strict';
 
        var DragDrop = {
                contentIdentifier: '.t3js-page-ce',
@@ -113,11 +114,12 @@ define(['jquery', 'jquery-ui/sortable'], function ($) {
         */
        DragDrop.onSortUpdate = function($container, ui) {
                var $selectedItem = $(ui.item),
-                       contentElementUid = parseInt($selectedItem.data('uid'));
+                       contentElementUid = parseInt($selectedItem.data('uid')),
+                       parameters = {};
 
                // send an AJAX requst via the AjaxDataHandler
                if (contentElementUid > 0) {
-                       var parameters = {};
+
                        // add the information about a possible column position change
                        parameters['data'] = {tt_content: {}};
                        parameters['data']['tt_content'][contentElementUid] = {colPos: parseInt($container.data('colpos'))};
@@ -145,11 +147,7 @@ define(['jquery', 'jquery-ui/sortable'], function ($) {
                });
        };
 
-       /**
-        * initialize function
-        */
-       return function() {
-               DragDrop.initialize();
-               return DragDrop;
-       }();
-});
\ No newline at end of file
+       $(DragDrop.initialize);
+
+       return DragDrop;
+});
index a217b37..7e0b171 100644 (file)
@@ -15,6 +15,8 @@
  * JavaScript replacement for Legacy CSS Classes
  */
 define(['jquery'], function($) {
+       'use strict';
+
        var LegacyCssClasses = {
                replacements: [
                        {
@@ -25,12 +27,12 @@ define(['jquery'], function($) {
                ]
        };
 
-       LegacyCssClasses.initialize = function() {
+       $(function() {
                $.each(LegacyCssClasses.replacements, function(key, replacement) {
-                       $items = $(replacement.selector);
+                       var $items = $(replacement.selector);
                        if ($items.length > 0) {
                                $items.each(function() {
-                                       $item = $(this);
+                                       var $item = $(this);
                                        if (replacement.remove.length > 0) {
                                                $.each(replacement.remove, function(oldClassId, oldClassName) {
                                                        $item.removeClass(oldClassName);
@@ -44,14 +46,7 @@ define(['jquery'], function($) {
                                });
                        }
                });
-       };
-
-       /**
-        * initialize function
-        */
-       return function() {
-               LegacyCssClasses.initialize();
-               return LegacyCssClasses;
-       }();
+       });
 
+       return LegacyCssClasses;
 });
index 9996c45..e2b005f 100644 (file)
@@ -195,7 +195,5 @@ define(['jquery'], function($) {
                }
        };
 
-       return function() {
-               return Tree;
-       }();
+       return Tree;
 });
index 3b72121..e9953bd 100644 (file)
  * Global search to deal with everything in the backend that is search-related
  */
 define(['jquery', 'jquery/autocomplete', 'TYPO3/CMS/Backend/jquery.clearable'], function ($) {
+       'use strict';
 
        var containerSelector = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem';
        var searchFieldSelector = '.t3js-topbar-navigation-search-field';
        var url = TYPO3.settings.ajaxUrls['livesearch'];
        var category = '';
 
-       var initialize = function() {
+       $(function() {
                $(searchFieldSelector).autocomplete({
                        // ajax options
                        serviceUrl: url,
@@ -93,16 +94,11 @@ define(['jquery', 'jquery/autocomplete', 'TYPO3/CMS/Backend/jquery.clearable'],
                        jump($(this).data('target'), 'web_list', 'web', $(this).data('pageid'));
                });
 
-               $(searchFieldSelector).clearable(
-                       {
+               $(searchFieldSelector).clearable({
                                onClear: function() {
                                        $(containerSelector).removeClass('open');
                                }
-                       }
-               );
-       };
-
-       $(document).ready(function() {
-               initialize();
+               });
        });
+
 });
index af22c24..b5275de 100755 (executable)
@@ -15,6 +15,8 @@
  * JavaScript module for the backend login form
  */
 define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable', 'bootstrap'], function($) {
+       'use strict';
+
        var BackendLogin = {
                options: {
                        loginForm: '#typo3-login-form',
@@ -44,8 +46,6 @@ define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable', 'bootstrap'], function($
         * @param event
         */
        BackendLogin.handleSubmit = function(event) {
-               "use strict";
-
                BackendLogin.showLoginProcess();
 
                if (BackendLogin.options.submitHandler) {
@@ -68,11 +68,11 @@ define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable', 'bootstrap'], function($
        BackendLogin.checkForInterfaceCookie = function() {
                if ($(options.interfaceField).length) {
                        var posStart = document.cookie.indexOf('typo3-login-interface=');
-                       if (posStart != -1) {
+                       if (posStart !== -1) {
                                var selectedInterface = document.cookie.substr(posStart + 22);
                                selectedInterface = selectedInterface.substr(0, selectedInterface.indexOf(';'));
+                               $(options.interfaceField).val(selectedInterface);
                        }
-                       $(options.interfaceField).val(selectedInterface);
                }
        };
 
@@ -140,15 +140,15 @@ define(['jquery', 'TYPO3/CMS/Backend/jquery.clearable', 'bootstrap'], function($
        };
 
        // initialize and return the BackendLogin object
-       $(document).ready(function() {
+       $(function() {
                BackendLogin.checkCookieSupport();
                BackendLogin.checkForInterfaceCookie();
                BackendLogin.initializeEvents();
        });
 
        // prevent opening the login form in the backend frameset
-       if (top.location.href != self.location.href) {
-               top.location.href = self.location.href;
+       if (top.location.href !=location.href) {
+               top.location.href = location.href;
        }
 
        return BackendLogin;
index d31c17c..9a7bcee 100644 (file)
@@ -426,20 +426,20 @@ define(['jquery', 'bootstrap'], function($) {
        };
 
        // initialize and return the LoginRefresh object
-       return function() {
-               $(document).ready(function() {
-                       LoginRefresh.initializeTimeoutModal();
-                       LoginRefresh.initializeBackendLockedModal();
-                       LoginRefresh.initializeLoginForm();
+       $(function() {
+               LoginRefresh.initializeTimeoutModal();
+               LoginRefresh.initializeBackendLockedModal();
+               LoginRefresh.initializeLoginForm();
 
-                       LoginRefresh.startTask();
+               LoginRefresh.startTask();
 
-                       if (typeof Notification !== 'undefined' && Notification.permission !== 'granted') {
-                               Notification.requestPermission();
-                       }
-               });
+               if (typeof Notification !== 'undefined' && Notification.permission !== 'granted') {
+                       Notification.requestPermission();
+               }
+       });
+
+       // expose to global
+       TYPO3.LoginRefresh = LoginRefresh;
 
-               TYPO3.LoginRefresh = LoginRefresh;
-               return LoginRefresh;
-       }();
+       return LoginRefresh;
 });
index dce9d83..5a5697f 100644 (file)
@@ -16,7 +16,7 @@
  * This module depends on TYPO3/CMS/Backend/Notification due to top.TYPO3.Severity.
  */
 define(['jquery', 'TYPO3/CMS/Backend/Notification', 'bootstrap'], function($) {
-       "use strict";
+       'use strict';
 
        // fetch from parent
        if (parent && parent.window.TYPO3 && parent.window.TYPO3.Modal) {
index 869cb71..8aa9ecc 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 define(['jquery'], function ($) {
+       'use strict';
 
        /**
         * Severity object
@@ -156,7 +157,7 @@ define(['jquery'], function ($) {
                if (Notification.messageContainer === null) {
                        Notification.messageContainer = $('<div id="alert-container"></div>').appendTo('body');
                }
-               $box = $(
+               var $box = $(
                        '<div class="alert alert-' + className + ' alert-dismissible fade" role="alert">' +
                                '<button type="button" class="close" data-dismiss="alert">' +
                                        '<span aria-hidden="true"><i class="fa fa-times-circle"></i></span>' +
@@ -204,22 +205,18 @@ define(['jquery'], function ($) {
                }
        };
 
-       /**
-        * return the Notification object
-        */
-       return function () {
-               if (typeof TYPO3.Severity === 'undefined') {
-                       TYPO3.Severity = Severity;
-               }
-               if (typeof top.TYPO3.Severity === 'undefined') {
-                       top.TYPO3.Severity = Severity;
-               }
-               if (typeof TYPO3.Notification === 'undefined') {
-                       TYPO3.Notification = Notification;
-               }
-               if (typeof top.TYPO3.Notification === 'undefined') {
-                       top.TYPO3.Notification = Notification;
-               }
-               return Notification;
-       }();
+       if (typeof TYPO3.Severity === 'undefined') {
+               TYPO3.Severity = Severity;
+       }
+       if (typeof top.TYPO3.Severity === 'undefined') {
+               top.TYPO3.Severity = Severity;
+       }
+       if (typeof TYPO3.Notification === 'undefined') {
+               TYPO3.Notification = Notification;
+       }
+       if (typeof top.TYPO3.Notification === 'undefined') {
+               top.TYPO3.Notification = Notification;
+       }
+
+       return Notification;
 });
index efaf72b..bbe594f 100644 (file)
@@ -15,7 +15,7 @@
  * Javascript for show the online media dialog
  */
 define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Lang/Lang'], function($, NProgress, Modal) {
-       "use strict";
+       'use strict';
 
        var OnlineMediaPlugin = function(element) {
                var me = this;
index a25f5fa..f138c31 100644 (file)
@@ -41,7 +41,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage'], function($, Storage) {
         */
        PageActions.initializePageTitleRenaming = function() {
                if (!PageActions.documentIsReady) {
-                       $(document).ready(function() {
+                       $(function() {
                                PageActions.initializePageTitleRenaming();
                        });
                        return;
index 0cf4f88..bafca14 100644 (file)
@@ -15,7 +15,7 @@
  * Initializes global handling of split buttons.
  */
 define(['jquery'], function($) {
-       "use strict";
+       'use strict';
 
        var SplitButtons = {
                preSubmitCallbacks: []
index 166d9ee..09bcd11 100644 (file)
@@ -15,7 +15,7 @@
  * Toggle the search toolbox
  */
 define(['jquery', 'TYPO3/CMS/Backend/DocumentHeader', 'TYPO3/CMS/Backend/jquery.clearable'], function($, DocumentHeader) {
-       "use strict";
+       'use strict';
 
        $(function() {
                var $toolbar = $('#db_list-searchbox-toolbar');
index 35e5715..cc9d47d 100644 (file)
@@ -16,6 +16,7 @@
  * reloading the clear cache icon
  */
 define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
+       'use strict';
 
        var ClearCacheMenu = {
                options: {
@@ -66,15 +67,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
                });
        };
 
-       /**
-        * initialize and return the ClearCacheMenu object
-        */
-       return function() {
-               $(document).ready(function() {
-                       ClearCacheMenu.initializeEvents();
-               });
+       $(ClearCacheMenu.initializeEvents);
 
-               TYPO3.ClearCacheMenu = ClearCacheMenu;
-               return ClearCacheMenu;
-       }();
+       return ClearCacheMenu;
 });
index a520535..4c4bffc 100644 (file)
@@ -16,6 +16,7 @@
  * and edit a shortcut
  */
 define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], function($, Modal, Icons) {
+       'use strict';
 
        var ShortcutMenu = {
                options: {
@@ -171,15 +172,10 @@ define(['jquery', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/Icons'], functio
                });
        };
 
-       /**
-        * initialize and return the ShortcutMenu object
-        */
-       return function() {
-               $(document).ready(function() {
-                       ShortcutMenu.initializeEvents();
-               });
+       $(ShortcutMenu.initializeEvents);
+
+       // expose as global object
+       TYPO3.ShortcutMenu = ShortcutMenu;
 
-               TYPO3.ShortcutMenu = ShortcutMenu;
-               return ShortcutMenu;
-       }();
+       return ShortcutMenu;
 });
index bc69ac0..58c7902 100644 (file)
@@ -15,6 +15,7 @@
  * API for tooltip windows powered by Twitter Bootstrap.
  */
 define(['jquery', 'bootstrap'], function($) {
+       'use strict';
 
        /**
         * The main tooltip object
@@ -52,7 +53,12 @@ define(['jquery', 'bootstrap'], function($) {
                $element.tooltip('hide');
        };
 
-       Tooltip.initialize('[data-toggle="tooltip"]');
+       $(function () {
+               Tooltip.initialize('[data-toggle="tooltip"]');
+       });
+
+       // expose as global object
        TYPO3.Tooltip = Tooltip;
+
        return Tooltip;
 });
index 773cb4f..28b19a3 100644 (file)
@@ -15,6 +15,8 @@
  * JavaScript module for the UsernamePasswordLoginProvider
  */
 define(['jquery', 'TYPO3/CMS/Backend/Login'], function($, Login) {
+       'use strict';
+
        var UserPassLogin = {
                options: {
                        usernameField: '.t3js-login-username-field',
@@ -51,8 +53,6 @@ define(['jquery', 'TYPO3/CMS/Backend/Login'], function($, Login) {
         * Reset user password field to prevent it from being submitted
         */
        UserPassLogin.resetPassword = function() {
-               "use strict";
-
                var $passwordField = $(UserPassLogin.options.passwordField);
                if ($passwordField.val()) {
                        $(Login.options.useridentField).val($passwordField.val());
@@ -68,7 +68,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Login'], function($, Login) {
        };
 
        // initialize and return the UserPassLogin object
-       $(document).ready(function() {
+       $(function() {
                // register submit handler
                Login.options.submitHandler = UserPassLogin.resetPassword;
 
@@ -86,7 +86,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Login'], function($, Login) {
                        }
                } catch (error) {} // continue
 
-               if ($usernameField.val() == '') {
+               if ($usernameField.val() === '') {
                        $usernameField.focus();
                } else {
                        $passwordField.focus();
index 5d4b1e5..b20377e 100644 (file)
@@ -15,6 +15,7 @@
  * Colorpicker JavaScript
  */
 define(['jquery'], function ($) {
+       'use strict';
 
        var Colorpicker = {
                options: {}
@@ -56,9 +57,7 @@ define(['jquery'], function ($) {
                });
        };
 
-       $(document).ready(function() {
-               Colorpicker.initializeEvents();
-       });
+       $(Colorpicker.initializeEvents);
 
        return Colorpicker;
 });
index 36c39b8..e52cec9 100644 (file)
@@ -42,7 +42,7 @@ define(['jquery'], function($) {
                var res = 0;
                for (var a = 1; a <= 5; a++) {
                        if (document.editform[checknames + '[' + a + ']'].checked) {
-                               res|=Math.pow(2,a-1);
+                               res |= Math.pow(2,a-1);
                        }
                }
                document.editform[varname].value = res | (checknames === 'tx_beuser_system_beusertxpermission[check][perms_user]' ? 1 : 0);
@@ -300,15 +300,10 @@ define(['jquery'], function($) {
                });
        };
 
-       /**
-        * initialize and return the Permissions object
-        */
-       return function() {
-               $(document).ready(function() {
-                       Permissions.initializeEvents();
-               });
+       $(Permissions.initializeEvents);
+
+       // expose to global
+       TYPO3.Permissions = Permissions;
 
-               TYPO3.Permissions = Permissions;
-               return Permissions;
-       }();
+       return Permissions;
 });
index 6d1763d..72b7d64 100644 (file)
  * JavaScript module for ext:documentation
  */
 define(['jquery', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'], function($) {
+       'use strict';
 
        var Documentation = {
                dataTable: null,
                searchField: null,
                identifier: {
                        documentationList: '.t3js-documentation-list',
-                       searchField: '.t3js-documentation-searchfield',
+                       searchField: '.t3js-documentation-searchfield'
                }
        };
 
@@ -63,7 +64,7 @@ define(['jquery', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'], function(
                return vars;
        };
 
-       $(document).ready(function() {
+       $(function() {
                // Initialize the view
                Documentation.initializeView();
 
@@ -73,6 +74,7 @@ define(['jquery', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'], function(
                                Documentation.dataTable.search('').draw();
                        }
                });
-
        });
+
+       return Documentation;
 });
index a4f652b..7778d4a 100644 (file)
@@ -648,66 +648,66 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'datatables', 'TYPO3/C
                });
        };
 
-       return function() {
-               $(document).ready(function() {
-                       var dataTable = ExtensionManager.manageExtensionListing();
-
-                       $(document).on('click', '.onClickMaskExtensionManager', function() {
-                               $(ExtensionManager.identifier.extensionManager).mask();
-                               NProgress.start();
-                       }).on('click', 'a[data-action=update-extension]', function(e) {
-                               e.preventDefault();
-                               $.ajax({
-                                       url: $(this).attr('href'),
-                                       dataType: 'json',
-                                       beforeSend: function() {
-                                               $(ExtensionManager.identifier.extensionManager).mask();
-                                               NProgress.start();
-                                       },
-                                       success: ExtensionManager.updateExtension
-                               });
-                       }).on('change', 'input[name=unlockDependencyIgnoreButton]', function() {
-                               var $actionButton = TYPO3.jQuery('.t3js-dependencies');
-                               $actionButton.toggleClass('disabled', !$(this).prop('checked'));
-                       });
-
-                       $(ExtensionManager.identifier.searchField).clearable({
-                               onClear: function() {
-                                       dataTable.search('').draw();
-                               }
-                       });
-
-                       $('.expandable').expander({
-                               expandEffect: 'slideDown',
-                               collapseEffect: 'slideUp',
-                               beforeExpand: function() {
-                                       $(this).parent().css('z-index', 199);
+       $(function() {
+               var dataTable = ExtensionManager.manageExtensionListing();
+
+               $(document).on('click', '.onClickMaskExtensionManager', function() {
+                       $(ExtensionManager.identifier.extensionManager).mask();
+                       NProgress.start();
+               }).on('click', 'a[data-action=update-extension]', function(e) {
+                       e.preventDefault();
+                       $.ajax({
+                               url: $(this).attr('href'),
+                               dataType: 'json',
+                               beforeSend: function() {
+                                       $(ExtensionManager.identifier.extensionManager).mask();
+                                       NProgress.start();
                                },
-                               afterCollapse: function() {
-                                       $(this).parent().css('z-index', 1);
-                               }
+                               success: ExtensionManager.updateExtension
                        });
+               }).on('change', 'input[name=unlockDependencyIgnoreButton]', function() {
+                       var $actionButton = TYPO3.jQuery('.t3js-dependencies');
+                       $actionButton.toggleClass('disabled', !$(this).prop('checked'));
+               });
 
-                       $(document).on('click', '.t3-button-action-installdistribution', function() {
-                               $(ExtensionManager.identifier.extensionManager).mask();
-                       });
+               $(ExtensionManager.identifier.searchField).clearable({
+                       onClear: function() {
+                               dataTable.search('').draw();
+                       }
+               });
 
-                       ExtensionManager.configurationFieldSupport();
-                       var $validate = $('.validate');
-                       $validate.validate();
-                       $(document).on('click', '.t3js-save-close', function() {
-                               $validate.append($('<input />', {type: 'hidden', name: 'tx_extensionmanager_tools_extensionmanagerextensionmanager[action]', value: 'saveAndClose'})).submit();
-                       });
+               $('.expandable').expander({
+                       expandEffect: 'slideDown',
+                       collapseEffect: 'slideUp',
+                       beforeExpand: function() {
+                               $(this).parent().css('z-index', 199);
+                       },
+                       afterCollapse: function() {
+                               $(this).parent().css('z-index', 1);
+                       }
+               });
 
-                       // initialize the repository
-                       Repository.initDom();
+               $(document).on('click', '.t3-button-action-installdistribution', function() {
+                       $(ExtensionManager.identifier.extensionManager).mask();
+               });
 
-                       ExtensionManager.Update.initializeEvents();
-                       ExtensionManager.UploadForm.initializeEvents();
+               ExtensionManager.configurationFieldSupport();
+               var $validate = $('.validate');
+               $validate.validate();
+               $(document).on('click', '.t3js-save-close', function() {
+                       $validate.append($('<input />', {type: 'hidden', name: 'tx_extensionmanager_tools_extensionmanagerextensionmanager[action]', value: 'saveAndClose'})).submit();
                });
 
-               if (typeof TYPO3.ExtensionManager === 'undefined') {
-                       TYPO3.ExtensionManager = ExtensionManager;
-               }
-       }();
+               // initialize the repository
+               Repository.initDom();
+
+               ExtensionManager.Update.initializeEvents();
+               ExtensionManager.UploadForm.initializeEvents();
+       });
+
+       if (typeof TYPO3.ExtensionManager === 'undefined') {
+               TYPO3.ExtensionManager = ExtensionManager;
+       }
+
+       return ExtensionManager;
 });
index c1cdd95..84a9ac9 100644 (file)
@@ -15,7 +15,7 @@
  * JavaScript to handle confirm windows in the Import/Export module
  */
 define(['jquery', 'TYPO3/CMS/Backend/Modal'], function ($, Modal) {
-       "use strict";
+       'use strict';
 
        $(function() {
                $(document).on('click', '.t3js-confirm-trigger', function() {
index 624a2bd..6e23e11 100644 (file)
@@ -18,7 +18,7 @@
        <hr />
        <f:render partial="Action/Tool/ImportantActions/ExtensionCompatibilityTester" arguments="{_all}"/>
        <script type="text/javascript">
-               $(document).ready(function() {
+               $(function() {
                        $('button', '#checkExtensions').hide();
                        $('.typo3-message', '#checkExtensions').hide();
                        $('.message-loading', '#checkExtensions').show();
index 35483ff..1deecf5 100644 (file)
@@ -43,8 +43,9 @@ TYPO3.Install.Scrolling = {
                return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
        },
        handleButtonScrolling: function() {
-               if ($('#fixed-footer-handler').length > 0) {
-                       if (!this.isScrolledIntoView($('#fixed-footer-handler'))) {
+               var $fixedFooterHandler = $('#fixed-footer-handler');
+               if ($fixedFooterHandler.length > 0) {
+                       if (!this.isScrolledIntoView($fixedFooterHandler)) {
                                $('#fixed-footer').addClass('fixed');
                        } else {
                                $('#fixed-footer').removeClass('fixed');
@@ -102,8 +103,10 @@ TYPO3.Install.ExtensionChecker = {
         */
        handleCheckExtensionsSuccess: function() {
                var self = this;
+               var $checkExtensions = $('#checkExtensions');
+
                $.ajax({
-                       url: $('#checkExtensions').data('protocolurl'),
+                       url: $checkExtensions.data('protocolurl'),
                        cache: false,
                        success: function(data) {
                                if (data) {
@@ -116,16 +119,19 @@ TYPO3.Install.ExtensionChecker = {
                                                var extension = extensions[i];
                                                var unloadButton = $('<button />', {
                                                        text: 'Uninstall '+ $.trim(extension),
-                                                       "class": $.trim(extension),
-                                                       click: function(e) {
-                                                               self.uninstallExtension($(this).attr('class'));
-                                                               e.preventDefault();
-                                                               return false;
-                                                       }
+                                                       'class': 't3-js-uninstallSingle',
+                                                       'data-extension': $.trim(extension)
                                                });
                                                var fullButton = unloadButtonWrapper.append(unloadButton);
                                                $('.message-error .message-body', '#checkExtensions').append(fullButton);
                                        }
+                                       if (extensions.length) {
+                                               $(document).on('click', 't3-js-uninstallSingle', function(e) {
+                                                       self.uninstallExtension($(this).data('extension'));
+                                                       e.preventDefault();
+                                                       return false;
+                                               });
+                                       }
                                        var unloadAllButton = $('<button />', {
                                                text: 'Uninstall all incompatible extensions: '+ data,
                                                click: function(e) {
@@ -153,11 +159,11 @@ TYPO3.Install.ExtensionChecker = {
                        }
                });
                $.getJSON(
-                       $('#checkExtensions').data('errorprotocolurl'),
+                       $checkExtensions.data('errorprotocolurl'),
                        function(data) {
                                $.each(data, function(i, error) {
                                        var messageToDisplay = error.message + ' in ' + error.file + ' on line ' + error.line;
-                                       $('#checkExtensions .typo3-message.message-error').before($(
+                                       $checkExtensions.find('.typo3-message.message-error').before($(
                                                '<div class="typo3-message message-warning"><div class="header-container"><div class="message-header">' +
                                                '<strong>' + error.type + '</strong></div><div class="message-body">' +
                                                messageToDisplay + '</div></div></div><p></p>'
@@ -213,7 +219,7 @@ TYPO3.Install.Status = {
                        cache: false,
                        success: function(data) {
                                if (data > 0) {
-                                       $('#t3-install-menu-folderStructure a').append('<span class="t3-install-menu-errorCount">' + data + '</span>');
+                                       $('#t3-install-menu-folderStructure').find('a').append('<span class="t3-install-menu-errorCount">' + data + '</span>');
                                }
                        }
                });
@@ -225,7 +231,7 @@ TYPO3.Install.Status = {
                        cache: false,
                        success: function(data) {
                                if (data > 0) {
-                                       $('#t3-install-menu-systemEnvironment a').append('<span class="t3-install-menu-errorCount">' + data + '</span>');
+                                       $('#t3-install-menu-systemEnvironment').find('a').append('<span class="t3-install-menu-errorCount">' + data + '</span>');
                                }
                        }
                });
@@ -346,22 +352,22 @@ TYPO3.Install.coreUpdate = {
         */
        callAction: function(actionName, type) {
                var self = this;
-               var arguments = {
+               var data = {
                        install: {
                                controller: 'ajax',
                                action: actionName
                        }
                };
                if (type !== undefined) {
-                       arguments.install["type"] = type;
+                       data.install["type"] = type;
                }
                this.addLoadingMessage(this.actionQueue[actionName].loadingMessage);
                $.ajax({
                        url: location.href,
-                       data: arguments,
+                       data: data,
                        cache: false,
                        success: function(result) {
-                               canContinue = self.handleResult(result, self.actionQueue[actionName].finishMessage);
+                               var canContinue = self.handleResult(result, self.actionQueue[actionName].finishMessage);
                                if (canContinue === true && (self.actionQueue[actionName].nextActionName !== undefined)) {
                                        self.callAction(self.actionQueue[actionName].nextActionName, type);
                                }
@@ -427,7 +433,7 @@ TYPO3.Install.coreUpdate = {
         * Remove an enabled loading message
         */
        removeLoadingMessage: function() {
-               $('#coreUpdate .message-loading').closest('.typo3-message').remove();
+               $('#coreUpdate').find('.message-loading').closest('.typo3-message').remove();
        },
 
        /**
@@ -500,7 +506,7 @@ TYPO3.Install.coreUpdate = {
        }
 };
 
-$(document).ready(function() {
+$(function() {
        // Used in database compare section to select/deselect checkboxes
        $('.checkall').on('click', function() {
                $(this).closest('fieldset').find(':checkbox').prop('checked', this.checked);
@@ -508,15 +514,15 @@ $(document).ready(function() {
 
        // Toggle open/close
        $('.toggleButton').on('click', function() {
-               $toggleGroup = $(this).closest('.toggleGroup');
+               var $toggleGroup = $(this).closest('.toggleGroup');
                $toggleGroup.toggleClass('expanded');
                $toggleGroup.find('.toggleData').toggle();
                TYPO3.Install.Scrolling.handleButtonScrolling();
        });
 
        $('.toggleAll').on('click', function() {
-               $toggleAll = $('.toggleGroup');
-               if ($toggleAll.not('.expanded').length == 0) {
+               var $toggleAll = $('.toggleGroup');
+               if ($toggleAll.not('.expanded').length === 0) {
                        // all elements are open, close them
                        $toggleAll.removeClass('expanded');
                        $toggleAll.find('.toggleData').hide();
@@ -528,11 +534,11 @@ $(document).ready(function() {
        });
 
        $('.item-description').find('a').on('click', function() {
-               targetToggleGroupId = $(this.hash);
+               var targetToggleGroupId = $(this.hash);
                if (targetToggleGroupId) {
-                       $currentToggleGroup = $(this).closest('.toggleGroup');
-                       $targetToggleGroup = $(targetToggleGroupId).closest('.toggleGroup');
-                       if ($targetToggleGroup != $currentToggleGroup) {
+                       var $currentToggleGroup = $(this).closest('.toggleGroup');
+                       var $targetToggleGroup = $(targetToggleGroupId).closest('.toggleGroup');
+                       if ($targetToggleGroup !== $currentToggleGroup) {
                                $currentToggleGroup.removeClass('expanded');
                                $currentToggleGroup.find('.toggleData').hide();
                                $targetToggleGroup.addClass('expanded');
@@ -549,9 +555,9 @@ $(document).ready(function() {
                var mediumRegex = new RegExp('^(?=.{8,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$', 'g');
                var enoughRegex = new RegExp('(?=.{8,}).*', 'g');
 
-               if (value.length == 0) {
+               if (value.length === 0) {
                        $(this).attr('style', 'background-color:#FBB19B; border:1px solid #DC4C42');
-               } else if (false == enoughRegex.test(value)) {
+               } else if (!enoughRegex.test(value)) {
                        $(this).attr('style', 'background-color:#FBB19B; border:1px solid #DC4C42');
                } else if (strongRegex.test(value)) {
                        $(this).attr('style', 'background-color:#CDEACA; border:1px solid #58B548');
index 746154e..d6fb97a 100644 (file)
@@ -15,6 +15,8 @@
  * Language module class
  */
 define(['jquery', 'moment', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'], function($, moment) {
+       'use strict';
+
        var LanguageModule = {
                me: this,
                context: null,
@@ -64,7 +66,7 @@ define(['jquery', 'moment', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'],
                LanguageModule.table = LanguageModule.buildLanguageTable(tableElement);
                LanguageModule.initializeSearchField();
                LanguageModule.initializeEventHandler();
-       }
+       };
 
        /**
         * Initialize translation table
@@ -492,7 +494,9 @@ define(['jquery', 'moment', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'],
                $link.addClass(action + 'Link');
                $link.attr('data-action', action);
                for (var name in parameters) {
-                       $link.attr('data-' + name, parameters[name]);
+                       if (parameters.hasOwnProperty(name)) {
+                               $link.attr('data-' + name, parameters[name]);
+                       }
                }
                $link.html(content);
                return $link.wrap('<span>').parent().html();
@@ -574,16 +578,13 @@ define(['jquery', 'moment', 'datatables', 'TYPO3/CMS/Backend/jquery.clearable'],
                return vars;
        };
 
-       return function() {
-               $(document).ready(function() {
-                       if ($('div.typo3-module-lang #typo3-language-list').length) {
-                               LanguageModule.initializeLanguageTable('div.typo3-module-lang', '#typo3-language-list');
-                       } else if ($('div.typo3-module-lang #typo3-translation-list').length) {
-                               LanguageModule.initializeTranslationTable('div.typo3-module-lang', '#typo3-translation-list');
-                       }
-               });
+       $(function() {
+               if ($('#typo3-language-list').length) {
+                       LanguageModule.initializeLanguageTable('div.typo3-module-lang', '#typo3-language-list');
+               } else if ($('#typo3-translation-list').length) {
+                       LanguageModule.initializeTranslationTable('div.typo3-module-lang', '#typo3-translation-list');
+               }
+       });
 
-               TYPO3.LanguageModule = LanguageModule;
-               return LanguageModule;
-       }();
+       return LanguageModule;
 });
index 83d7bfe..7c2921d 100644 (file)
  */
 
 define(['jquery'], function($) {
+       'use strict';
 
        var Linkvalidator = {};
 
        Linkvalidator.toggleActionButton = function(prefix) {
                var buttonDisable = true;
-               $('.' + prefix).each(function(index) {
+               $('.' + prefix).each(function() {
                        if ($(this).prop('checked')) {
                                buttonDisable = false;
                        }
                });
 
-               if (prefix == 'check') {
+               if (prefix === 'check') {
                        $('#updateLinkList').prop('disabled', buttonDisable);
                } else {
                        $('#refreshLinkList').prop('disabled', buttonDisable);
@@ -43,13 +44,7 @@ define(['jquery'], function($) {
                });
        };
 
-       // intialize and return the Linkvalidator object
-       return function() {
-               $(document).ready(function() {
-                       Linkvalidator.initializeEvents();
-               });
+       $(Linkvalidator.initializeEvents);
 
-               TYPO3.Linkvalidator = Linkvalidator;
-               return Linkvalidator;
-       }();
+       return Linkvalidator;
 });
index 442400f..dc033a4 100644 (file)
@@ -17,6 +17,7 @@
  *  - updating the menu
  */
 define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
+       'use strict';
 
        var OpendocsMenu = {
                options: {
@@ -80,7 +81,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
        /**
         * Closes an open document
         *
-        * @param string md5sum
+        * @param {string} md5sum
         */
        OpendocsMenu.closeDocument = function(md5sum) {
                $.ajax({
@@ -106,16 +107,13 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons'], function($, Icons) {
                $(OpendocsMenu.options.containerSelector).toggleClass('open');
        };
 
-       /**
-        * initialize and return the Opendocs object
-        */
-       return function() {
-               $(document).ready(function() {
-                       OpendocsMenu.initializeEvents();
-                       OpendocsMenu.updateMenu();
-               });
+       $(function() {
+               OpendocsMenu.initializeEvents();
+               OpendocsMenu.updateMenu();
+       });
+
+       // expose to global
+       TYPO3.OpendocsMenu = OpendocsMenu;
 
-               TYPO3.OpendocsMenu = OpendocsMenu;
-               return OpendocsMenu;
-       }();
+       return OpendocsMenu;
 });
index 3fa97fd..ef91b00 100644 (file)
@@ -15,7 +15,7 @@
  * Database record selection
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/ElementBrowser'], function($, ElementBrowser) {
-       "use strict";
+       'use strict';
 
        $(function() {
                $('[data-close]').on('click', function(event) {
index 0cb559b..c199bc4 100644 (file)
@@ -15,7 +15,7 @@
  * File selection
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/ElementBrowser'], function($, ElementBrowser) {
-       "use strict";
+       'use strict';
 
        var BrowseFiles = {
                elements: {}
index 6e805ca..37fe140 100644 (file)
@@ -15,7 +15,7 @@
  * Folder selection
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/ElementBrowser', 'TYPO3/CMS/Backend/Modal'], function ($, ElementBrowser, Modal) {
-       "use strict";
+       'use strict';
 
        $(function() {
                $('[data-folder-id]').on('click', function (event) {
index 3c23aee..fb11a5b 100644 (file)
@@ -15,7 +15,7 @@
  * ElementBrowser communication with parent windows
  */
 define(['jquery'], function($) {
-       "use strict";
+       'use strict';
 
        var ElementBrowser = {
                thisScriptUrl: '',
index 15b6072..72af6de 100644 (file)
@@ -15,7 +15,7 @@
  * Check-all / uncheck-all for the Database Recordlist fieldSelectBox
  */
 define(['jquery'], function($) {
-       "use strict";
+       'use strict';
 
        $(function() {
                $('.fieldSelectBox .checkAll').change(function() {
index 59018e5..9a6158b 100644 (file)
@@ -15,7 +15,7 @@
  * File link interaction
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser', 'TYPO3/CMS/Backend/LegacyTree'], function($, LinkBrowser, Tree) {
-       "use strict";
+       'use strict';
 
        var FileLinkHandler = {
                currentLink: ''
index 8c0e7bd..0bc7df1 100644 (file)
@@ -15,7 +15,7 @@
  * LinkBrowser communication with parent window
  */
 define(['jquery'], function($) {
-       "use strict";
+       'use strict';
 
        var LinkBrowser = {
                thisScriptUrl: '',
index d32f204..dd2895d 100644 (file)
@@ -15,7 +15,7 @@
  * Mail link interaction
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser) {
-       "use strict";
+       'use strict';
 
        var MailLinkHandler = {};
 
index 0239062..4ba0b0b 100644 (file)
@@ -15,7 +15,7 @@
  * Page link interaction
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser) {
-       "use strict";
+       'use strict';
 
        var PageLinkHandler = {
                currentLink: ''
index 5193c11..4aea58e 100644 (file)
@@ -15,7 +15,7 @@
  * Usability improvements for the record list
  */
 define(['jquery', 'TYPO3/CMS/Backend/Storage'], function($, Storage) {
-       "use strict";
+       'use strict';
 
        var Recordlist = {
                identifier: {
index b5c8378..7a95256 100644 (file)
  * API for tooltip windows powered by Twitter Bootstrap.
  */
 define(['TYPO3/CMS/Backend/Tooltip'], function(Tooltip) {
-       "use strict";
+       'use strict';
 
-       Tooltip.initialize('.table-fit a[title]', {
-               delay: {
-                       show: 500,
-                       hide: 100
-               },
-               trigger: 'hover',
-               container: 'body'
+       $(function() {
+               Tooltip.initialize('.table-fit a[title]', {
+                       delay: {
+                               show: 500,
+                               hide: 100
+                       },
+                       trigger: 'hover',
+                       container: 'body'
+               });
        });
 
 });
index bbfb7cd..7fa579c 100644 (file)
@@ -15,7 +15,7 @@
  * URL link interaction
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser) {
-       "use strict";
+       'use strict';
 
        var UrlLinkHandler = {};
 
index af92543..b822c76 100644 (file)
@@ -15,6 +15,8 @@
  * RequireJS module for Recycler
  */
 define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jquery.clearable'], function($, NProgress, Modal) {
+       'use strict';
+
        var Recycler = {
                identifiers: {
                        searchForm: '#recycler-form',
@@ -388,7 +390,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jqu
                        messageText = Recycler.createMessage(messageText, [recordTitle, '[' + records + ']']);
                }
 
-               var $message;
+               var $message = null;
                if (recoverPages) {
                        $message = $('<div />').append(
                                $('<p />').text(messageText),
@@ -559,9 +561,7 @@ define(['jquery', 'nprogress', 'TYPO3/CMS/Backend/Modal', 'TYPO3/CMS/Backend/jqu
                $(this).addClass('disabled').find('.t3-icon').unwrap().wrap($('<span />'));
        };
 
-       $(document).ready(function() {
-               Recycler.initialize();
-       });
+       $(Recycler.initialize);
 
        return Recycler;
 });
index 45f10c3..f61d2d8 100644 (file)
@@ -127,7 +127,7 @@ define(['jquery', './RsaLibrary'], function($) {
                }
        };
 
-       $(document).ready(RsaEncryption.initialize);
+       $(RsaEncryption.initialize);
 
        return RsaEncryption;
 });
index 81e1247..6fe6067 100644 (file)
@@ -15,7 +15,7 @@
  * LinkBrowser communication with parent window
  */
 define(['jquery', 'TYPO3/CMS/Recordlist/LinkBrowser'], function($, LinkBrowser) {
-       "use strict";
+       'use strict';
 
        var RteLinkBrowser = {
                plugin: null,
index 93df302..76c7eb7 100644 (file)
@@ -49,20 +49,21 @@ define(['jquery'], function($) {
         */
        Scheduler.actOnChangeSchedulerTableGarbageCollectionAllTables = function(theCheckbox) {
                var $numberOfDays = $('#task_tableGarbageCollection_numberOfDays');
+               var $taskTableGarbageCollectionTable = $('#task_tableGarbageCollection_table');
                if (theCheckbox.prop('checked')) {
-                       $('#task_tableGarbageCollection_table').prop('disabled', true);
+                       $taskTableGarbageCollectionTable.prop('disabled', true);
                        $numberOfDays.prop('disabled', true);
                } else {
                        // Get number of days for selected table
                        var numberOfDays = parseInt($numberOfDays.val());
                        if (numberOfDays < 1) {
-                               var selectedTable = $('#task_tableGarbageCollection_table').val();
-                               if (typeof(defaultNumberOfDays[selectedTable]) != 'undefined') {
+                               var selectedTable = $taskTableGarbageCollectionTable.val();
+                               if (typeof(defaultNumberOfDays[selectedTable]) !== 'undefined') {
                                        numberOfDays = defaultNumberOfDays[selectedTable];
                                }
                        }
 
-                       $('#task_tableGarbageCollection_table').prop('disabled', false);
+                       $taskTableGarbageCollectionTable.prop('disabled', false);
                        if (numberOfDays > 0) {
                                $numberOfDays.prop('disabled', false);
                        }
@@ -118,13 +119,7 @@ define(['jquery'], function($) {
                });
        };
 
-       // initialize and return the Scheduler object
-       return function() {
-               $(document).ready(function() {
-                       Scheduler.initializeEvents();
-               });
+       $(Scheduler.initializeEvents);
 
-               TYPO3.Scheduler = Scheduler;
-               return Scheduler;
-       }();
+       return Scheduler;
 });
index 339a82c..d82a2e7 100644 (file)
@@ -15,8 +15,9 @@
  * File edit for ext:t3editor
  */
 define(['jquery', 'TYPO3/CMS/T3editor/T3editor'], function ($, T3editor) {
+       'use strict';
 
-       $(document).ready(function() {
+       $(function() {
 
                // Remove document.editform.submit from save and close onclick
                // Form will be submitted by the new on click handler
index cd85979..6870ba6 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 define(['jquery', 'TYPO3/CMS/Backend/SplitButtons'], function ($, SplitButtons) {
+       'use strict';
 
        var T3editor = {
                instances: {}
@@ -149,8 +150,7 @@ define(['jquery', 'TYPO3/CMS/Backend/SplitButtons'], function ($, SplitButtons)
         * Resize the editor
         */
        T3editor.resize = function(codemirror, w, h) {
-               var height = (h - 1),
-                       width = (w + 11),
+               var width = (w + 11),
                        $outerDiv = codemirror.options.originalTextarea.prev('.t3e_wrap'),
                        $mirrorWrap = codemirror.options.originalTextarea.parents('div.t3editor').find('.t3e_iframe_wrap');
 
@@ -181,7 +181,7 @@ define(['jquery', 'TYPO3/CMS/Backend/SplitButtons'], function ($, SplitButtons)
                }
 
                T3editor.resize(codemirror, w, h);
-       }
+       };
 
        /**
         * Convert all textareas to enable tab
@@ -220,11 +220,10 @@ define(['jquery', 'TYPO3/CMS/Backend/SplitButtons'], function ($, SplitButtons)
        /**
         * Initialize and return the T3editor object
         */
-       $(document).ready(function() {
+       $(function() {
                T3editor.findAndInitializeEditors();
                T3editor.convertTextareasEnableTab();
        });
 
-       TYPO3.T3editor = T3editor;
        return T3editor;
 });
index 6665e69..9e41970 100644 (file)
@@ -12,6 +12,7 @@
  */
 
 define(['jquery', 'jquery-ui/sortable'], function($) {
+       'use strict';
 
        var Taskcenter = {};
 
@@ -85,12 +86,7 @@ define(['jquery', 'jquery-ui/sortable'], function($) {
                Taskcenter.initializeSorting();
        };
 
-       return function() {
-               $(document).ready(function() {
-                       Taskcenter.initializeEvents();
-               });
+       $(Taskcenter.initializeEvents);
 
-               TYPO3.Taskcenter = Taskcenter;
-               return Taskcenter;
-       }();
+       return Taskcenter;
 });
index 8542373..488ffb9 100644 (file)
@@ -16,6 +16,7 @@
  * e.g. updating the field and working with colors
  */
 define(['jquery'], function($) {
+       'use strict';
 
        var ConstantEditor = {
                options: {
@@ -75,6 +76,7 @@ define(['jquery'], function($) {
         * Registers listeners
         */
        ConstantEditor.initializeEvents = function() {
+               // no DOMready needed since only events for document are registered
                $(document).on('click', ConstantEditor.options.editIconSelector, function() {
                        ConstantEditor.changeProperty($(this));
                }).on('click', ConstantEditor.options.colorSelectSelector, function() {
@@ -84,13 +86,7 @@ define(['jquery'], function($) {
                });
        };
 
-       /**
-        * initialize and return the ConstantEditor object
-        */
-       return function() {
-               $(document).ready(function() {
-                       ConstantEditor.initializeEvents();
-               });
-               return ConstantEditor;
-       }();
+       ConstantEditor.initializeEvents();
+
+       return ConstantEditor;
 });
index 558ac2f..18dc24d 100644 (file)
@@ -20,80 +20,83 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage', 'jquery-ui/resizable'], function(
                resizableContainerIdentifier: '#resizeable',
                widthSelectorIdentifier: '#width',
                moduleBodySelector: '.t3js-module-body',
-               storagePrefix: 'moduleData.web_view.States.'
+               storagePrefix: 'moduleData.web_view.States.',
+               $iframe: null,
+               $languageSelector: null,
+               $resizableContainer: null,
+               $widthSelector: null
        };
 
        ViewPage.initialize = function() {
-               var me = this;
-               me.$iframe = $('#tx_viewpage_iframe');
-               me.$languageSelector = $('#language');
-               me.$resizableContainer = $(me.resizableContainerIdentifier);
-               me.$widthSelector = $(me.widthSelectorIdentifier);
+               ViewPage.$iframe = $('#tx_viewpage_iframe');
+               ViewPage.$languageSelector = $('#language');
+               ViewPage.$resizableContainer = $(ViewPage.resizableContainerIdentifier);
+               ViewPage.$widthSelector = $(ViewPage.widthSelectorIdentifier);
 
                // Add event to width selector so the container is resized
-               $(document).on('change', me.widthSelectorIdentifier, function() {
-                       var value = me.$widthSelector.val();
+               $(document).on('change', ViewPage.widthSelectorIdentifier, function() {
+                       var value = ViewPage.$widthSelector.val();
                        if (value) {
                                value = value.split('|');
                                var height = value[1] || '100%';
                                if (height === '100%') {
                                        height = ViewPage.calculateContainerMaxHeight();
                                }
-                               me.$resizableContainer.animate({
+                               ViewPage.$resizableContainer.animate({
                                        width:  value[0],
                                        height: height
                                });
-                               Storage.Persistent.set(me.storagePrefix + 'widthSelectorValue', value[0] + '|' + (value[1] || '100%'));
+                               Storage.Persistent.set(ViewPage.storagePrefix + 'widthSelectorValue', value[0] + '|' + (value[1] || '100%'));
                        }
                });
 
                // Restore custom selector
-               var storedCustomWidth = Storage.Persistent.get(me.storagePrefix + 'widthSelectorCustomValue');
+               var storedCustomWidth = Storage.Persistent.get(ViewPage.storagePrefix + 'widthSelectorCustomValue');
                // Check for the " symbol is done in order to avoid problems with the old (non-jQuery) syntax which might be stored inside
                // the UC from previous versions, can be removed with TYPO3 CMS9 again
                if (storedCustomWidth && storedCustomWidth.indexOf('"') === -1) {
                        // add custom selector if stored value is not there
-                       if (me.$widthSelector.find('option[value="' + storedCustomWidth + '"]').length === 0) {
-                               me.addCustomWidthOption(storedCustomWidth);
+                       if (ViewPage.$widthSelector.find('option[value="' + storedCustomWidth + '"]').length === 0) {
+                               ViewPage.addCustomWidthOption(storedCustomWidth);
                        }
                }
 
                // Re-select stored value
-               var storedWidth = Storage.Persistent.get(me.storagePrefix + 'widthSelectorValue');
+               var storedWidth = Storage.Persistent.get(ViewPage.storagePrefix + 'widthSelectorValue');
                // Check for the " symbol is done in order to avoid problems with the old (non-jQuery) syntax which might be stored inside
                // the UC from previous versions, can be removed with TYPO3 CMS9 again
                if (storedWidth && storedWidth.indexOf('"') === -1) {
-                       me.$widthSelector.val(storedWidth).trigger('change');
+                       ViewPage.$widthSelector.val(storedWidth).trigger('change');
                }
 
                // Initialize the jQuery UI Resizable plugin
-               me.$resizableContainer.resizable({
+               ViewPage.$resizableContainer.resizable({
                        handles: 'e, se, s'
                });
 
                // Create and select custom option
-               me.$resizableContainer.on('resizestart', function() {
+               ViewPage.$resizableContainer.on('resizestart', function() {
                        // Check custom option is there, if not, add it
-                       if (me.$widthSelector.find('#customOption').length === 0) {
-                               me.addCustomWidthOption('100%|100%');
+                       if (ViewPage.$widthSelector.find('#customOption').length === 0) {
+                               ViewPage.addCustomWidthOption('100%|100%');
                        }
                        // Select the custom option
-                       me.$widthSelector.find('#customOption').prop('selected', true);
+                       ViewPage.$widthSelector.find('#customOption').prop('selected', true);
 
                        // Add iframe overlay to prevent loosing the mouse focus to the iframe while resizing fast
                        $(this).append('<div id="iframeCover" style="z-index:99;position:absolute;width:100%;top:0;left:0;height:100%;"></div>');
                });
 
-               me.$resizableContainer.on('resize', function(evt, ui) {
+               ViewPage.$resizableContainer.on('resize', function(evt, ui) {
                        // Update custom option
                        var value = ui.size.width + '|' + ui.size.height;
-                       var label = me.getOptionLabel(value);
-                       me.$widthSelector.find('#customOption').text(label).val(value);
+                       var label = ViewPage.getOptionLabel(value);
+                       ViewPage.$widthSelector.find('#customOption').text(label).val(value);
                });
 
-               me.$resizableContainer.on('resizestop', function() {
-                       Storage.Persistent.set(me.storagePrefix + 'widthSelectorCustomValue', me.$widthSelector.val()).done(function() {
-                               Storage.Persistent.set(me.storagePrefix + 'widthSelectorValue', me.$widthSelector.val());
+               ViewPage.$resizableContainer.on('resizestop', function() {
+                       Storage.Persistent.set(ViewPage.storagePrefix + 'widthSelectorCustomValue', ViewPage.$widthSelector.val()).done(function() {
+                               Storage.Persistent.set(ViewPage.storagePrefix + 'widthSelectorValue', ViewPage.$widthSelector.val());
                        });
 
                        // Remove iframe overlay
@@ -101,22 +104,22 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage', 'jquery-ui/resizable'], function(
                });
 
                // select stored language
-               var storedLanguage = Storage.Persistent.get(me.storagePrefix + 'languageSelectorValue');
+               var storedLanguage = Storage.Persistent.get(ViewPage.storagePrefix + 'languageSelectorValue');
                if (storedLanguage) {
                        // select it
-                       me.$languageSelector.val(storedLanguage);
+                       ViewPage.$languageSelector.val(storedLanguage);
                }
 
                // Add event to language selector
-               me.$languageSelector.on('change',function() {
-                       var iframeUrl = me.$iframe.attr('src');
+               ViewPage.$languageSelector.on('change',function() {
+                       var iframeUrl = ViewPage.$ifraViewPage.attr('src');
                        var iframeParameters = ViewPage.getUrlVars(iframeUrl);
                        // change language
-                       iframeParameters.L = me.$languageSelector.val();
+                       iframeParameters.L = ViewPage.$languageSelector.val();
                        var newIframeUrl = iframeUrl.slice(0, iframeUrl.indexOf('?') + 1) + $.param(iframeParameters);
                        // load new url into iframe
-                       me.$iframe.attr('src', newIframeUrl);
-                       Storage.Persistent.set(me.storagePrefix + 'languageSelectorValue', me.$languageSelector.val());
+                       ViewPage.$ifraViewPage.attr('src', newIframeUrl);
+                       Storage.Persistent.set(ViewPage.storagePrefix + 'languageSelectorValue', ViewPage.$languageSelector.val());
                });
        };
 
@@ -150,9 +153,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Storage', 'jquery-ui/resizable'], function(
                return vars;
        };
 
-       $(document).ready(function() {
-               ViewPage.initialize();
-       });
+       $(ViewPage.initialize);
 
        return ViewPage;
 });
index eb0c7c2..df23291 100644 (file)
@@ -15,6 +15,7 @@
  * JavaScript functions for creating multiple pages
  */
 define(['jquery'], function($) {
+       'use strict';
 
        var WizardCreatePages = {
                lineCounter: 5,
@@ -24,7 +25,7 @@ define(['jquery'], function($) {
        };
 
        WizardCreatePages.createNewFormFields = function() {
-               for (i = 0; i < 5; i++) {
+               for (var i = 0; i < 5; i++) {
                        var label = this.lineCounter + i + 1;
                        var line = tpl
                                .replace(/\{0\}/g, (this.lineCounter + i))
@@ -54,12 +55,7 @@ define(['jquery'], function($) {
                });
        };
 
-       return function() {
-               $(document).ready(function() {
-                       WizardCreatePages.initializeEvents();
-               });
+       $(WizardCreatePages.initializeEvents);
 
-               TYPO3.WizardCreatePages = WizardCreatePages;
-               return WizardCreatePages;
-       }();
+       return WizardCreatePages;
 });
index 0cbdb3e..0b34c72 100644 (file)
@@ -16,6 +16,7 @@
  * and jump to the workspaces module
  */
 define(['jquery'], function($) {
+       'use strict';
 
        var WorkspacesMenu = {
                options: {
@@ -149,16 +150,13 @@ define(['jquery'], function($) {
                }
        };
 
-       /**
-        * initialize and return the WorkspacesMenu object
-        */
-       return function() {
-               $(document).ready(function() {
-                       WorkspacesMenu.initializeEvents();
-                       WorkspacesMenu.updateBackendContext();
-               });
+       $(function() {
+               WorkspacesMenu.initializeEvents();
+               WorkspacesMenu.updateBackendContext();
+       });
+
+       // expose the module in a global object
+       TYPO3.WorkspacesMenu = WorkspacesMenu;
 
-               TYPO3.WorkspacesMenu = WorkspacesMenu;
-               return WorkspacesMenu;
-       }();
+       return WorkspacesMenu;
 });