From ec86f434252c605a9b8259f2d6e0e555e58024b1 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 18 Aug 2015 17:48:52 +0200 Subject: [PATCH] Added replacements for WCF.Like, WCF.User.List and $.ui.wcfPages --- wcfsetup/install/files/js/WCF.Like.js | 2 + wcfsetup/install/files/js/WCF.js | 445 ++---------------- .../install/files/js/WoltLab/WCF/Ui/Dialog.js | 4 + .../files/js/WoltLab/WCF/Ui/Like/Handler.js | 89 +++- .../files/js/WoltLab/WCF/Ui/Page/JumpTo.js | 141 ++++++ .../files/js/WoltLab/WCF/Ui/Pagination.js | 238 ++++++++++ .../files/js/WoltLab/WCF/Ui/User/List.js | 111 +++++ 7 files changed, 612 insertions(+), 418 deletions(-) create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpTo.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Ui/Pagination.js create mode 100644 wcfsetup/install/files/js/WoltLab/WCF/Ui/User/List.js diff --git a/wcfsetup/install/files/js/WCF.Like.js b/wcfsetup/install/files/js/WCF.Like.js index 1df53cac6d..0588c7907b 100644 --- a/wcfsetup/install/files/js/WCF.Like.js +++ b/wcfsetup/install/files/js/WCF.Like.js @@ -6,6 +6,8 @@ * @author Alexander Ebert * @copyright 2001-2015 WoltLab GmbH * @license GNU Lesser General Public License + * + * @deprecated 2.2 - please use `WoltLab/WCF/Ui/Like/Handler` instead */ WCF.Like = Class.extend({ /** diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 9faba717a3..7873dc92d6 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -5724,145 +5724,17 @@ WCF.System.Fullscreen = { /** * Provides the 'jump to page' overlay. + * + * @deprecated 2.2 - use `WoltLab/WCF/Ui/Page/JumpTo` instead */ WCF.System.PageNavigation = { - /** - * submit button - * @var jQuery - */ - _button: null, - - /** - * page No description - * @var jQuery - */ - _description: null, - - /** - * dialog overlay - * @var jQuery - */ - _dialog: null, - - /** - * active element id - * @var string - */ - _elementID: '', - - /** - * list of tracked navigation bars - * @var object - */ - _elements: { }, - - /** - * page No input - * @var jQuery - */ - _pageNo: null, - - /** - * Initializes the 'jump to page' overlay for given selector. - * - * @param string selector - * @param object callback - */ init: function(selector, callback) { - var $elements = $(selector); - if (!$elements.length) { - return; - } - - callback = callback || null; - if (callback !== null && !$.isFunction(callback)) { - console.debug("[WCF.System.PageNavigation] Callback for selector '" + selector + "' is invalid, aborting."); - return; - } - - this._initElements($elements, callback); - }, - - /** - * Initializes the 'jump to page' overlay for given elements. - * - * @param jQuery elements - * @param object callback - */ - _initElements: function(elements, callback) { - var self = this; - elements.each(function(index, element) { - var $element = $(element); - var $elementID = $element.wcfIdentify(); - - if (self._elements[$elementID] === undefined) { - self._elements[$elementID] = $element; - $element.find('li.jumpTo').data('elementID', $elementID).click($.proxy(self._click, self)); + require(['WoltLab/WCF/Ui/Page/JumpTo'], function(UiPageJumpTo) { + var elements = elBySelAll(selector); + for (var i = 0, length = elements.length; i < length; i++) { + UiPageJumpTo.init(elements[i], callback); } - }).data('callback', callback); - }, - - /** - * Shows the 'jump to page' overlay. - * - * @param object event - */ - _click: function(event) { - this._elementID = $(event.currentTarget).data('elementID'); - - if (this._dialog === null) { - this._dialog = $('