From: Matthias Schmidt Date: Fri, 29 Jul 2016 16:18:59 +0000 (+0200) Subject: Update tag clipboard-related JavaScript code X-Git-Tag: 3.0.0_Beta_1~901 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f8d9e4852f7e6219ded6799695a7576f0df2ea86;p=GitHub%2FWoltLab%2FWCF.git Update tag clipboard-related JavaScript code --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 0a9cee5783..949c0e28e9 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -2611,46 +2611,33 @@ WCF.ACP.Tag.SetAsSynonymsHandler = Class.extend({ /** * Initializes the SetAsSynonymsHandler object. - * - * @param array objectIDs */ init: function() { - // bind listener - $('.jsClipboardEditor').each($.proxy(function(index, container) { - var $container = $(container); - var $types = eval($container.data('types')); - if (WCF.inArray('com.woltlab.wcf.tag', $types)) { - $container.on('clipboardAction', $.proxy(this._execute, this)); - return false; - } - }, this)); + require(['EventHandler'], function(EventHandler) { + EventHandler.add('com.woltlab.wcf.clipboard', 'com.woltlab.wcf.tag', this._clipboardAction.bind(this)); + }.bind(this)); }, /** - * Handles clipboard actions. - * - * @param object event - * @param string type - * @param string actionName - * @param object parameters + * Reacts to executed clipboard actions. + * + * @param {object} actionData data of the executed clipboard action */ - _execute: function(event, type, actionName, parameters) { - if (type !== 'com.woltlab.wcf.tag' || actionName !== 'com.woltlab.wcf.tag.setAsSynonyms') { - return; - } - - this._objectIDs = parameters.objectIDs; - if (this._dialog === null) { - this._dialog = $('
').hide().appendTo(document.body); - this._dialog.wcfDialog({ - closable: false, - title: WCF.Language.get('wcf.acp.tag.setAsSynonyms') - }); + _clipboardAction: function(actionData) { + if (actionData.data.actionName === 'com.woltlab.wcf.tag.setAsSynonyms') { + this._objectIDs = actionData.data.parameters.objectIDs; + if (this._dialog === null) { + this._dialog = $('
').hide().appendTo(document.body); + this._dialog.wcfDialog({ + closable: false, + title: WCF.Language.get('wcf.acp.tag.setAsSynonyms') + }); + } + + this._dialog.html(actionData.data.parameters.template); + $button = this._dialog.find('button[data-type="submit"]').disable().click($.proxy(this._submit, this)); + this._dialog.find('input[type=radio]').change(function() { $button.enable(); }); } - - this._dialog.html(parameters.template); - $button = this._dialog.find('button[data-type="submit"]').disable().click($.proxy(this._submit, this)); - this._dialog.find('input[type=radio]').change(function() { $button.enable(); }); }, /**