From: Fabii547 Date: Fri, 20 May 2016 08:53:40 +0000 (+0200) Subject: Replaces all click events with WCF_CLICK_EVENT X-Git-Tag: 3.0.0_Beta_1~1548^2^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ac188fc54b436cd26529adf1e304d2d4194e81bb;p=GitHub%2FWoltLab%2FWCF.git Replaces all click events with WCF_CLICK_EVENT --- diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js index 1422d2d6ea..7ae4924192 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js @@ -89,7 +89,7 @@ define(['Ajax', 'Dictionary', 'Dom/Util', 'EventHandler'], function(Ajax, Dictio button.disabled = !checkbox.checked; }); - button.addEventListener('click', function() { + button.addEventListener(WCF_CLICK_EVENT, function() { Ajax.apiOnce({ data: { actionName: 'markAsTainted', diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Attachment/Upload.js b/wcfsetup/install/files/js/WoltLab/WCF/Attachment/Upload.js index ffba3f7011..c278a50b92 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Attachment/Upload.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Attachment/Upload.js @@ -21,10 +21,10 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa }); // add event listeners - DomTraverse.childByClass(this._button, '.button').addEventListener('click', this._validateLimit.bind(this)); - elByClass(this._target, 'jsButtonInsertAttachment').addEventListener('click', this._insert.bind(this)); - elByClass(this._target, 'jsButtonAttachmentInsertThumbnail').addEventListener('click', this._insert.bind(this)); - elByClass(this._target, 'jsButtonAttachmentInsertFull').addEventListener('click', this._insert.bind(this)); + DomTraverse.childByClass(this._button, '.button').addEventListener(WCF_CLICK_EVENT, this._validateLimit.bind(this)); + elByClass(this._target, 'jsButtonInsertAttachment').addEventListener(WCF_CLICK_EVENT, this._insert.bind(this)); + elByClass(this._target, 'jsButtonAttachmentInsertThumbnail').addEventListener(WCF_CLICK_EVENT, this._insert.bind(this)); + elByClass(this._target, 'jsButtonAttachmentInsertFull').addEventListener(WCF_CLICK_EVENT, this._insert.bind(this)); // TODO: WCF.System.Event.addListener('com.woltlab.wcf.action.delete', 'attachment_' + this._wysiwygContainerId, $.proxy(this._removeLimitError, this)); @@ -36,7 +36,7 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa if (DomTraverse.childBySel(this._target, 'li:not(.uploadFailed)')) { elHide(this._insertAllButton); } - this._insertAllButton.addEventListener('click', this._insertAll.bind(this)); + this._insertAllButton.addEventListener(WCF_CLICK_EVENT, this._insertAll.bind(this)); this._button.appendChild(this._insertAllButton); if (this._wysiwygContainerId) { @@ -197,7 +197,7 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa span.className = 'button small jsButtonAttachmentInsertThumbnail'; span.textContent = Language.get('wcf.global.button.insertThumbnail'); elData(span, 'object-id', attachment.attachmentID); - span.addEventListener('click', this._insert.bind(this)); + span.addEventListener(WCF_CLICK_EVENT, this._insert.bind(this)); insertThumbnailButton.appendChild(span); var insertOriginalButton = elCreate('li'); @@ -207,7 +207,7 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa span.className = 'button small jsButtonAttachmentInsertFull'; span.textContent = Language.get('wcf.global.button.insertFull'); elData(span, 'object-id', attachment.attachmentID); - span.addEventListener('click', this._insert.bind(this)); + span.addEventListener(WCF_CLICK_EVENT, this._insert.bind(this)); insertOriginalButton.appendChild(span); } else { @@ -218,7 +218,7 @@ define(['Core', 'Dom/ChangeListener', 'Dom/Traverse', 'Language', 'List', 'Uploa span.className = 'button small jsButtonAttachmentInsertPlain'; span.textContent = Language.get('wcf.global.button.insert'); elData(span, 'object-id', attachment.attachmentID); - span.addEventListener('click', this._insert.bind(this)); + span.addEventListener(WCF_CLICK_EVENT, this._insert.bind(this)); insertPlainButton.appendChild(span); } } diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js b/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js index ccfed639fe..c120611bed 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js @@ -33,7 +33,7 @@ define([], function() { toggleButton.textContent = elData(toggleButton, 'title-' + (expand ? 'collapse' : 'expand')); }; - toggleButton.addEventListener('click', toggle); + toggleButton.addEventListener(WCF_CLICK_EVENT, toggle); // searching in a page causes Google Chrome to scroll // the box if something inside it matches diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Clipboard.js b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Clipboard.js index c75ca83018..290ae7a13e 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Clipboard.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Clipboard.js @@ -90,7 +90,7 @@ define( var markAll = elBySel('.jsClipboardMarkAll', container); if (markAll !== null) { elData(markAll, 'container-id', containerId); - markAll.addEventListener('click', this._markAll.bind(this)); + markAll.addEventListener(WCF_CLICK_EVENT, this._markAll.bind(this)); } containerData = { @@ -107,7 +107,7 @@ define( if (!_knownCheckboxes.has(checkbox)) { elData(checkbox, 'container-id', containerId); - checkbox.addEventListener('click', _callbackCheckbox); + checkbox.addEventListener(WCF_CLICK_EVENT, _callbackCheckbox); _knownCheckboxes.add(checkbox); } @@ -485,7 +485,7 @@ define( dropdown.appendChild(item); elData(item, 'type', typeName); - item.addEventListener('click', _callbackItem); + item.addEventListener(WCF_CLICK_EVENT, _callbackItem); _itemData.set(item, itemData); } @@ -500,7 +500,7 @@ define( label = elCreate('span'); label.textContent = Language.get('wcf.clipboard.item.unmarkAll'); unmarkAll.appendChild(label); - unmarkAll.addEventListener('click', _callbackUnmarkAll); + unmarkAll.addEventListener(WCF_CLICK_EVENT, _callbackUnmarkAll); dropdown.appendChild(unmarkAll); if (keepEditors.indexOf(typeName) !== -1) { diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Notice/Dismiss.js b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Notice/Dismiss.js index f238e72908..493417693a 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Notice/Dismiss.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Notice/Dismiss.js @@ -22,7 +22,7 @@ define(['Ajax'], function(Ajax) { if (buttons.length) { var clickCallback = this._click.bind(this); for (var i = 0, length = buttons.length; i < length; i++) { - buttons[i].addEventListener('click', clickCallback); + buttons[i].addEventListener(WCF_CLICK_EVENT, clickCallback); } } }, diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js index 33a5d15c67..a9b48a9ab1 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Popover.js @@ -165,7 +165,7 @@ define(['Ajax', 'Dictionary', 'Environment', 'Dom/ChangeListener', 'Dom/Util', ' element.addEventListener('mouseleave', _callbackMouseLeave); if (element.nodeName === 'A' && elAttr(element, 'href')) { - element.addEventListener('click', _callbackClick); + element.addEventListener(WCF_CLICK_EVENT, _callbackClick); } var cacheId = identifier + "-" + objectId; diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Style/Changer.js b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Style/Changer.js index ff82cd4e0c..9baa25203c 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Controller/Style/Changer.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Controller/Style/Changer.js @@ -24,7 +24,7 @@ define(['Ajax', 'Language', 'Ui/Dialog'], function(Ajax, Language, UiDialog) { var listItem = elCreate('li'); listItem.classList.add('styleChanger'); - listItem.addEventListener('click', this.showDialog.bind(this)); + listItem.addEventListener(WCF_CLICK_EVENT, this.showDialog.bind(this)); var link = elCreate('a'); elAttr(link, 'href', '#'); @@ -63,7 +63,7 @@ define(['Ajax', 'Language', 'Ui/Dialog'], function(Ajax, Language, UiDialog) { var style = styles[i]; style.classList.add('pointer'); - style.addEventListener('click', this._click.bind(this)); + style.addEventListener(WCF_CLICK_EVENT, this._click.bind(this)); } }).bind(this) } diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Controller/User/Notification/Settings.js b/wcfsetup/install/files/js/WoltLab/WCF/Controller/User/Notification/Settings.js index f45fff7eeb..939af2398c 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Controller/User/Notification/Settings.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Controller/User/Notification/Settings.js @@ -48,15 +48,15 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Ui/SimpleDropdown'], function var groupId = ~~elData(group, 'object-id'); var disabledNotification = elById('settings_' + groupId + '_disabled'); - disabledNotification.addEventListener('click', function() { mailSetting.classList.remove('active'); }); + disabledNotification.addEventListener(WCF_CLICK_EVENT, function() { mailSetting.classList.remove('active'); }); var enabledNotification = elById('settings_' + groupId + '_enabled'); - enabledNotification.addEventListener('click', function() { mailSetting.classList.add('active'); }); + enabledNotification.addEventListener(WCF_CLICK_EVENT, function() { mailSetting.classList.add('active'); }); var mailValue = DomTraverse.childByTag(mailSetting, 'INPUT'); var button = DomTraverse.childByTag(mailSetting, 'A'); elData(button, 'object-id', groupId); - button.addEventListener('click', _callbackClick); + button.addEventListener(WCF_CLICK_EVENT, _callbackClick); _data.set(groupId, { button: button, @@ -118,7 +118,7 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Ui/SimpleDropdown'], function link.textContent = Language.get('wcf.user.notification.mailNotificationType.' + value); listItem.appendChild(link); elData(listItem, 'value', value); - listItem.addEventListener('click', _callbackSelectType); + listItem.addEventListener(WCF_CLICK_EVENT, _callbackSelectType); if (initialValue === value) { listItem.className = 'active'; diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js b/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js index 1ea7f363b5..3417432a22 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Date/Picker.js @@ -96,7 +96,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment element.parentNode.insertBefore(shadowElement, element); element.removeAttribute('name'); - element.addEventListener('click', _callbackOpen); + element.addEventListener(WCF_CLICK_EVENT, _callbackOpen); // create input addon var container = elCreate('div'); @@ -104,7 +104,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment var button = elCreate('a'); button.className = 'inputSuffix button'; - button.addEventListener('click', _callbackOpen); + button.addEventListener(WCF_CLICK_EVENT, _callbackOpen); container.appendChild(button); var icon = elCreate('span'); @@ -448,7 +448,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment _datePicker = elCreate('div'); _datePicker.className = 'datePicker'; - _datePicker.addEventListener('click', function(event) { event.stopPropagation(); }); + _datePicker.addEventListener(WCF_CLICK_EVENT, function(event) { event.stopPropagation(); }); var pointer = elCreate('span'); pointer.className = 'elementPointer'; @@ -460,7 +460,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment _dateMonthPrevious = elCreate('a'); _dateMonthPrevious.className = 'icon icon16 fa-arrow-left previous'; - _dateMonthPrevious.addEventListener('click', this.previousMonth.bind(this)); + _dateMonthPrevious.addEventListener(WCF_CLICK_EVENT, this.previousMonth.bind(this)); header.appendChild(_dateMonthPrevious); var monthYearContainer = elCreate('span'); @@ -492,7 +492,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment _dateMonthNext = elCreate('a'); _dateMonthNext.className = 'icon icon16 fa-arrow-right next'; - _dateMonthNext.addEventListener('click', this.nextMonth.bind(this)); + _dateMonthNext.addEventListener(WCF_CLICK_EVENT, this.nextMonth.bind(this)); header.appendChild(_dateMonthNext); _dateGrid = elCreate('ul'); @@ -520,7 +520,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment for (var j = 0; j < 7; j++) { cell = elCreate('a'); - cell.addEventListener('click', callbackClick); + cell.addEventListener(WCF_CLICK_EVENT, callbackClick); _dateCells.push(cell); row.appendChild(cell); @@ -692,7 +692,7 @@ define(['DateUtil', 'Language', 'ObjectMap', 'Dom/ChangeListener', 'Ui/Alignment element.value = data.shadow.value; element.removeAttribute('data-value'); - element.removeEventListener('click', _callbackOpen); + element.removeEventListener(WCF_CLICK_EVENT, _callbackOpen); elRemove(data.shadow); element.classList.remove('inputDatePicker'); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js b/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js index 698089b66d..89b58422a5 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Language/Chooser.js @@ -115,7 +115,7 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Dom/Util', 'ObjectMap', 'Ui/S listItem = elCreate('li'); listItem.className = 'boxFlag'; - listItem.addEventListener('click', callbackClick); + listItem.addEventListener(WCF_CLICK_EVENT, callbackClick); elData(listItem, 'language-id', availableLanguageId); dropdownMenu.appendChild(listItem); @@ -154,7 +154,7 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Dom/Util', 'ObjectMap', 'Ui/S listItem = elCreate('li'); elData(listItem, 'language-id', availableLanguageId); - listItem.addEventListener('click', callbackClick); + listItem.addEventListener(WCF_CLICK_EVENT, callbackClick); dropdownMenu.appendChild(listItem); a = elCreate('a'); @@ -165,7 +165,7 @@ define(['Dictionary', 'Language', 'Dom/Traverse', 'Dom/Util', 'ObjectMap', 'Ui/S dropdownToggle.innerHTML = listItem.firstChild.innerHTML; } - listItem.addEventListener('click', callbackClick) + listItem.addEventListener(WCF_CLICK_EVENT, callbackClick) } else if (languageId === 0) { dropdownToggle.innerHTML = null; diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Language/Input.js b/wcfsetup/install/files/js/WoltLab/WCF/Language/Input.js index 7cae3a5c25..1055fcad4f 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Language/Input.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Language/Input.js @@ -120,7 +120,7 @@ define(['Core', 'Dictionary', 'Language', 'ObjectMap', 'StringUtil', 'Dom/Traver span.textContent = availableLanguages[languageId]; listItem.appendChild(span); - listItem.addEventListener('click', callbackClick); + listItem.addEventListener(WCF_CLICK_EVENT, callbackClick); dropdownMenu.appendChild(listItem); } } @@ -135,7 +135,7 @@ define(['Core', 'Dictionary', 'Language', 'ObjectMap', 'StringUtil', 'Dom/Traver span = elCreate('span'); span.textContent = Language.get('wcf.global.button.disabledI18n'); listItem.appendChild(span); - listItem.addEventListener('click', callbackClick); + listItem.addEventListener(WCF_CLICK_EVENT, callbackClick); dropdownMenu.appendChild(listItem); } diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Editor.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Editor.js index f62eeb0282..7bae2439e7 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Editor.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Editor.js @@ -117,7 +117,7 @@ define( setTimeout(this._setData.bind(this), 100); - elBySel('button[data-type="submit"]', editor).addEventListener('click', this._saveData.bind(this)); + elBySel('button[data-type="submit"]', editor).addEventListener(WCF_CLICK_EVENT, this._saveData.bind(this)); }).bind(this), data: { actionName: 'getEditorDialog', diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Base.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Base.js index b4988e69fb..c1c122ba22 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Base.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Base.js @@ -58,7 +58,7 @@ define( var editIcon = elByClass('jsMediaEditIcon', listItem)[0]; if (editIcon) { editIcon.classList.remove('jsMediaEditIcon'); - editIcon.addEventListener('click', this._editMedia.bind(this)); + editIcon.addEventListener(WCF_CLICK_EVENT, this._editMedia.bind(this)); } } } diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js index 52452f8b3c..16de1dac62 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Editor.js @@ -18,7 +18,7 @@ define(['Core', 'Dom/Traverse', 'Language', 'Ui/Dialog', 'WoltLab/WCF/Media/Mana this._activeButton = null; this._buttons = elByClass(this._options.buttonClass || 'jsMediaEditorButton'); for (var i = 0, length = this._buttons.length; i < length; i++) { - this._buttons[i].addEventListener('click', this._click.bind(this)); + this._buttons[i].addEventListener(WCF_CLICK_EVENT, this._click.bind(this)); } this._activeButton = null; @@ -39,7 +39,7 @@ define(['Core', 'Dom/Traverse', 'Language', 'Ui/Dialog', 'WoltLab/WCF/Media/Mana var insertIcon = elByClass('jsMediaInsertIcon', listItem)[0]; if (insertIcon) { insertIcon.classList.remove('jsMediaInsertIcon'); - insertIcon.addEventListener('click', this._openInsertDialog.bind(this)); + insertIcon.addEventListener(WCF_CLICK_EVENT, this._openInsertDialog.bind(this)); } } }, @@ -119,7 +119,7 @@ define(['Core', 'Dom/Traverse', 'Language', 'Ui/Dialog', 'WoltLab/WCF/Media/Mana submitButton.className = 'buttonPrimary'; submitButton.textContent = Language.get('wcf.global.button.insert'); elData(submitButton, 'object-id', media.mediaID); - submitButton.addEventListener('click', this._insertMedia.bind(this)); + submitButton.addEventListener(WCF_CLICK_EVENT, this._insertMedia.bind(this)); formSubmit.appendChild(submitButton); UiDialog.open({ diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Search.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Search.js index fa1c08c6c5..b3b4fd485a 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Search.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Search.js @@ -22,7 +22,7 @@ define(['Ajax', 'Core', 'Dom/Traverse', 'Dom/Util', 'Language', 'WoltLab/WCF/Med this._input.addEventListener('keypress', this._keyPress.bind(this)); this._cancelButton = elById(this._getIdPrefix() + 'SearchCancelButton'); - this._cancelButton.addEventListener('click', this._cancelSearch.bind(this)); + this._cancelButton.addEventListener(WCF_CLICK_EVENT, this._cancelSearch.bind(this)); }; Core.inherit(MediaManagerSearch, MediaSearch, { /** diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Select.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Select.js index 0a3ed32e13..4e0924df1f 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Select.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Manager/Select.js @@ -27,7 +27,7 @@ define(['Core', 'Dom/Traverse', 'Language', 'ObjectMap', 'Ui/Dialog', 'WoltLab/W if (store) { var storeElement = elById(store); if (storeElement && storeElement.tagName === 'INPUT') { - this._buttons[i].addEventListener('click', this._click.bind(this)); + this._buttons[i].addEventListener(WCF_CLICK_EVENT, this._click.bind(this)); this._storeElements.set(button, storeElement); } @@ -50,7 +50,7 @@ define(['Core', 'Dom/Traverse', 'Language', 'ObjectMap', 'Ui/Dialog', 'WoltLab/W var chooseIcon = elByClass('jsMediaSelectIcon', listItem)[0]; if (chooseIcon) { chooseIcon.classList.remove('jsMediaSelectIcon'); - chooseIcon.addEventListener('click', this._chooseMedia.bind(this)); + chooseIcon.addEventListener(WCF_CLICK_EVENT, this._chooseMedia.bind(this)); } } }, diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Search.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Search.js index 6dc909a9b8..ceec34dfea 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Search.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Search.js @@ -27,7 +27,7 @@ define(['Ajax', 'Dom/Traverse', 'Dom/Util', 'Language', 'Ui/SimpleDropdown'], fu this._fileType = initialFileType; } - this._fileTypes[i].addEventListener('click', selectFileType); + this._fileTypes[i].addEventListener(WCF_CLICK_EVENT, selectFileType); } if (initialFileType && initialFileType.length) { diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Media/Upload.js b/wcfsetup/install/files/js/WoltLab/WCF/Media/Upload.js index d833122fc8..6e63317d02 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Media/Upload.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Media/Upload.js @@ -147,7 +147,7 @@ define( fileIcon.classList.add('pointer'); file.classList.add('uploadFailed'); - file.addEventListener('click', function() { + file.addEventListener(WCF_CLICK_EVENT, function() { elRemove(this); }); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/CloseOverlay.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/CloseOverlay.js index 5df68bdb51..e9325bae1d 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/CloseOverlay.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/CloseOverlay.js @@ -19,7 +19,7 @@ define(['CallbackList'], function(CallbackList) { * Sets up global event listener for bubbled clicks events. */ setup: function() { - document.body.addEventListener('click', this.execute.bind(this)); + document.body.addEventListener(WCF_CLICK_EVENT, this.execute.bind(this)); }, /** diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Confirmation.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Confirmation.js index 9a59796275..84c8a447dc 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Confirmation.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Confirmation.js @@ -113,12 +113,12 @@ define(['Core', 'Language', 'Ui/Dialog'], function(Core, Language, UiDialog) { _confirmButton = elCreate('button'); _confirmButton.classList.add('buttonPrimary'); _confirmButton.textContent = Language.get('wcf.global.confirmation.confirm'); - _confirmButton.addEventListener('click', this._confirm.bind(this)); + _confirmButton.addEventListener(WCF_CLICK_EVENT, this._confirm.bind(this)); formSubmit.appendChild(_confirmButton); var cancelButton = elCreate('button'); cancelButton.textContent = Language.get('wcf.global.confirmation.cancel'); - cancelButton.addEventListener('click', function() { UiDialog.close('wcfSystemConfirmation'); }); + cancelButton.addEventListener(WCF_CLICK_EVENT, function() { UiDialog.close('wcfSystemConfirmation'); }); formSubmit.appendChild(cancelButton); document.body.appendChild(dialog); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js index 207057dcc3..c98dfcd9e9 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Dialog.js @@ -42,7 +42,7 @@ define( _container = elCreate('div'); _container.classList.add('dialogOverlay'); elAttr(_container, 'aria-hidden', 'true'); - _container.addEventListener('click', this._closeOnBackdrop.bind(this)); + _container.addEventListener(WCF_CLICK_EVENT, this._closeOnBackdrop.bind(this)); elById('content').appendChild(_container); @@ -80,7 +80,7 @@ define( ((function(button, container) { container.classList.remove('jsStaticDialogContent'); elHide(container); - button.addEventListener('click', this.openStatic.bind(this, container.id, null, { title: elData(container, 'title') })); + button.addEventListener(WCF_CLICK_EVENT, this.openStatic.bind(this, container.id, null, { title: elData(container, 'title') })); }).bind(this))(button, container); } } @@ -288,7 +288,7 @@ define( closeButton.className = 'dialogCloseButton jsTooltip'; elAttr(closeButton, 'title', options.closeButtonLabel); elAttr(closeButton, 'aria-label', options.closeButtonLabel); - closeButton.addEventListener('click', this._close.bind(this)); + closeButton.addEventListener(WCF_CLICK_EVENT, this._close.bind(this)); header.appendChild(closeButton); var span = elCreate('span'); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/FlexibleMenu.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/FlexibleMenu.js index 617b163202..a4f3cd148b 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/FlexibleMenu.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/FlexibleMenu.js @@ -173,10 +173,10 @@ define(['Core', 'Dictionary', 'Dom/ChangeListener', 'Dom/Traverse', 'Dom/Util', var item = elCreate('li'); item.innerHTML = hiddenItem.innerHTML; - item.addEventListener('click', (function(event) { + item.addEventListener(WCF_CLICK_EVENT, (function(event) { event.preventDefault(); - Core.triggerEvent(elBySel('a', hiddenItem), 'click'); + Core.triggerEvent(elBySel('a', hiddenItem), WCF_CLICK_EVENT); // force a rebuild to guarantee the active item being visible setTimeout(function() { diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/ItemList.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/ItemList.js index 8acd1af504..57a986e764 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/ItemList.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/ItemList.js @@ -180,7 +180,7 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'WoltLab/WCF/Ui/Sugges var list = elCreate('ol'); list.className = 'inputItemList'; elData(list, 'element-id', element.id); - list.addEventListener('click', function(event) { + list.addEventListener(WCF_CLICK_EVENT, function(event) { if (event.target === list) element.focus(); }); @@ -347,7 +347,7 @@ define(['Core', 'Dictionary', 'Language', 'Dom/Traverse', 'WoltLab/WCF/Ui/Sugges var button = elCreate('a'); button.className = 'icon icon16 fa-times'; - button.addEventListener('click', _callbackRemoveItem); + button.addEventListener(WCF_CLICK_EVENT, _callbackRemoveItem); listItem.appendChild(content); listItem.appendChild(button); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js index ed593e75d6..a3d4a40194 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Like/Handler.js @@ -126,7 +126,7 @@ define( summaryContent = elCreate('span'); summaryContent.className = 'likesSummaryContent'; - summaryContent.addEventListener('click', this._showSummary.bind(this, element)); + summaryContent.addEventListener(WCF_CLICK_EVENT, this._showSummary.bind(this, element)); summary.appendChild(summaryContent); if (this._options.summaryPrepend) { @@ -148,7 +148,7 @@ define( badge = elCreate('a'); badge.href = '#'; badge.className = 'wcfLikeCounter jsTooltip' + (this._options.badgeClassNames ? ' ' + this._options.badgeClassNames : ''); - badge.addEventListener('click', this._showSummary.bind(this, element)); + badge.addEventListener(WCF_CLICK_EVENT, this._showSummary.bind(this, element)); if (badgeContainer.nodeName === 'OL' || badgeContainer.nodeName === 'UL') { listItem = elCreate('li'); @@ -204,7 +204,7 @@ define( button.href = '#'; button.title = title; button.innerHTML = ' '; - button.addEventListener('click', this._like.bind(this, element)); + button.addEventListener(WCF_CLICK_EVENT, this._like.bind(this, element)); elData(button, 'type', (isLike ? 'like' : 'dislike')); listItem.appendChild(button); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Message/InlineEditor.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Message/InlineEditor.js index 3cce87563d..79bc1d12d3 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Message/InlineEditor.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Message/InlineEditor.js @@ -69,7 +69,7 @@ define( canEdit = elDataBool(element, 'can-edit'); if (this._options.canEditInline) { - button.addEventListener('click', this._clickDropdown.bind(this, element)); + button.addEventListener(WCF_CLICK_EVENT, this._clickDropdown.bind(this, element)); button.classList.add('jsDropdownEnabled'); if (canEdit) { @@ -77,7 +77,7 @@ define( } } else if (canEdit) { - button.addEventListener('click', this._click.bind(this, element)); + button.addEventListener(WCF_CLICK_EVENT, this._click.bind(this, element)); } } @@ -142,7 +142,7 @@ define( button.classList.add('dropdownToggle'); button.parentNode.classList.add('dropdown'); (function(button, element) { - button.addEventListener('click', (function(event) { + button.addEventListener(WCF_CLICK_EVENT, (function(event) { event.preventDefault(); event.stopPropagation(); @@ -169,7 +169,7 @@ define( } setTimeout(function() { - Core.triggerEvent(button, 'click'); + Core.triggerEvent(button, WCF_CLICK_EVENT); }, 10); }, @@ -197,10 +197,10 @@ define( listItem.appendChild(label); if (item.item === 'editItem') { - listItem.addEventListener('click', this._click.bind(this, null)); + listItem.addEventListener(WCF_CLICK_EVENT, this._click.bind(this, null)); } else { - listItem.addEventListener('click', callbackClick); + listItem.addEventListener(WCF_CLICK_EVENT, callbackClick); } } @@ -340,15 +340,15 @@ define( var formSubmit = elBySel('.formSubmit', editor); var buttonSave = elBySel('button[data-type="save"]', formSubmit); - buttonSave.addEventListener('click', this._save.bind(this)); + buttonSave.addEventListener(WCF_CLICK_EVENT, this._save.bind(this)); if (this._options.extendedForm) { var buttonExtended = elBySel('button[data-type="extended"]', formSubmit); - buttonExtended.addEventListener('click', this._prepareExtended.bind(this)); + buttonExtended.addEventListener(WCF_CLICK_EVENT, this._prepareExtended.bind(this)); } var buttonCancel = elBySel('button[data-type="cancel"]', formSubmit); - buttonCancel.addEventListener('click', this._restoreMessage.bind(this)); + buttonCancel.addEventListener(WCF_CLICK_EVENT, this._restoreMessage.bind(this)); EventHandler.add('com.woltlab.wcf.redactor', 'submitEditor_' + id, (function(data) { data.cancel = true; diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Mobile.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Mobile.js index 6594e0298e..3e6a6573a0 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Mobile.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Mobile.js @@ -87,7 +87,7 @@ define( _initSearchBar: function() { var _searchBar = elBySel('.searchBar'); - _searchBar.addEventListener('click', function() { + _searchBar.addEventListener(WCF_CLICK_EVENT, function() { if (_enabled) { _searchBar.classList.add('searchBarOpen'); @@ -97,7 +97,7 @@ define( return false; }); - _main.addEventListener('click', function() { _searchBar.classList.remove('searchBarOpen'); }); + _main.addEventListener(WCF_CLICK_EVENT, function() { _searchBar.classList.remove('searchBarOpen'); }); }, _initButtonGroupNavigation: function() { @@ -115,7 +115,7 @@ define( button.appendChild(span); (function(button) { - button.addEventListener('click', function(ev) { + button.addEventListener(WCF_CLICK_EVENT, function(ev) { var next = button.nextElementSibling; if (next !== null) { next.classList.toggle('open'); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Notification.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Notification.js index c2012dbe95..8e1747083a 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Notification.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Notification.js @@ -57,7 +57,7 @@ define(['Language'], function(Language) { _notificationElement.id = 'systemNotification'; _message = elCreate('p'); - _message.addEventListener('click', _callbackHide); + _message.addEventListener(WCF_CLICK_EVENT, _callbackHide); _notificationElement.appendChild(_message); document.body.appendChild(_notificationElement); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpTo.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpTo.js index f922e4214b..b78c97da2f 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpTo.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpTo.js @@ -46,7 +46,7 @@ define(['Language', 'ObjectMap', 'Ui/Dialog'], function(Language, ObjectMap, UiD if (!_elements.has(element)) { var jumpTo = elBySel('.jumpTo', element); if (jumpTo !== null) { - jumpTo.addEventListener('click', this._click.bind(this, element)); + jumpTo.addEventListener(WCF_CLICK_EVENT, this._click.bind(this, element)); _elements.set(element, { callback: callback }); } @@ -128,7 +128,7 @@ define(['Language', 'ObjectMap', 'Ui/Dialog'], function(Language, ObjectMap, UiD _description = elByTag('small', content)[0]; _buttonSubmit = elByTag('button', content)[0]; - _buttonSubmit.addEventListener('click', this._submit.bind(this)); + _buttonSubmit.addEventListener(WCF_CLICK_EVENT, this._submit.bind(this)); }).bind(this), title: Language.get('wcf.global.page.pagination') }, diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpToTop.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpToTop.js index f286043312..77db0749a1 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpToTop.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Page/JumpToTop.js @@ -32,7 +32,7 @@ define(['Environment', 'Language', './Action'], function(Environment, Language, elAttr(button, 'title', Language.get('wcf.global.scrollUp')); button.innerHTML = ''; - button.addEventListener('click', this._jump.bind(this)); + button.addEventListener(WCF_CLICK_EVENT, this._jump.bind(this)); PageAction.add('toTop', button); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Pagination.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Pagination.js index f060b302fb..5b3a03230b 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Pagination.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Pagination.js @@ -68,7 +68,7 @@ define(['Core', 'Language', 'ObjectMap', 'StringUtil', 'WoltLab/WCF/Ui/Page/Jump link.title = Language.get('wcf.global.page.previous'); listItem.appendChild(link); - link.addEventListener('click', this.switchPage.bind(this, this._options.activePage - 1)); + link.addEventListener(WCF_CLICK_EVENT, this.switchPage.bind(this, this._options.activePage - 1)); } else { listItem.innerHTML = ''; @@ -166,7 +166,7 @@ define(['Core', 'Language', 'ObjectMap', 'StringUtil', 'WoltLab/WCF/Ui/Page/Jump link.title = Language.get('wcf.global.page.next'); listItem.appendChild(link); - link.addEventListener('click', this.switchPage.bind(this, this._options.activePage + 1)); + link.addEventListener(WCF_CLICK_EVENT, this.switchPage.bind(this, this._options.activePage + 1)); } else { listItem.innerHTML = ''; @@ -193,7 +193,7 @@ define(['Core', 'Language', 'ObjectMap', 'StringUtil', 'WoltLab/WCF/Ui/Page/Jump if (pageNo !== this._options.activePage) { var link = elCreate('a'); link.textContent = StringUtil.addThousandsSeparator(pageNo); - link.addEventListener('click', this.switchPage.bind(this, pageNo)); + link.addEventListener(WCF_CLICK_EVENT, this.switchPage.bind(this, pageNo)); listItem.appendChild(link); } else { diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js index 557aada936..b23defc07f 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Redactor/Mention.js @@ -242,7 +242,7 @@ define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, E listItem = elCreate('li'); link = elCreate('a'); - link.addEventListener('click', callbackClick); + link.addEventListener(WCF_CLICK_EVENT, callbackClick); link.className = 'box16'; link.innerHTML = '' + user.icon + ' ' + user.label + ''; elData(link, 'user-id', user.objectID); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Suggestion.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Suggestion.js index 17ba838124..5928e7af84 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Suggestion.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Suggestion.js @@ -53,7 +53,7 @@ define(['Ajax', 'Core', 'Ui/SimpleDropdown'], function(Ajax, Core, UiSimpleDropd throw new Error("Expected a valid callback for option 'callbackSelect'."); } - this._element.addEventListener('click', function(event) { event.stopPropagation(); }); + this._element.addEventListener(WCF_CLICK_EVENT, function(event) { event.stopPropagation(); }); this._element.addEventListener('keydown', this._keyDown.bind(this)); this._element.addEventListener('keyup', this._keyUp.bind(this)); }, @@ -224,7 +224,7 @@ define(['Ajax', 'Core', 'Ui/SimpleDropdown'], function(Ajax, Core, UiSimpleDropd anchor = elCreate('a'); anchor.textContent = item.label; elData(anchor, 'object-id', item.objectID); - anchor.addEventListener('click', this._select.bind(this)); + anchor.addEventListener(WCF_CLICK_EVENT, this._select.bind(this)); listItem = elCreate('li'); if (i === 0) listItem.className = 'active'; diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js index d320c0d629..c5902a4640 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/TabMenu/Simple.js @@ -123,7 +123,7 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict // bind listeners this._tabs.forEach((function(tab) { if (!oldTabs || oldTabs.get(elData(tab, 'name')) !== tab) { - tab.children[0].addEventListener('click', this._onClick.bind(this)); + tab.children[0].addEventListener(WCF_CLICK_EVENT, this._onClick.bind(this)); } }).bind(this)); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Tooltip.js b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Tooltip.js index 7e31b98bed..3a96674328 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ui/Tooltip.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Ui/Tooltip.js @@ -63,7 +63,7 @@ define(['Environment', 'Dom/ChangeListener', 'Ui/Alignment'], function(Environme element.addEventListener('mouseenter', this._mouseEnter.bind(this)); element.addEventListener('mouseleave', this._mouseLeave.bind(this)); - element.addEventListener('click', this._mouseLeave.bind(this)); + element.addEventListener(WCF_CLICK_EVENT, this._mouseLeave.bind(this)); } } },