From: Matthias Schmidt Date: Thu, 4 Aug 2016 19:30:56 +0000 (+0200) Subject: Move JavaScript modules into WoltLabSuite/Core namespace X-Git-Tag: 3.0.0_Beta_1~806 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=58d7e8f8090d42cf10378c52bfb4749e69c424f6;p=GitHub%2FWoltLab%2FWCF.git Move JavaScript modules into WoltLabSuite/Core namespace --- diff --git a/com.woltlab.wcf/templates/__commentJavaScript.tpl b/com.woltlab.wcf/templates/__commentJavaScript.tpl index 4c64c0daac..1253cb6a6c 100644 --- a/com.woltlab.wcf/templates/__commentJavaScript.tpl +++ b/com.woltlab.wcf/templates/__commentJavaScript.tpl @@ -16,7 +16,7 @@ new {if $commentHandlerClass|isset}{@$commentHandlerClass}{else}WCF.Comment.Handler{/if}('{$commentContainerID}', '{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(48)}', '{@$__wcf->getUserProfileHandler()->getAvatar()->getImageTag(32)}'); {if MODULE_LIKE && $commentList->getCommentManager()->supportsLike() && $__wcf->getSession()->getPermission('user.like.canViewLike')} - require(['WoltLab/WCF/Ui/Like/Handler'], function(UiLikeHandler) { + require(['WoltLabSuite/Core/Ui/Like/Handler'], function(UiLikeHandler) { var canDislike = {if LIKE_ENABLE_DISLIKE}true{else}false{/if}; var canLike = {if $__wcf->getUser()->userID && $__wcf->getSession()->getPermission('user.like.canLike')}true{else}false{/if}; var canLikeOwnContent = {if LIKE_ALLOW_FOR_OWN_CONTENT}true{else}false{/if}; diff --git a/com.woltlab.wcf/templates/aclSimple.tpl b/com.woltlab.wcf/templates/aclSimple.tpl index 3fa5a97cea..7e556d8b09 100644 --- a/com.woltlab.wcf/templates/aclSimple.tpl +++ b/com.woltlab.wcf/templates/aclSimple.tpl @@ -53,7 +53,7 @@ diff --git a/com.woltlab.wcf/templates/article.tpl b/com.woltlab.wcf/templates/article.tpl index 4a3352a152..0fbba1c249 100644 --- a/com.woltlab.wcf/templates/article.tpl +++ b/com.woltlab.wcf/templates/article.tpl @@ -310,7 +310,7 @@ {if MODULE_LIKE && ARTICLE_ENABLE_LIKE} diff --git a/com.woltlab.wcf/templates/codeMetaCode.tpl b/com.woltlab.wcf/templates/codeMetaCode.tpl index 8fcf0abc70..659cb0d27f 100644 --- a/com.woltlab.wcf/templates/codeMetaCode.tpl +++ b/com.woltlab.wcf/templates/codeMetaCode.tpl @@ -24,7 +24,7 @@ {if !$__overlongCodeBoxSeen|isset} {assign var='__overlongCodeBoxSeen' value=true} diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index 30b36cbcfd..dd6ed89c1a 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -22,7 +22,7 @@ requirejs.config({ }); diff --git a/com.woltlab.wcf/templates/pageHeaderSearch.tpl b/com.woltlab.wcf/templates/pageHeaderSearch.tpl index 1eccf74a44..79037cf859 100644 --- a/com.woltlab.wcf/templates/pageHeaderSearch.tpl +++ b/com.woltlab.wcf/templates/pageHeaderSearch.tpl @@ -71,7 +71,7 @@ {if !OFFLINE || $__wcf->session->getPermission('admin.general.canViewPageDuringOfflineMode')} diff --git a/com.woltlab.wcf/templates/pageHeaderUser.tpl b/com.woltlab.wcf/templates/pageHeaderUser.tpl index 9a865522c4..41a1b3abf7 100644 --- a/com.woltlab.wcf/templates/pageHeaderUser.tpl +++ b/com.woltlab.wcf/templates/pageHeaderUser.tpl @@ -101,7 +101,7 @@ {if $__wcf->getLanguage()->getLanguages()|count > 1}
  • diff --git a/com.woltlab.wcf/templates/tagInput.tpl b/com.woltlab.wcf/templates/tagInput.tpl index 23daa44c04..998b4ad157 100644 --- a/com.woltlab.wcf/templates/tagInput.tpl +++ b/com.woltlab.wcf/templates/tagInput.tpl @@ -8,7 +8,7 @@ diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index 5a3e8a03ef..77bf603f94 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -49,7 +49,7 @@ {event name='redactorJavaScript'} ], function () { - require(['Language', 'WoltLab/WCF/Ui/Redactor/Autosave', 'WoltLab/WCF/Ui/Redactor/Metacode'], function(Language, UiRedactorAutosave, UiRedactorMetacode) { + require(['Language', 'WoltLabSuite/Core/Ui/Redactor/Autosave', 'WoltLabSuite/Core/Ui/Redactor/Metacode'], function(Language, UiRedactorAutosave, UiRedactorMetacode) { Language.addObject({ 'wcf.editor.code.edit': '{lang}wcf.editor.code.edit{/lang}', 'wcf.editor.code.file': '{lang}wcf.editor.code.file{/lang}', diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.Style.js b/wcfsetup/install/files/acp/js/WCF.ACP.Style.js index 06243a2d55..1821bc8505 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.Style.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.Style.js @@ -69,7 +69,7 @@ WCF.ACP.Style.CopyStyle = Class.extend({ * * @param integer styleID * @param string tmpHash - * @deprecated use WoltLab/WCF/Acp/Ui/Style/Image/Upload + * @deprecated use WoltLabSuite/Core/Acp/Ui/Style/Image/Upload */ WCF.ACP.Style.ImageUpload = WCF.Upload.extend({ /** diff --git a/wcfsetup/install/files/acp/templates/__pageAddContent.tpl b/wcfsetup/install/files/acp/templates/__pageAddContent.tpl index 015ba9b205..b16b81271e 100644 --- a/wcfsetup/install/files/acp/templates/__pageAddContent.tpl +++ b/wcfsetup/install/files/acp/templates/__pageAddContent.tpl @@ -19,7 +19,7 @@
  • diff --git a/wcfsetup/install/files/acp/templates/articleAdd.tpl b/wcfsetup/install/files/acp/templates/articleAdd.tpl index 2d4b8ba513..8408efbb03 100644 --- a/wcfsetup/install/files/acp/templates/articleAdd.tpl +++ b/wcfsetup/install/files/acp/templates/articleAdd.tpl @@ -17,7 +17,7 @@ @@ -26,7 +26,7 @@ diff --git a/wcfsetup/install/files/acp/templates/boxAdd.tpl b/wcfsetup/install/files/acp/templates/boxAdd.tpl index aff4cbb3f7..6a259f760d 100644 --- a/wcfsetup/install/files/acp/templates/boxAdd.tpl +++ b/wcfsetup/install/files/acp/templates/boxAdd.tpl @@ -5,12 +5,12 @@ {include file='mediaJavaScript'} {if $boxType == 'system'} - require(['WoltLab/WCF/Acp/Ui/Box/Controller/Handler'], function(AcpUiBoxControllerHandler) { + require(['WoltLabSuite/Core/Acp/Ui/Box/Controller/Handler'], function(AcpUiBoxControllerHandler) { AcpUiBoxControllerHandler.init({if $boxController}{@$boxController->objectTypeID}{/if}); }); {/if} - require(['Dictionary', 'Language', 'WoltLab/WCF/Acp/Ui/Box/Handler', 'WoltLab/WCF/Media/Manager/Select'], function(Dictionary, Language, AcpUiBoxHandler, MediaManagerSelect) { + require(['Dictionary', 'Language', 'WoltLabSuite/Core/Acp/Ui/Box/Handler', 'WoltLabSuite/Core/Media/Manager/Select'], function(Dictionary, Language, AcpUiBoxHandler, MediaManagerSelect) { Language.addObject({ 'wcf.page.pageObjectID.search.noResults': '{lang}wcf.page.pageObjectID.search.noResults{/lang}', 'wcf.page.pageObjectID.search.results': '{lang}wcf.page.pageObjectID.search.results{/lang}', @@ -391,7 +391,7 @@
    diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index 5a3e8a03ef..77bf603f94 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -49,7 +49,7 @@ {event name='redactorJavaScript'} ], function () { - require(['Language', 'WoltLab/WCF/Ui/Redactor/Autosave', 'WoltLab/WCF/Ui/Redactor/Metacode'], function(Language, UiRedactorAutosave, UiRedactorMetacode) { + require(['Language', 'WoltLabSuite/Core/Ui/Redactor/Autosave', 'WoltLabSuite/Core/Ui/Redactor/Metacode'], function(Language, UiRedactorAutosave, UiRedactorMetacode) { Language.addObject({ 'wcf.editor.code.edit': '{lang}wcf.editor.code.edit{/lang}', 'wcf.editor.code.file': '{lang}wcf.editor.code.file{/lang}', diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCode.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCode.js index 63d1a2e37f..2a96ea4491 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCode.js @@ -3,7 +3,7 @@ $.Redactor.prototype.WoltLabCode = function() { return { init: function() { - require(['WoltLab/WCF/Ui/Redactor/Code'], (function (UiRedactorCode) { + require(['WoltLabSuite/Core/Ui/Redactor/Code'], (function (UiRedactorCode) { new UiRedactorCode(this); }).bind(this)); } diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabColor.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabColor.js index 68ae83580f..d86c334c9f 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabColor.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabColor.js @@ -44,7 +44,7 @@ $.Redactor.prototype.WoltLabColor = function() { setColor: function(key) { key = key.replace(/^color_/, ''); - require(['WoltLab/WCF/Ui/Redactor/Format'], (function(UiRedactorFormat) { + require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) { this.buffer.set(); UiRedactorFormat.format(this.$editor[0], 'woltlab-color', 'woltlab-color-' + key); @@ -52,7 +52,7 @@ $.Redactor.prototype.WoltLabColor = function() { }, removeColor: function() { - require(['WoltLab/WCF/Ui/Redactor/Format'], (function(UiRedactorFormat) { + require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) { this.buffer.set(); UiRedactorFormat.removeFormat(this.$editor[0], 'woltlab-color'); diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabLink.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabLink.js index c7a5f7da1e..1f742ce741 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabLink.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabLink.js @@ -7,7 +7,7 @@ $.Redactor.prototype.WoltLabLink = function() { init: function() { this.link.show = this.WoltLabLink.show.bind(this); - require(['WoltLab/WCF/Ui/Redactor/Link'], function(UiRedactorLink) { + require(['WoltLabSuite/Core/Ui/Redactor/Link'], function(UiRedactorLink) { _dialogApi = UiRedactorLink; }); }, diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMedia.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMedia.js index 7a359f064c..bac860718f 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMedia.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMedia.js @@ -6,7 +6,7 @@ $.Redactor.prototype.WoltLabMedia = function() { var button = this.button.add('woltlabMedia', ''); $(button).addClass('jsMediaEditorButton'); - require(['WoltLab/WCF/Media/Manager/Editor'], function(MediaManagerEditor) { + require(['WoltLabSuite/Core/Media/Manager/Editor'], function(MediaManagerEditor) { new MediaManagerEditor({ editor: this }); diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMention.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMention.js index 4b64ca544e..6bb45fbcc2 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMention.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabMention.js @@ -5,7 +5,7 @@ $.Redactor.prototype.WoltLabMention = function() { init: function() { //var WoltLabMention = document.registerElement('woltlab-mention'); - require(['WoltLab/WCF/Ui/Redactor/Mention'], (function(UiRedactorMention) { + require(['WoltLabSuite/Core/Ui/Redactor/Mention'], (function(UiRedactorMention) { new UiRedactorMention(this); }).bind(this)); } diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPage.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPage.js index 52bbf917f8..ccf7a1b5e5 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPage.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPage.js @@ -5,7 +5,7 @@ $.Redactor.prototype.WoltLabPage = function() { init: function() { var button = this.button.add('woltlabPage', ''); - require(['WoltLab/WCF/Ui/Redactor/Page'], (function (UiRedactorPage) { + require(['WoltLabSuite/Core/Ui/Redactor/Page'], (function (UiRedactorPage) { new UiRedactorPage(this, button[0]); }).bind(this)); } diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabQuote.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabQuote.js index 79b71c469d..05668ce02b 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabQuote.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabQuote.js @@ -5,7 +5,7 @@ $.Redactor.prototype.WoltLabQuote = function() { init: function() { var button = this.button.add('woltlabQuote', ''); - require(['WoltLab/WCF/Ui/Redactor/Quote'], (function (UiRedactorQuote) { + require(['WoltLabSuite/Core/Ui/Redactor/Quote'], (function (UiRedactorQuote) { new UiRedactorQuote(this, button); }).bind(this)); } diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSize.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSize.js index 64bea9706f..8a0cdd6837 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSize.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSize.js @@ -35,7 +35,7 @@ $.Redactor.prototype.WoltLabSize = function() { }, setSize: function(key) { - require(['WoltLab/WCF/Ui/Redactor/Format'], (function(UiRedactorFormat) { + require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) { this.buffer.set(); UiRedactorFormat.format(this.$editor[0], 'woltlab-size', 'woltlab-size-' + key.replace(/^size_/, '')); @@ -43,7 +43,7 @@ $.Redactor.prototype.WoltLabSize = function() { }, removeSize: function() { - require(['WoltLab/WCF/Ui/Redactor/Format'], (function(UiRedactorFormat) { + require(['WoltLabSuite/Core/Ui/Redactor/Format'], (function(UiRedactorFormat) { this.buffer.set(); UiRedactorFormat.removeFormat(this.$editor[0], 'woltlab-size'); diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSpoiler.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSpoiler.js index a9295967f3..658156572e 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSpoiler.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSpoiler.js @@ -3,7 +3,7 @@ $.Redactor.prototype.WoltLabSpoiler = function() { return { init: function() { - require(['WoltLab/WCF/Ui/Redactor/Spoiler'], (function (UiRedactorSpoiler) { + require(['WoltLabSuite/Core/Ui/Redactor/Spoiler'], (function (UiRedactorSpoiler) { new UiRedactorSpoiler(this); }).bind(this)); } diff --git a/wcfsetup/install/files/js/WCF.Like.js b/wcfsetup/install/files/js/WCF.Like.js index 50688cc15c..728d6cf691 100644 --- a/wcfsetup/install/files/js/WCF.Like.js +++ b/wcfsetup/install/files/js/WCF.Like.js @@ -7,7 +7,7 @@ * @copyright 2001-2015 WoltLab GmbH * @license GNU Lesser General Public License * - * @deprecated 3.0 - please use `WoltLab/WCF/Ui/Like/Handler` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Ui/Like/Handler` instead */ WCF.Like = Class.extend({ /** diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 2cd7b3d8d8..5131bb8121 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -479,7 +479,7 @@ WCF.Message.DefaultPreview = WCF.Message.Preview.extend({ * @see WCF.Message.Preview._handleResponse() */ _handleResponse: function(data) { - require(['WoltLab/WCF/Ui/Dialog'], (function(UiDialog) { + require(['WoltLabSuite/Core/Ui/Dialog'], (function(UiDialog) { UiDialog.open(this, '
    ' + data.returnValues.message + '
    '); }).bind(this)); }, @@ -729,7 +729,7 @@ WCF.Message.Smilies = Class.extend({ /** * Provides an inline message editor. * - * @deprecated 3.0 - please use `WoltLab/WCF/Ui/Message/InlineEditor` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Ui/Message/InlineEditor` instead * * @param integer containerID */ @@ -772,7 +772,7 @@ WCF.Message.InlineEditor = Class.extend({ * @param WCF.Message.Quote.Manager quoteManager */ init: function(containerID, supportExtendedForm, quoteManager) { - require(['WoltLab/WCF/Ui/Message/InlineEditor'], (function(UiMessageInlineEditor) { + require(['WoltLabSuite/Core/Ui/Message/InlineEditor'], (function(UiMessageInlineEditor) { new UiMessageInlineEditor({ className: this._getClassName(), containerId: containerID, @@ -795,7 +795,7 @@ WCF.Message.InlineEditor = Class.extend({ _click: function(event, containerID) { containerID = (event === null) ? ~~containerID : ~~elData(event.currentTarget, 'container-id'); - require(['WoltLab/WCF/Ui/Message/InlineEditor'], (function(UiMessageInlineEditor) { + require(['WoltLabSuite/Core/Ui/Message/InlineEditor'], (function(UiMessageInlineEditor) { UiMessageInlineEditor.legacyEdit(containerID); }).bind(this)); @@ -1690,7 +1690,7 @@ WCF.Message.Quote.Manager = Class.extend({ * Toggles the display of the 'Show quotes' button */ _toggleShowQuotes: function() { - require(['WoltLab/WCF/Ui/Page/Action'], (function(UiPageAction) { + require(['WoltLabSuite/Core/Ui/Page/Action'], (function(UiPageAction) { var buttonName = 'showQuotes'; if (this._count) { @@ -2118,11 +2118,11 @@ WCF.Message.Share.Content = Class.extend({ /** * Provides buttons to share a page through multiple social community sites. * - * @deprecated 3.0 - please use `WoltLab/WCF/Ui/Message/Share` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Ui/Message/Share` instead */ WCF.Message.Share.Page = Class.extend({ init: function() { - require(['WoltLab/WCF/Ui/Message/Share'], function(UiMessageShare) { + require(['WoltLabSuite/Core/Ui/Message/Share'], function(UiMessageShare) { UiMessageShare.init(); }); } diff --git a/wcfsetup/install/files/js/WCF.Poll.js b/wcfsetup/install/files/js/WCF.Poll.js index 9dc3d2ba98..62d3568414 100644 --- a/wcfsetup/install/files/js/WCF.Poll.js +++ b/wcfsetup/install/files/js/WCF.Poll.js @@ -263,7 +263,7 @@ WCF.Poll.Management = Class.extend({ }); // reset date picker - require(['WoltLab/WCF/Date/Picker'], (function(UiDatePicker) { + require(['WoltLabSuite/Core/Date/Picker'], (function(UiDatePicker) { UiDatePicker.clear('pollEndTime_' + this._editorId); }).bind(this)); }, diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 71b9b5b6ae..25e89a166b 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -742,7 +742,7 @@ $.extend(WCF, { }, /** - * @deprecated Use WoltLab/WCF/Core.getUuid(). + * @deprecated Use WoltLabSuite/Core/Core.getUuid(). */ getUUID: function() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { @@ -1277,7 +1277,7 @@ WCF.Dropdown.Interactive.Instance = Class.extend({ /** * Clipboard API * - * @deprecated 3.0 - please use `WoltLab/WCF/Controller/Clipboard` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Controller/Clipboard` instead */ WCF.Clipboard = { /** @@ -1289,7 +1289,7 @@ WCF.Clipboard = { * @param integer pageObjectID */ init: function(page, hasMarkedItems, actionObjects, pageObjectID) { - require(['WoltLab/WCF/Controller/Clipboard'], function(ControllerClipboard) { + require(['WoltLabSuite/Core/Controller/Clipboard'], function(ControllerClipboard) { ControllerClipboard.setup({ hasMarkedItems: (hasMarkedItems > 0), pageClassName: page, @@ -1302,14 +1302,14 @@ WCF.Clipboard = { * Reloads the list of marked items. */ reload: function() { - require(['WoltLab/WCF/Controller/Clipboard'], function(ControllerClipboard) { + require(['WoltLabSuite/Core/Controller/Clipboard'], function(ControllerClipboard) { ControllerClipboard.reload(); }); } }; /** - * @deprecated Use WoltLab/WCF/Timer/Repeating + * @deprecated Use WoltLabSuite/Core/Timer/Repeating */ WCF.PeriodicalExecuter = Class.extend({ /** @@ -1416,14 +1416,14 @@ WCF.PeriodicalExecuter = Class.extend({ /** * Handler for loading overlays * - * @deprecated 3.0 - Please use WoltLab/WCF/Ajax/Status + * @deprecated 3.0 - Please use WoltLabSuite/Core/Ajax/Status */ WCF.LoadingOverlayHandler = { /** * Adds one loading-request and shows the loading overlay if nessercery */ show: function() { - require(['WoltLab/WCF/Ajax/Status'], function(AjaxStatus) { + require(['WoltLabSuite/Core/Ajax/Status'], function(AjaxStatus) { AjaxStatus.show(); }); }, @@ -1432,7 +1432,7 @@ WCF.LoadingOverlayHandler = { * Removes one loading-request and hides loading overlay if there're no more pending requests */ hide: function() { - require(['WoltLab/WCF/Ajax/Status'], function(AjaxStatus) { + require(['WoltLabSuite/Core/Ajax/Status'], function(AjaxStatus) { AjaxStatus.hide(); }); }, @@ -1461,7 +1461,7 @@ WCF.Action = {}; /** * Basic implementation for AJAX-based proxyies * - * @deprecated 3.0 - please use `WoltLab/WCF/Ajax.api()` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Ajax.api()` instead * * @param object options */ @@ -2302,7 +2302,7 @@ WCF.Dictionary = Class.extend({ // non strict equals by intent if (window.WCF.Language == null) { /** - * @deprecated Use WoltLab/WCF/Language + * @deprecated Use WoltLabSuite/Core/Language */ WCF.Language = { add: function(key, value) { @@ -2649,7 +2649,7 @@ WCF.MultipleLanguageInput = Class.extend({ /** * Number utilities. - * @deprecated Use WoltLab/WCF/NumberUtil + * @deprecated Use WoltLabSuite/Core/NumberUtil */ WCF.Number = { /** @@ -2668,7 +2668,7 @@ WCF.Number = { /** * String utilities. - * @deprecated Use WoltLab/WCF/StringUtil + * @deprecated Use WoltLabSuite/Core/StringUtil */ WCF.String = { /** @@ -2762,7 +2762,7 @@ WCF.TabMenu = { * Initializes all TabMenus */ init: function() { - require(['WoltLab/WCF/Ui/TabMenu'], function(UiTabMenu) { + require(['WoltLabSuite/Core/Ui/TabMenu'], function(UiTabMenu) { UiTabMenu.setup(); }); }, @@ -3636,16 +3636,16 @@ WCF.CloseOverlayHandler = { }; /** - * @deprecated Use WoltLab/WCF/Dom/Change/Listener + * @deprecated Use WoltLabSuite/Core/Dom/Change/Listener */ WCF.DOMNodeInsertedHandler = { addCallback: function(identifier, callback) { - require(['WoltLab/WCF/Dom/Change/Listener'], function (ChangeListener) { + require(['WoltLabSuite/Core/Dom/Change/Listener'], function (ChangeListener) { ChangeListener.add('__legacy__', callback); }); }, _executeCallbacks: function() { - require(['WoltLab/WCF/Dom/Change/Listener'], function (ChangeListener) { + require(['WoltLabSuite/Core/Dom/Change/Listener'], function (ChangeListener) { ChangeListener.trigger(); }); }, @@ -4172,7 +4172,7 @@ WCF.Search = {}; /** * Performs a quick search. * - * @deprecated 3.0 - please use `WoltLab/WCF/Ui/Search/Input` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Ui/Search/Input` instead */ WCF.Search.Base = Class.extend({ /** @@ -4701,7 +4701,7 @@ WCF.Search.Base = Class.extend({ * Provides quick search for users and user groups. * * @see WCF.Search.Base - * @deprecated 3.0 - please use `WoltLab/WCF/Ui/User/Search/Input` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Ui/User/Search/Input` instead */ WCF.Search.User = WCF.Search.Base.extend({ /** @@ -4901,7 +4901,7 @@ WCF.System.FlexibleMenu = { * @param string containerID */ registerMenu: function(containerID) { - require(['WoltLab/WCF/Ui/FlexibleMenu'], function(UiFlexibleMenu) { + require(['WoltLabSuite/Core/Ui/FlexibleMenu'], function(UiFlexibleMenu) { UiFlexibleMenu.register(containerID); }); }, @@ -4912,7 +4912,7 @@ WCF.System.FlexibleMenu = { * @param string containerID */ rebuild: function(containerID) { - require(['WoltLab/WCF/Ui/FlexibleMenu'], function(UiFlexibleMenu) { + require(['WoltLabSuite/Core/Ui/FlexibleMenu'], function(UiFlexibleMenu) { UiFlexibleMenu.rebuild(containerID); }); } @@ -4973,7 +4973,7 @@ WCF.System.Captcha = { * @param function callback */ addCallback: function(captchaID, callback) { - require(['WoltLab/WCF/Controller/Captcha'], function(ControllerCaptcha) { + require(['WoltLabSuite/Core/Controller/Captcha'], function(ControllerCaptcha) { try { ControllerCaptcha.add(captchaID, callback); } @@ -4995,7 +4995,7 @@ WCF.System.Captcha = { */ getData: function(captchaID) { var returnValue; - require(['WoltLab/WCF/Controller/Captcha'], function(ControllerCaptcha) { + require(['WoltLabSuite/Core/Controller/Captcha'], function(ControllerCaptcha) { try { returnValue = ControllerCaptcha.getData(captchaID); } @@ -5011,7 +5011,7 @@ WCF.System.Captcha = { * Removes the callback with the given captcha id. */ removeCallback: function(captchaID) { - require(['WoltLab/WCF/Controller/Captcha'], function(ControllerCaptcha) { + require(['WoltLabSuite/Core/Controller/Captcha'], function(ControllerCaptcha) { try { ControllerCaptcha.delete(captchaID); } @@ -5287,11 +5287,11 @@ WCF.System.Fullscreen = { /** * Provides the 'jump to page' overlay. * - * @deprecated 3.0 - use `WoltLab/WCF/Ui/Page/JumpTo` instead + * @deprecated 3.0 - use `WoltLabSuite/Core/Ui/Page/JumpTo` instead */ WCF.System.PageNavigation = { init: function(selector, callback) { - require(['WoltLab/WCF/Ui/Page/JumpTo'], function(UiPageJumpTo) { + require(['WoltLabSuite/Core/Ui/Page/JumpTo'], function(UiPageJumpTo) { var elements = elBySelAll(selector); for (var i = 0, length = elements.length; i < length; i++) { UiPageJumpTo.init(elements[i], callback); @@ -5919,7 +5919,7 @@ WCF.InlineEditor = Class.extend({ /** * Default implementation for ajax file uploads. * - * @deprecated Use WoltLab/WCF/Upload + * @deprecated Use WoltLabSuite/Core/Upload * * @param jquery buttonSelector * @param jquery fileListSelector @@ -6297,7 +6297,7 @@ WCF.Upload = Class.extend({ /** * Default implementation for parallel AJAX file uploads. * - * @deprecated Use WoltLab/WCF/Upload + * @deprecated Use WoltLabSuite/Core/Upload */ WCF.Upload.Parallel = WCF.Upload.extend({ /** @@ -6705,7 +6705,7 @@ WCF.Popover = Class.extend({ this._activeElementID = ''; this._identifier = selector; - require(['WoltLab/WCF/Controller/Popover'], (function(popover) { + require(['WoltLabSuite/Core/Controller/Popover'], (function(popover) { popover.init({ attributeName: 'legacy', className: selector, @@ -7052,7 +7052,7 @@ WCF.EditableItemList = Class.extend({ * @param {function} callback function called after a language is selected * @param {boolean} allowEmptyValue true if no language may be selected * - * @deprecated 3.0 - please use `WoltLab/WCF/Language/Chooser` instead + * @deprecated 3.0 - please use `WoltLabSuite/Core/Language/Chooser` instead */ WCF.Language.Chooser = Class.extend({ /** @@ -7066,7 +7066,7 @@ WCF.Language.Chooser = Class.extend({ * @param {boolean} allowEmptyValue true if no language may be selected */ init: function(containerId, chooserId, languageId, languages, callback, allowEmptyValue) { - require(['WoltLab/WCF/Language/Chooser'], function(LanguageChooser) { + require(['WoltLabSuite/Core/Language/Chooser'], function(LanguageChooser) { LanguageChooser.init(containerId, chooserId, languageId, languages, callback, allowEmptyValue); }); } @@ -7548,7 +7548,7 @@ jQuery.fn.extend({ wcfTabs: function(method) { var element = this[0], parameters = Array.prototype.slice.call(arguments, 1); - require(['Dom/Util', 'WoltLab/WCF/Ui/TabMenu'], function(DomUtil, TabMenu) { + require(['Dom/Util', 'WoltLabSuite/Core/Ui/TabMenu'], function(DomUtil, TabMenu) { var container = TabMenu.getTabMenu(DomUtil.identify(element)); if (container !== null) { container[method].apply(container, parameters); @@ -7560,7 +7560,7 @@ jQuery.fn.extend({ /** * jQuery widget implementation of the wcf pagination. * - * @deprecated 3.0 - use `WoltLab/WCF/Ui/Pagination` instead + * @deprecated 3.0 - use `WoltLabSuite/Core/Ui/Pagination` instead */ $.widget('ui.wcfPages', { _api: null, @@ -7578,7 +7578,7 @@ $.widget('ui.wcfPages', { * Creates the pages widget. */ _create: function() { - require(['WoltLab/WCF/Ui/Pagination'], (function(UiPagination) { + require(['WoltLabSuite/Core/Ui/Pagination'], (function(UiPagination) { this._api = new UiPagination(this.element[0], { activePage: this.options.activePage, maxPage: this.options.maxPage, diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Bootstrap.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Bootstrap.js deleted file mode 100644 index 7cf435c317..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Bootstrap.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Bootstraps WCF's JavaScript with additions for the ACP usage. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Bootstrap - */ -define(['Core', 'WoltLab/WCF/Bootstrap', './Ui/Page/Menu'], function(Core, Bootstrap, UiPageMenu) { - "use strict"; - - /** - * @exports WoltLab/WCF/Acp/Bootstrap - */ - return { - /** - * Bootstraps general modules and frontend exclusive ones. - * - * @param {Object=} options bootstrap options - */ - setup: function(options) { - options = Core.extend({ - bootstrap: { - enableMobileMenu: true - } - }, options); - - Bootstrap.setup(options.bootstrap); - UiPageMenu.init(); - } - }; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Article/Add.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Article/Add.js deleted file mode 100644 index fda2a2eac3..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Article/Add.js +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Provides the dialog overlay to add a new article. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Article/Add - */ -define(['Core', 'Language', 'Ui/Dialog'], function(Core, Language, UiDialog) { - "use strict"; - - var _link; - - /** - * @exports WoltLab/WCF/Acp/Ui/Article/Add - */ - return { - /** - * Initializes the article add handler. - * - * @param {string} link redirect URL - */ - init: function(link) { - _link = link; - - var buttons = elBySelAll('.jsButtonArticleAdd'); - for (var i = 0, length = buttons.length; i < length; i++) { - buttons[i].addEventListener(WCF_CLICK_EVENT, this.openDialog.bind(this)); - } - }, - - /** - * Opens the 'Add Article' dialog. - * - * @param {Event=} event event object - */ - openDialog: function(event) { - if (event instanceof Event) { - event.preventDefault(); - } - - UiDialog.open(this); - }, - - _dialogSetup: function() { - return { - id: 'articleAddDialog', - options: { - onSetup: function(content) { - elBySel('button', content).addEventListener(WCF_CLICK_EVENT, function(event) { - event.preventDefault(); - - var isMultilingual = elBySel('input[name="isMultilingual"]:checked', content).value; - - window.location = _link.replace(/{\$isMultilingual}/, isMultilingual); - }); - }, - title: Language.get('wcf.acp.article.add') - } - }; - } - }; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Add.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Add.js deleted file mode 100644 index a949633037..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Add.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Provides the dialog overlay to add a new box. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Box/Add - */ -define(['Core', 'Language', 'Ui/Dialog'], function(Core, Language, UiDialog) { - "use strict"; - - var _link; - - /** - * @exports WoltLab/WCF/Acp/Ui/Box/Add - */ - return { - /** - * Initializes the box add handler. - * - * @param {string} link redirect URL - */ - init: function(link) { - _link = link; - - var buttons = elBySelAll('.jsButtonBoxAdd'); - for (var i = 0, length = buttons.length; i < length; i++) { - buttons[i].addEventListener(WCF_CLICK_EVENT, this.openDialog.bind(this)); - } - }, - - /** - * Opens the 'Add Box' dialog. - * - * @param {Event=} event event object - */ - openDialog: function(event) { - if (event instanceof Event) { - event.preventDefault(); - } - - UiDialog.open(this); - }, - - _dialogSetup: function() { - return { - id: 'boxAddDialog', - options: { - onSetup: function(content) { - elBySel('button', content).addEventListener(WCF_CLICK_EVENT, function(event) { - event.preventDefault(); - - var boxType = elBySel('input[name="boxType"]:checked', content).value; - var isMultilingual = 0; - if (boxType !== 'system') isMultilingual = elBySel('input[name="isMultilingual"]:checked', content).value; - - window.location = _link.replace(/{\$boxType}/, boxType).replace(/{\$isMultilingual}/, isMultilingual); - }); - - elBySelAll('input[type="radio"][name="boxType"]', content, function(element) { - element.addEventListener('change', function(event) { - elBySelAll('input[type="radio"][name="isMultilingual"]', content, function(element) { - element.disabled = (event.currentTarget.value === 'system'); - }); - }); - }); - }, - title: Language.get('wcf.acp.box.add') - } - }; - } - }; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Controller/Handler.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Controller/Handler.js deleted file mode 100644 index d62bbc6cd0..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Controller/Handler.js +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Provides the interface logic to add and edit menu items. - * - * @author Matthias Schmidt - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Box/Controller/Handler - */ -define(['Ajax', 'Dictionary'], function(Ajax, Dictionary) { - "use strict"; - - var _boxControllerContainer = elById('boxControllerContainer'); - var _boxController = elById('boxControllerID'); - var _boxConditions = elById('boxConditions'); - var _templates = new Dictionary(); - - /** - * @exports WoltLab/WCF/Acp/Ui/Box/Controller/Handler - */ - return { - init: function(initialObjectTypeId) { - _boxController.addEventListener('change', this._updateConditions.bind(this)); - - if (initialObjectTypeId) { - _templates.set(~~initialObjectTypeId, _boxConditions.innerHTML); - } - - elShow(_boxControllerContainer); - - this._updateConditions(); - }, - - /** - * Sets up ajax request object. - * - * @return {object} request options - */ - _ajaxSetup: function() { - return { - data: { - actionName: 'getBoxConditionsTemplate', - className: 'wcf\\data\\box\\BoxAction' - } - }; - }, - - /** - * Handles successful AJAX requests. - * - * @param {object} data response data - */ - _ajaxSuccess: function(data) { - _templates.set(~~data.returnValues.objectTypeID, data.returnValues.template); - - _boxConditions.innerHTML = data.returnValues.template; - }, - - /** - * Updates the displayed box conditions based on the selected dynamic box controller. - * - * @protected - */ - _updateConditions: function() { - var objectTypeId = ~~_boxController.value; - - if (_templates.has(objectTypeId)) { - if (_templates.get(objectTypeId) !== null) { - _boxConditions.innerHTML = _templates.get(objectTypeId); - } - } - else { - _templates.set(objectTypeId, null); - - Ajax.api(this, { - parameters: { - objectTypeID: objectTypeId - } - }); - } - } - }; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Handler.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Handler.js deleted file mode 100644 index 14297e5852..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Box/Handler.js +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Provides the interface logic to add and edit boxes. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Box/Handler - */ -define(['Dictionary', 'WoltLab/Wcf/Ui/Page/Search/Handler'], function(Dictionary, UiPageSearchHandler) { - "use strict"; - - var _activePageId = 0; - var _boxController; - var _cache; - var _containerExternalLink; - var _containerPageID; - var _containerPageObjectId = null; - var _handlers; - var _pageId; - var _pageObjectId; - var _position; - - /** - * @exports WoltLab/WCF/Acp/Ui/Box/Handler - */ - return { - /** - * Initializes the interface logic. - * - * @param {Dictionary} handlers list of handlers by page id supporting page object ids - */ - init: function(handlers) { - _handlers = handlers; - - _boxController = elById('boxControllerID'); - - _containerPageID = elById('linkPageIDContainer'); - _containerExternalLink = elById('externalURLContainer'); - _containerPageObjectId = elById('linkPageObjectIDContainer'); - - if (_handlers.size) { - _pageId = elById('linkPageID'); - _pageId.addEventListener('change', this._togglePageId.bind(this)); - - _pageObjectId = elById('linkPageObjectID'); - - _cache = new Dictionary(); - _activePageId = ~~_pageId.value; - if (_activePageId && _handlers.has(_activePageId)) { - _cache.set(_activePageId, ~~_pageObjectId.value); - } - - elById('searchLinkPageObjectID').addEventListener(WCF_CLICK_EVENT, this._openSearch.bind(this)); - - // toggle page object id container on init - if (_handlers.has(~~_pageId.value)) { - elShow(_containerPageObjectId); - } - } - - elBySelAll('input[name="linkType"]', null, (function(input) { - input.addEventListener('change', this._toggleLinkType.bind(this, input.value)); - - if (input.checked) { - this._toggleLinkType(input.value); - } - }).bind(this)); - - if (_boxController !== null) { - _position = elById('position'); - _boxController.addEventListener('change', this._setAvailableBoxPositions.bind(this)); - - // update positions on init - this._setAvailableBoxPositions(); - } - }, - - /** - * Toggles between the interface for internal and external links. - * - * @param {string} value selected option value - * @protected - */ - _toggleLinkType: function(value) { - if (value == 'none') { - elHide(_containerPageID); - elHide(_containerPageObjectId); - elHide(_containerExternalLink); - } - if (value == 'internal') { - elShow(_containerPageID); - elHide(_containerExternalLink); - if (_handlers.size) this._togglePageId(); - } - if (value == 'external') { - elHide(_containerPageID); - elHide(_containerPageObjectId); - elShow(_containerExternalLink); - } - }, - - /** - * Handles the changed page selection. - * - * @protected - */ - _togglePageId: function() { - if (_handlers.has(_activePageId)) { - _cache.set(_activePageId, ~~_pageObjectId.value); - } - - _activePageId = ~~_pageId.value; - - // page w/o pageObjectID support, discard value - if (!_handlers.has(_activePageId)) { - _pageObjectId.value = ''; - - elHide(_containerPageObjectId); - - return; - } - - var newValue = ~~_cache.get(_activePageId); - _pageObjectId.value = (newValue) ? newValue : ''; - - elShow(_containerPageObjectId); - }, - - /** - * Opens the handler lookup dialog. - * - * @param {Event} event event object - * @protected - */ - _openSearch: function(event) { - event.preventDefault(); - - UiPageSearchHandler.open(_activePageId, _pageId.options[_pageId.selectedIndex].textContent.trim(), function(objectId) { - _pageObjectId.value = objectId; - _cache.set(_activePageId, objectId); - }); - }, - - /** - * Updates the available box positions per box controller. - * - * @protected - */ - _setAvailableBoxPositions: function() { - var supportedPositions = JSON.parse(elData(_boxController.options[_boxController.selectedIndex], 'supported-positions')); - - var option; - for (var i = 0, length = _position.childElementCount; i < length; i++) { - option = _position.children[i]; - - option.disabled = (supportedPositions.indexOf(option.value) === -1); - } - } - }; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/CodeMirror/Media.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/CodeMirror/Media.js deleted file mode 100644 index 4aa3759e2e..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/CodeMirror/Media.js +++ /dev/null @@ -1,41 +0,0 @@ -define(['WoltLab/WCF/Media/Manager/Editor'], function(MediaManagerEditor) { - "use strict"; - - function AcpUiCodeMirrorMedia(elementId) { this.init(elementId); } - AcpUiCodeMirrorMedia.prototype = { - init: function(elementId) { - this._element = elById(elementId); - - var button = elById('codemirror-' + elementId + '-media'); - button.classList.add(button.id); - - new MediaManagerEditor({ - buttonClass: button.id, - callbackInsert: this._insert.bind(this), - editor: null - }); - }, - - _insert: function (mediaList, insertType, thumbnailSize) { - var content = ''; - - if (insertType === 'gallery') { - var mediaIds = []; - mediaList.forEach(function(item) { - mediaIds.push(item.mediaID); - }); - - content = '{{ mediaGallery="' + mediaIds.join(',') + '" }}'; - } - else { - mediaList.forEach(function(item) { - content += '{{ media="' + item.mediaID + '" size="' + thumbnailSize + '" }}'; - }); - } - - this._element.codemirror.replaceSelection(content); - } - }; - - return AcpUiCodeMirrorMedia; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/CodeMirror/Page.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/CodeMirror/Page.js deleted file mode 100644 index 2c6f4f5f99..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/CodeMirror/Page.js +++ /dev/null @@ -1,24 +0,0 @@ -define(['WoltLab/WCF/Ui/Page/Search'], function(UiPageSearch) { - "use strict"; - - function AcpUiCodeMirrorPage(elementId) { this.init(elementId); } - AcpUiCodeMirrorPage.prototype = { - init: function(elementId) { - this._element = elById(elementId); - - elById('codemirror-' + elementId + '-page').addEventListener(WCF_CLICK_EVENT, this._click.bind(this)); - }, - - _click: function (event) { - event.preventDefault(); - - UiPageSearch.open(this._insert.bind(this)); - }, - - _insert: function (pageID) { - this._element.codemirror.replaceSelection('{{ page="' + pageID + '" }}'); - } - }; - - return AcpUiCodeMirrorPage; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Menu/Item/Handler.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Menu/Item/Handler.js deleted file mode 100644 index eccf34dcaa..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Menu/Item/Handler.js +++ /dev/null @@ -1,127 +0,0 @@ -/** - * Provides the interface logic to add and edit menu items. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Menu/Item/Handler - */ -define(['Dictionary', 'WoltLab/Wcf/Ui/Page/Search/Handler'], function(Dictionary, UiPageSearchHandler) { - "use strict"; - - var _activePageId = 0; - var _cache; - var _containerExternalLink; - var _containerInternalLink; - var _containerPageObjectId = null; - var _handlers; - var _pageId; - var _pageObjectId; - - /** - * @exports WoltLab/WCF/Acp/Ui/Menu/Item/Handler - */ - return { - /** - * Initializes the interface logic. - * - * @param {Dictionary} handlers list of handlers by page id supporting page object ids - */ - init: function(handlers) { - _handlers = handlers; - - _containerInternalLink = elById('pageIDContainer'); - _containerExternalLink = elById('externalURLContainer'); - _containerPageObjectId = elById('pageObjectIDContainer'); - - if (_handlers.size) { - _pageId = elById('pageID'); - _pageId.addEventListener('change', this._togglePageId.bind(this)); - - _pageObjectId = elById('pageObjectID'); - - _cache = new Dictionary(); - _activePageId = ~~_pageId.value; - if (_activePageId && _handlers.has(_activePageId)) { - _cache.set(_activePageId, ~~_pageObjectId.value); - } - - elById('searchPageObjectID').addEventListener(WCF_CLICK_EVENT, this._openSearch.bind(this)); - - // toggle page object id container on init - if (_handlers.has(~~_pageId.value)) { - elShow(_containerPageObjectId); - } - } - - elBySelAll('input[name="isInternalLink"]', null, (function(input) { - input.addEventListener('change', this._toggleIsInternalLink.bind(this, input.value)); - - if (input.checked) { - this._toggleIsInternalLink(input.value); - } - }).bind(this)); - }, - - /** - * Toggles between the interface for internal and external links. - * - * @param {string} value selected option value - * @protected - */ - _toggleIsInternalLink: function(value) { - if (~~value) { - elShow(_containerInternalLink); - elHide(_containerExternalLink); - if (_handlers.size) this._togglePageId(); - } - else { - elHide(_containerInternalLink); - elHide(_containerPageObjectId); - elShow(_containerExternalLink); - } - }, - - /** - * Handles the changed page selection. - * - * @protected - */ - _togglePageId: function() { - if (_handlers.has(_activePageId)) { - _cache.set(_activePageId, ~~_pageObjectId.value); - } - - _activePageId = ~~_pageId.value; - - // page w/o pageObjectID support, discard value - if (!_handlers.has(_activePageId)) { - _pageObjectId.value = ''; - - elHide(_containerPageObjectId); - - return; - } - - var newValue = ~~_cache.get(_activePageId); - _pageObjectId.value = (newValue) ? newValue : ''; - - elShow(_containerPageObjectId); - }, - - /** - * Opens the handler lookup dialog. - * - * @param {Event} event event object - * @protected - */ - _openSearch: function(event) { - event.preventDefault(); - - UiPageSearchHandler.open(_activePageId, _pageId.options[_pageId.selectedIndex].textContent.trim(), function(objectId) { - _pageObjectId.value = objectId; - _cache.set(_activePageId, objectId); - }); - } - }; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Page/Add.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Page/Add.js deleted file mode 100644 index cbdc4719e0..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Page/Add.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * Provides the dialog overlay to add a new page. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Page/Add - */ -define(['Core', 'Language', 'Ui/Dialog'], function(Core, Language, UiDialog) { - "use strict"; - - var _languages, _link; - - /** - * @exports WoltLab/WCF/Acp/Ui/Page/Add - */ - return { - /** - * Initializes the page add handler. - * - * @param {string} link redirect URL - * @param {int} languages number of available languages - */ - init: function(link, languages) { - _languages = languages; - _link = link; - - var buttons = elBySelAll('.jsButtonPageAdd'); - for (var i = 0, length = buttons.length; i < length; i++) { - buttons[i].addEventListener(WCF_CLICK_EVENT, this.openDialog.bind(this)); - } - }, - - /** - * Opens the 'Add Page' dialog. - * - * @param {Event=} event event object - */ - openDialog: function(event) { - if (event instanceof Event) { - event.preventDefault(); - } - - UiDialog.open(this); - }, - - _dialogSetup: function() { - return { - id: 'pageAddDialog', - options: { - onSetup: function(content) { - elBySel('button', content).addEventListener(WCF_CLICK_EVENT, function(event) { - event.preventDefault(); - - var pageType = elBySel('input[name="pageType"]:checked', content).value; - var isMultilingual = (_languages > 1) ? elBySel('input[name="isMultilingual"]:checked', content).value : 0; - - window.location = _link.replace(/{\$pageType}/, pageType).replace(/{\$isMultilingual}/, isMultilingual); - }); - }, - title: Language.get('wcf.acp.page.add') - } - }; - } - }; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Page/Menu.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Page/Menu.js deleted file mode 100644 index 9811aebf3f..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Page/Menu.js +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Provides the ACP menu navigation. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Page/Menu - */ -define(['Dictionary'], function(Dictionary) { - "use strict"; - - var _activeMenuItem = ''; - var _menuItems = new Dictionary(); - var _menuItemContainers = new Dictionary(); - - /** - * @exports WoltLab/WCF/Acp/Ui/Page/Menu - */ - return { - /** - * Initializes the ACP menu navigation. - */ - init: function() { - elBySelAll('.acpPageMenuLink', null, (function(link) { - var menuItem = elData(link, 'menu-item'); - if (link.classList.contains('active')) { - _activeMenuItem = menuItem; - } - - link.addEventListener(WCF_CLICK_EVENT, this._toggle.bind(this)); - - _menuItems.set(menuItem, link); - }).bind(this)); - - elBySelAll('.acpPageSubMenuCategoryList', null, function(container) { - _menuItemContainers.set(elData(container, 'menu-item'), container); - }); - }, - - /** - * Toggles a menu item. - * - * @param {Event} event event object - * @protected - */ - _toggle: function(event) { - event.preventDefault(); - event.stopPropagation(); - - var link = event.currentTarget; - var menuItem = elData(link, 'menu-item'); - - // remove active marking from currently active menu - if (_activeMenuItem) { - _menuItems.get(_activeMenuItem).classList.remove('active'); - _menuItemContainers.get(_activeMenuItem).classList.remove('active'); - } - - if (_activeMenuItem === menuItem) { - // current item was active before - _activeMenuItem = ''; - } - else { - link.classList.add('active'); - _menuItemContainers.get(menuItem).classList.add('active'); - - _activeMenuItem = menuItem; - } - } - }; -}); 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 deleted file mode 100644 index a78f4a2f10..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Editor.js +++ /dev/null @@ -1,269 +0,0 @@ -/** - * Provides the style editor. - * - * @author Alexander Ebert - * @copyright 2001-2016 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Style/Editor - */ -define(['Ajax', 'Dictionary', 'Dom/Util', 'EventHandler'], function(Ajax, Dictionary, DomUtil, EventHandler) { - "use strict"; - - var _stylePreviewRegions = new Dictionary(); - var _stylePreviewRegionMarker = null; - - /** - * @module WoltLab/WCF/Acp/Ui/Style/Editor - */ - var AcpUiStyleEditor = { - /** - * Sets up dynamic style options. - */ - setup: function(options) { - this._handleLayoutWidth(); - this._handleScss(options.isTainted); - - if (!options.isTainted) { - this._handleProtection(options.styleId); - } - - this._initVisualEditor(options.styleRuleMap); - }, - - /** - * Handles the switch between static and fluid layout. - */ - _handleLayoutWidth: function() { - var useFluidLayout = elById('useFluidLayout'); - var fluidLayoutMinWidth = elById('fluidLayoutMinWidth'); - var fluidLayoutMaxWidth = elById('fluidLayoutMaxWidth'); - var fixedLayoutVariables = elById('fixedLayoutVariables'); - - function change() { - var checked = useFluidLayout.checked; - - fluidLayoutMinWidth.style[(checked ? 'remove' : 'set') + 'Property']('display', 'none'); - fluidLayoutMaxWidth.style[(checked ? 'remove' : 'set') + 'Property']('display', 'none'); - fixedLayoutVariables.style[(checked ? 'set' : 'remove') + 'Property']('display', 'none'); - } - - useFluidLayout.addEventListener('change', change); - - change(); - }, - - /** - * Handles SCSS input fields. - * - * @param {boolean} isTainted false if style is in protected mode - */ - _handleScss: function(isTainted) { - var individualScss = elById('individualScss'); - var overrideScss = elById('overrideScss'); - - if (isTainted) { - EventHandler.add('com.woltlab.wcf.simpleTabMenu_styleTabMenuContainer', 'select', function(data) { - individualScss.codemirror.refresh(); - overrideScss.codemirror.refresh(); - }); - } - else { - EventHandler.add('com.woltlab.wcf.simpleTabMenu_advanced', 'select', function(data) { - if (data.activeName === 'advanced-custom') { - elById('individualScssCustom').codemirror.refresh(); - elById('overrideScssCustom').codemirror.refresh(); - } - else if (data.activeName === 'advanced-original') { - individualScss.codemirror.refresh(); - overrideScss.codemirror.refresh(); - } - }); - } - }, - - _handleProtection: function(styleId) { - var button = elById('styleDisableProtectionSubmit'); - var checkbox = elById('styleDisableProtectionConfirm'); - - checkbox.addEventListener('change', function() { - button.disabled = !checkbox.checked; - }); - - button.addEventListener(WCF_CLICK_EVENT, function() { - Ajax.apiOnce({ - data: { - actionName: 'markAsTainted', - className: 'wcf\\data\\style\\StyleAction', - objectIDs: [styleId] - }, - success: function() { - window.location.reload(); - } - }); - }); - }, - - _initVisualEditor: function(styleRuleMap) { - var regions = elBySelAll('#spWindow [data-region]'); - for (var i = 0, length = regions.length; i < length; i++) { - _stylePreviewRegions.set(elData(regions[i], 'region'), regions[i]); - } - - _stylePreviewRegionMarker = elCreate('div'); - _stylePreviewRegionMarker.id = 'stylePreviewRegionMarker'; - _stylePreviewRegionMarker.innerHTML = '
    '; - elHide(_stylePreviewRegionMarker); - elById('colors').appendChild(_stylePreviewRegionMarker); - - var container = elById('spSidebar'); - var select = elById('spCategories'); - var lastValue = select.value; - - function updateRegionMarker() { - if (lastValue === 'none') { - elHide(_stylePreviewRegionMarker); - updateWrapperPosition(null); - scrollToRegion(null); - return; - } - - var region = _stylePreviewRegions.get(lastValue); - var rect = region.getBoundingClientRect(); - - var top = rect.top + window.scrollY; - - DomUtil.setStyles(_stylePreviewRegionMarker, { - height: (region.clientHeight + 20) + 'px', - left: (rect.left + document.body.scrollLeft - 10) + 'px', - top: (top - 10) + 'px', - width: (region.clientWidth + 20) + 'px' - }); - - elShow(_stylePreviewRegionMarker); - - updateWrapperPosition(region); - scrollToRegion(top); - } - - var variablesWrapper = elById('spVariablesWrapper'); - function updateWrapperPosition(region) { - var fromTop = 0; - if (region !== null) { - fromTop = (region.offsetTop - variablesWrapper.offsetTop) - 10; - - var styles = window.getComputedStyle(region); - if (styles.getPropertyValue('position') === 'absolute' || styles.getPropertyValue('position') === 'relative') { - fromTop += region.offsetParent.offsetTop; - } - } - - if (fromTop <= 0) { - variablesWrapper.style.removeProperty('transform'); - } - else { - // ensure that the wrapper does not exceed the bottom boundary - var maxHeight = variablesWrapper.parentNode.clientHeight; - var wrapperHeight = variablesWrapper.clientHeight; - if (wrapperHeight + fromTop > maxHeight) { - fromTop = maxHeight - wrapperHeight; - } - - variablesWrapper.style.setProperty('transform', 'translateY(' + fromTop + 'px)'); - } - } - - var pageHeader = elById('pageHeader'); - function scrollToRegion(top) { - if (top === null) { - top = variablesWrapper.offsetTop - 60; - } - else { - // use the region marker as an offset - top -= 60; - } - - // account for sticky header - top -= 60; - - window.scrollTo(0, top); - } - - var selectContainer = elBySel('.spSidebarBox:first-child'); - var element; - select.addEventListener('change', function() { - element = elBySel('.spSidebarBox[data-category="' + lastValue + '"]', container); - elHide(element); - - lastValue = select.value; - element = elBySel('.spSidebarBox[data-category="' + lastValue + '"]', container); - elShow(element); - - // set region marker - updateRegionMarker(); - - selectContainer.classList[(lastValue === 'none' ? 'remove' : 'add')]('pointer'); - }); - - - // apply CSS rules - var style = elCreate('style'); - style.appendChild(document.createTextNode('')); - elData(style, 'created-by', 'WoltLab/Acp/Ui/Style/Editor'); - document.head.appendChild(style); - - function updateCSSRule(identifier, value, isInit) { - if (styleRuleMap[identifier] === undefined) { - console.debug("Unknown style identifier: " + identifier); - return; - } - - var rule = styleRuleMap[identifier].replace(/VALUE/g, value + ' !important'); - if (!rule) { - console.debug("Invalid style rule for " + identifier); - return; - } - - var rules = []; - if (rule.indexOf('__COMBO_RULE__')) { - rules = rule.split('__COMBO_RULE__'); - } - else { - rules = [rule]; - } - - for (var i = 0, length = rules.length; i < length; i++) { - try { - style.sheet.insertRule(rules[i], style.sheet.cssRules.length); - } - catch (e) { - // ignore errors for unknown placeholder selectors - if (!/[a-z]+\-placeholder/.test(rules[i])) { - console.debug(e.message); - } - } - } - } - - var elements = elByClass('styleVariableColor', variablesWrapper); - [].forEach.call(elements, function(colorField) { - var variableName = elData(colorField, 'store').replace(/_value$/, ''); - - var observer = new MutationObserver(function(mutations) { - mutations.forEach(function(mutation) { - if (mutation.attributeName === 'style') { - updateCSSRule(variableName, colorField.style.getPropertyValue('background-color')); - } - }); - }); - - observer.observe(colorField, { - attributes: true - }); - - updateCSSRule(variableName, colorField.style.getPropertyValue('background-color')); - }); - } - }; - - return AcpUiStyleEditor; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Image/Upload.js b/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Image/Upload.js deleted file mode 100644 index 955eef1feb..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Acp/Ui/Style/Image/Upload.js +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Handles uploading style preview images. - * - * @author Matthias Schmidt - * @copyright 2001-2015 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Acp/Ui/Style/Image/Upload - */ -define(['Core', 'Dom/Traverse', 'Language', 'Ui/Notification', 'Upload'], function(Core, DomTraverse, Language, UiNotification, Upload) { - "use strict"; - - /** - * @constructor - */ - function AcpUiStyleImageUpload(styleId, tmpHash) { - this._styleId = ~~styleId; - this._tmpHash = tmpHash; - - Upload.call(this, 'uploadImage', 'styleImage', { - className: 'wcf\\data\\style\\StyleAction' - }); - } - Core.inherit(AcpUiStyleImageUpload, Upload, { - /** - * @see WoltLab/WCF/Upload#_createFileElement - */ - _createFileElement: function(file) { - return this._target; - }, - - /** - * @see WoltLab/WCF/Upload#_getParameters - */ - _getParameters: function() { - return { - styleId: this._styleId, - tmpHash: this._tmpHash - }; - }, - - /** - * @see WoltLab/WCF/Upload#_success - */ - _success: function(uploadId, data) { - var error = DomTraverse.childByClass(this._button.parentNode, 'innerError'); - if (data.returnValues.url) { - elAttr(this._target, 'src', data.returnValues.url + '?timestamp=' + Date.now()); - - if (error) { - elRemove(error); - } - - UiNotification.show(); - } - else if (data.returnValues.errorType) { - if (!error) { - error = elCreate('small'); - error.className = 'innerError'; - - this._button.parentNode.appendChild(error); - } - - error.textContent = Language.get('wcf.acp.style.image.error.' + data.returnValues.errorType); - } - } - }); - - return AcpUiStyleImageUpload; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ajax.js b/wcfsetup/install/files/js/WoltLab/WCF/Ajax.js deleted file mode 100644 index 3703f45e3e..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ajax.js +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Handles AJAX requests. - * - * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Ajax - */ -define(['AjaxRequest', 'Core', 'ObjectMap'], function(AjaxRequest, Core, ObjectMap) { - "use strict"; - - var _requests = new ObjectMap(); - - /** - * @exports WoltLab/WCF/Ajax - */ - var Ajax = { - /** - * Shorthand function to perform a request against the WCF-API with overrides - * for success and failure callbacks. - * - * @param {object} callbackObject callback object - * @param {object=} data request data - * @param {function=} success success callback - * @param {function=} failure failure callback - * @return {AjaxRequest} - */ - api: function(callbackObject, data, success, failure) { - if (typeof data !== 'object') data = {}; - - var request = _requests.get(callbackObject); - if (request === undefined) { - if (typeof callbackObject._ajaxSetup !== 'function') { - throw new TypeError("Callback object must implement at least _ajaxSetup()."); - } - - var options = callbackObject._ajaxSetup(); - - options.pinData = true; - options.callbackObject = callbackObject; - - if (!options.url) options.url = 'index.php/AJAXProxy/?t=' + SECURITY_TOKEN; - - request = new AjaxRequest(options); - - _requests.set(callbackObject, request); - } - - var oldSuccess = null; - var oldFailure = null; - - if (typeof success === 'function') { - oldSuccess = request.getOption('success'); - request.setOption('success', success); - } - if (typeof failure === 'function') { - oldFailure = request.getOption('failure'); - request.setOption('failure', failure); - } - - request.setData(data); - request.sendRequest(); - - // restore callbacks - if (oldSuccess !== null) request.setOption('success', oldSuccess); - if (oldFailure !== null) request.setOption('failure', oldFailure); - - return request; - }, - - /** - * Shorthand function to perform a single request against the WCF-API. - * - * Please use `Ajax.api` if you're about to repeatedly send requests because this - * method will spawn an new and rather expensive `AjaxRequest` with each call. - * - * @param {object} options request options - */ - apiOnce: function(options) { - // Fetch AjaxRequest, as it cannot be provided because of a circular dependency - if (AjaxRequest === undefined) AjaxRequest = require('AjaxRequest'); - - options.pinData = false; - options.callbackObject = null; - if (!options.url) options.url = 'index.php/AJAXProxy/?t=' + SECURITY_TOKEN; - - var request = new AjaxRequest(options); - request.sendRequest(); - } - }; - - return Ajax; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Jsonp.js b/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Jsonp.js deleted file mode 100644 index df8efb161c..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Jsonp.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Provides a utility class to issue JSONP requests. - * - * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Ajax/Jsonp - */ -define(['Core'], function(Core) { - "use strict"; - - /** - * @exports WoltLab/WCF/Ajax/Jsonp - */ - var AjaxJsonp = { - /** - * Issues a JSONP request. - * - * @param {string} url source URL, must not contain callback parameter - * @param {function} success success callback - * @param {function=} failure timeout callback - * @param {object=} options request options - */ - send: function(url, success, failure, options) { - url = (typeof url === 'string') ? url.trim() : ''; - if (url.length === 0) { - throw new Error("Expected a non-empty string for parameter 'url'."); - } - - if (typeof success !== 'function') { - throw new TypeError("Expected a valid callback function for parameter 'success'."); - } - - options = Core.extend({ - parameterName: 'callback', - timeout: 10 - }, options || {}); - - var callbackName = 'wcf_jsonp_' + Core.getUuid().replace(/-/g, '').substr(0, 8); - - var timeout = window.setTimeout(function() { - window[callbackName] = function() {}; - - if (typeof failure === 'function') { - failure(); - } - }, (~~options.timeout || 10) * 1000); - - window[callbackName] = function() { - window.clearTimeout(timeout); - - success.apply(null, arguments); - }; - - url += (url.indexOf('?') === -1) ? '?' : '&'; - url += options.parameterName + '=' + callbackName; - - var script = elCreate('script'); - script.async = true; - elAttr(script, 'src', url); - - document.head.appendChild(script); - } - }; - - return AjaxJsonp; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js b/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js deleted file mode 100644 index ccb4e19eaa..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Request.js +++ /dev/null @@ -1,324 +0,0 @@ -/** - * Versatile AJAX request handling. - * - * In case you want to issue JSONP requests, please use `AjaxJsonp` instead. - * - * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Ajax/Request - */ -define(['Core', 'Language', 'Dom/ChangeListener', 'Dom/Util', 'Ui/Dialog', 'WoltLab/WCF/Ajax/Status'], function(Core, Language, DomChangeListener, DomUtil, UiDialog, AjaxStatus) { - "use strict"; - - var _didInit = false; - var _ignoreAllErrors = false; - - /** - * @constructor - */ - function AjaxRequest(options) { - this._data = null; - this._options = {}; - this._previousXhr = null; - this._xhr = null; - - this._init(options); - } - AjaxRequest.prototype = { - /** - * Initializes the request options. - * - * @param {Object} options request options - */ - _init: function(options) { - this._options = Core.extend({ - // request data - data: {}, - contentType: 'application/x-www-form-urlencoded; charset=UTF-8', - responseType: 'application/json', - type: 'POST', - url: '', - - // behavior - autoAbort: false, - ignoreError: false, - pinData: false, - silent: false, - - // callbacks - failure: null, - finalize: null, - success: null, - progress: null, - uploadProgress: null, - - callbackObject: null - }, options); - - if (typeof options.callbackObject === 'object') { - this._options.callbackObject = options.callbackObject; - } - - this._options.url = Core.convertLegacyUrl(this._options.url); - - if (this._options.pinData) { - this._data = Core.extend({}, this._options.data); - } - - if (this._options.callbackObject !== null) { - if (typeof this._options.callbackObject._ajaxFailure === 'function') this._options.failure = this._options.callbackObject._ajaxFailure.bind(this._options.callbackObject); - if (typeof this._options.callbackObject._ajaxFinalize === 'function') this._options.finalize = this._options.callbackObject._ajaxFinalize.bind(this._options.callbackObject); - if (typeof this._options.callbackObject._ajaxSuccess === 'function') this._options.success = this._options.callbackObject._ajaxSuccess.bind(this._options.callbackObject); - if (typeof this._options.callbackObject._ajaxProgress === 'function') this._options.progress = this._options.callbackObject._ajaxProgress.bind(this._options.callbackObject); - if (typeof this._options.callbackObject._ajaxUploadProgress === 'function') this._options.uploadProgress = this._options.callbackObject._ajaxUploadProgress.bind(this._options.callbackObject); - } - - if (_didInit === false) { - _didInit = true; - - window.addEventListener('beforeunload', function() { _ignoreAllErrors = true; }); - } - }, - - /** - * Dispatches a request, optionally aborting a currently active request. - * - * @param {boolean} abortPrevious abort currently active request - */ - sendRequest: function(abortPrevious) { - if (abortPrevious === true || this._options.autoAbort) { - this.abortPrevious(); - } - - if (!this._options.silent) { - AjaxStatus.show(); - } - - if (this._xhr instanceof XMLHttpRequest) { - this._previousXhr = this._xhr; - } - - this._xhr = new XMLHttpRequest(); - this._xhr.open(this._options.type, this._options.url, true); - if (this._options.contentType) { - this._xhr.setRequestHeader('Content-Type', this._options.contentType); - } - this._xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); - - var self = this; - var options = Core.clone(this._options); - this._xhr.onload = function() { - if (this.readyState === XMLHttpRequest.DONE) { - if (this.status >= 200 && this.status < 300 || this.status === 304) { - if (options.responseType && this.getResponseHeader('Content-Type').indexOf(options.responseType) !== 0) { - // request succeeded but invalid response type - self._failure(this, options); - } - else { - self._success(this, options); - } - } - else { - self._failure(this, options); - } - } - }; - this._xhr.onerror = function() { - self._failure(this, options); - }; - - if (this._options.progress) { - this._xhr.onprogress = this._options.progress; - } - if (this._options.uploadProgress) { - this._xhr.upload.onprogress = this._options.uploadProgress; - } - - if (this._options.type === 'POST') { - var data = this._options.data; - if (typeof data === 'object' && Core.getType(data) !== 'FormData') { - data = Core.serialize(data); - } - - this._xhr.send(data); - } - else { - this._xhr.send(); - } - }, - - /** - * Aborts a previous request. - */ - abortPrevious: function() { - if (this._previousXhr === null) { - return; - } - - this._previousXhr.abort(); - this._previousXhr = null; - - if (!this._options.silent) { - AjaxStatus.hide(); - } - }, - - /** - * Sets a specific option. - * - * @param {string} key option name - * @param {?} value option value - */ - setOption: function(key, value) { - this._options[key] = value; - }, - - /** - * Returns an option by key or undefined. - * - * @param {string} key option name - * @return {(*|null)} option value or null - */ - getOption: function(key) { - if (objOwns(this._options, key)) { - return this._options[key]; - } - - return null; - }, - - /** - * Sets request data while honoring pinned data from setup callback. - * - * @param {Object} data request data - */ - setData: function(data) { - if (this._data !== null && Core.getType(data) !== 'FormData') { - data = Core.extend(this._data, data); - } - - this._options.data = data; - }, - - /** - * Handles a successful request. - * - * @param {XMLHttpRequest} xhr request object - * @param {Object} options request options - */ - _success: function(xhr, options) { - if (!options.silent) { - AjaxStatus.hide(); - } - - if (typeof options.success === 'function') { - var data = null; - if (xhr.getResponseHeader('Content-Type') === 'application/json') { - try { - data = JSON.parse(xhr.responseText); - } - catch (e) { - // invalid JSON - this._failure(xhr, options); - - return; - } - - // trim HTML before processing, see http://jquery.com/upgrade-guide/1.9/#jquery-htmlstring-versus-jquery-selectorstring - if (data && data.returnValues && data.returnValues.template !== undefined) { - data.returnValues.template = data.returnValues.template.trim(); - } - } - - options.success(data, xhr.responseText, xhr, options.data); - } - - this._finalize(options); - }, - - /** - * Handles failed requests, this can be both a successful request with - * a non-success status code or an entirely failed request. - * - * @param {XMLHttpRequest} xhr request object - * @param {Object} options request options - */ - _failure: function (xhr, options) { - if (_ignoreAllErrors) { - return; - } - - if (!options.silent) { - AjaxStatus.hide(); - } - - var data = null; - try { - data = JSON.parse(xhr.responseText); - } - catch (e) {} - - var showError = true; - if (data !== null && typeof options.failure === 'function') { - showError = options.failure(data, xhr.responseText, xhr, options.data); - } - - if (options.ignoreError !== true && showError !== false) { - var details = ''; - var message = ''; - - if (data !== null) { - if (data.stacktrace) details = '

    Stacktrace:

    ' + data.stacktrace + '

    '; - else if (data.exceptionID) details = '

    Exception ID: ' + data.exceptionID + '

    '; - - message = data.message; - } - else { - message = xhr.responseText; - } - - if (!message || message === 'undefined') { - return; - } - - var html = '

    ' + message + '

    ' + details + '
    '; - - if (UiDialog === undefined) UiDialog = require('Ui/Dialog'); - UiDialog.openStatic(DomUtil.getUniqueId(), html, { - title: Language.get('wcf.global.error.title') - }); - } - - this._finalize(options); - }, - - /** - * Finalizes a request. - * - * @param {Object} options request options - */ - _finalize: function(options) { - if (typeof options.finalize === 'function') { - options.finalize(this._xhr); - } - - this._previousXhr = null; - - DomChangeListener.trigger(); - - // fix anchor tags generated through WCF::getAnchor() - var links = elBySelAll('a[href*="#"]'); - for (var i = 0, length = links.length; i < length; i++) { - var link = links[i]; - var href = elAttr(link, 'href'); - if (href.indexOf('AJAXProxy') !== -1 || href.indexOf('ajax-proxy') !== -1) { - href = href.substr(href.indexOf('#')); - elAttr(link, 'href', document.location.toString().replace(/#.*/, '') + href); - } - } - } - }; - - return AjaxRequest; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Status.js b/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Status.js deleted file mode 100644 index 5ca1ef59b5..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Ajax/Status.js +++ /dev/null @@ -1,76 +0,0 @@ -/** - * Provides the AJAX status overlay. - * - * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Ajax/Status - */ -define(['Language'], function(Language) { - "use strict"; - - var _activeRequests = 0; - var _overlay = null; - var _timeoutShow = null; - - /** - * @exports WoltLab/WCF/Ajax/Status - */ - var AjaxStatus = { - /** - * Initializes the status overlay on first usage. - */ - _init: function() { - _overlay = elCreate('div'); - _overlay.classList.add('spinner'); - - var icon = elCreate('span'); - icon.className = 'icon icon48 fa-spinner'; - _overlay.appendChild(icon); - - var title = elCreate('span'); - title.textContent = Language.get('wcf.global.loading'); - _overlay.appendChild(title); - - document.body.appendChild(_overlay); - }, - - /** - * Shows the loading overlay. - */ - show: function() { - if (_overlay === null) { - this._init(); - } - - _activeRequests++; - - if (_timeoutShow === null) { - _timeoutShow = window.setTimeout(function() { - if (_activeRequests) { - _overlay.classList.add('active'); - } - - _timeoutShow = null; - }, 250); - } - }, - - /** - * Hides the loading overlay. - */ - hide: function() { - _activeRequests--; - - if (_activeRequests === 0) { - if (_timeoutShow !== null) { - window.clearTimeout(_timeoutShow); - } - - _overlay.classList.remove('active'); - } - } - }; - - return AjaxStatus; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js b/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js deleted file mode 100644 index c120611bed..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/Collapsible.js +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Generic handler for collapsible bbcode boxes. - * - * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Bbcode/Collapsible - */ -define([], function() { - "use strict"; - - var _containers = elByClass('jsCollapsibleBbcode'); - - /** - * @exports WoltLab/WCF/Bbcode/Collapsible - */ - var BbcodeCollapsible = { - observe: function() { - var container, toggleButton; - while (_containers.length) { - container = _containers[0]; - container.classList.remove('jsCollapsibleBbcode'); - - toggleButton = elBySel('.toggleButton'); - if (toggleButton === null) { - continue; - } - - (function(container, toggleButton) { - var toggle = function() { - var expand = container.classList.contains('collapsed'); - container.classList[expand ? 'remove' : 'add']('collapsed'); - toggleButton.textContent = elData(toggleButton, 'title-' + (expand ? 'collapse' : 'expand')); - }; - - toggleButton.addEventListener(WCF_CLICK_EVENT, toggle); - - // searching in a page causes Google Chrome to scroll - // the box if something inside it matches - // - // expand the box in this case, to: - // a) Improve UX - // b) Hide an ugly misplaced "show all" button - container.addEventListener('scroll', toggle); - - // expand boxes that are initially scrolled - if (container.scrollTop !== 0) { - toggle(); - } - })(container, toggleButton); - } - } - }; - - return BbcodeCollapsible; -}); diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/FromHtml.js b/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/FromHtml.js deleted file mode 100644 index 21f866ca4b..0000000000 --- a/wcfsetup/install/files/js/WoltLab/WCF/Bbcode/FromHtml.js +++ /dev/null @@ -1,547 +0,0 @@ -/** - * Converts a message containing HTML tags into BBCodes. - * - * @author Alexander Ebert - * @copyright 2001-2015 WoltLab GmbH - * @license GNU Lesser General Public License - * @module WoltLab/WCF/Bbcode/FromHtml - */ -define(['EventHandler', 'StringUtil', 'Dom/Traverse'], function(EventHandler, StringUtil, DomTraverse) { - "use strict"; - - var _converter = []; - var _inlineConverter = {}; - var _sourceConverter = []; - - /** - * Returns true if a whitespace should be inserted before or after the smiley. - * - * @param {Element} element image element - * @param {boolean} before evaluate previous node - * @return {boolean} true if a whitespace should be inserted - */ - function addSmileyPadding(element, before) { - var target = element[(before ? 'previousSibling' : 'nextSibling')]; - if (target === null || target.nodeType !== Node.TEXT_NODE || !/\s$/.test(target.textContent)) { - return true; - } - - return false; - } - - /** - * @module WoltLab/WCF/Bbcode/FromHtml - */ - var BbcodeFromHtml = { - /** - * Converts a message containing HTML elements into BBCodes. - * - * @param {string} message message containing HTML elements - * @return {string} message containing BBCodes - */ - convert: function(message) { - if (message.length) this._setup(); - - var container = elCreate('div'); - container.innerHTML = message; - - // convert line breaks - var elements = elByTag('P', container); - while (elements.length) elements[0].outerHTML = elements[0].innerHTML; - - elements = elByTag('BR', container); - while (elements.length) elements[0].outerHTML = "\n"; - - // prevent conversion taking place inside source bbcodes - var sourceElements = this._preserveSourceElements(container); - - EventHandler.fire('com.woltlab.wcf.bbcode.fromHtml', 'beforeConvert', { container: container }); - - for (var i = 0, length = _converter.length; i < length; i++) { - this._convert(container, _converter[i]); - } - - EventHandler.fire('com.woltlab.wcf.bbcode.fromHtml', 'afterConvert', { container: container }); - - this._restoreSourceElements(container, sourceElements); - - // remove remaining HTML elements - elements = elByTag('*', container); - while (elements.length) elements[0].outerHTML = elements[0].innerHTML; - - message = this._convertSpecials(container.innerHTML); - - return message; - }, - - /** - * Replaces HTML elements mapping to source BBCodes to avoid - * them being handled by other converters. - * - * @param {Element} container container element - * @return {array} list of source elements and their placeholder - */ - _preserveSourceElements: function(container) { - var elements, sourceElements = [], tmp; - - for (var i = 0, length = _sourceConverter.length; i < length; i++) { - elements = elBySelAll(_sourceConverter[i].selector, container); - - tmp = []; - for (var j = 0, innerLength = elements.length; j < innerLength; j++) { - this._preserveSourceElement(elements[j], tmp); - } - - sourceElements.push(tmp); - } - - return sourceElements; - }, - - /** - * Replaces an element with a placeholder. - * - * @param {Element} element target element - * @param {array} list of removed elements and their placeholders - */ - _preserveSourceElement: function(element, sourceElements) { - var placeholder = elCreate('var'); - elData(placeholder, 'source', 'wcf'); - element.parentNode.insertBefore(placeholder, element); - - var fragment = document.createDocumentFragment(); - fragment.appendChild(element); - - sourceElements.push({ - fragment: fragment, - placeholder: placeholder - }); - }, - - /** - * Reinserts source elements for parsing. - * - * @param {Element} container container element - * @param {array} sourceElements list of removed elements and their placeholders - */ - _restoreSourceElements: function(container, sourceElements) { - var element, elements, placeholder; - for (var i = 0, length = sourceElements.length; i < length; i++) { - elements = sourceElements[i]; - - if (elements.length === 0) { - continue; - } - - for (var j = 0, innerLength = elements.length; j < innerLength; j++) { - element = elements[j]; - placeholder = element.placeholder; - - placeholder.parentNode.insertBefore(element.fragment, placeholder); - - _sourceConverter[i].callback(placeholder.previousElementSibling); - - elRemove(placeholder); - } - } - }, - - /** - * Converts special entities. - * - * @param {string} message HTML message - * @return {string} HTML message - */ - _convertSpecials: function(message) { - message = message.replace(/&/g, '&'); - message = message.replace(/</g, '<'); - message = message.replace(/>/g, '>'); - - return message; - }, - - /** - * Sets up converters applied to elements in linear order. - */ - _setup: function() { - if (_converter.length) { - return; - } - - _converter = [ - // simple replacement - { tagName: 'STRONG', bbcode: 'b' }, - { tagName: 'DEL', bbcode: 's' }, - { tagName: 'EM', bbcode: 'i' }, - { tagName: 'SUB', bbcode: 'sub' }, - { tagName: 'SUP', bbcode: 'sup' }, - { tagName: 'U', bbcode: 'u' }, - { tagName: 'KBD', bbcode: 'tt' }, - - // callback replacement - { tagName: 'A', callback: this._convertUrl.bind(this) }, - { tagName: 'IMG', callback: this._convertImage.bind(this) }, - { tagName: 'LI', callback: this._convertListItem.bind(this) }, - { tagName: 'OL', callback: this._convertList.bind(this) }, - { tagName: 'TABLE', callback: this._convertTable.bind(this) }, - { tagName: 'UL', callback: this._convertList.bind(this) }, - { tagName: 'BLOCKQUOTE', callback: this._convertBlockquote.bind(this) }, - - // convert these last - { tagName: 'SPAN', callback: this._convertSpan.bind(this) }, - { tagName: 'DIV', callback: this._convertDiv.bind(this) } - ]; - - _inlineConverter = { - span: [ - { style: 'color', callback: this._convertInlineColor.bind(this) }, - { style: 'font-size', callback: this._convertInlineFontSize.bind(this) }, - { style: 'font-family', callback: this._convertInlineFontFamily.bind(this) } - ], - div: [ - { style: 'text-align', callback: this._convertInlineTextAlign.bind(this) } - ] - }; - - _sourceConverter = [ - { selector: 'div.codeBox', callback: this._convertSourceCodeBox.bind(this) } - ]; - - EventHandler.fire('com.woltlab.wcf.bbcode.fromHtml', 'init', { - converter: _converter, - inlineConverter: _inlineConverter, - sourceConverter: _sourceConverter - }); - }, - - /** - * Converts an element into a raw string. - * - * @param {Element} container container element - * @param {object} converter converter object - */ - _convert: function(container, converter) { - if (typeof converter === 'function') { - converter(container); - return; - } - - var element, elements = elByTag(converter.tagName, container); - while (elements.length) { - element = elements[0]; - - if (converter.bbcode) { - element.outerHTML = '[' + converter.bbcode + ']' + element.innerHTML + '[/' + converter.bbcode + ']'; - } - else { - converter.callback(element); - } - } - }, - - /** - * Converts
    into [quote]. - * - * @param {Element} element target element - */ - _convertBlockquote: function(element) { - var author = elData(element, 'author'); - var link = elAttr(element, 'cite'); - - var open = '[quote]'; - if (author) { - author = StringUtil.escapeHTML(author).replace(/(\\)?'/g, function(match, isEscaped) { return isEscaped ? match : "\\'"; }); - if (link) { - open = "[quote='" + author + "','" + StringUtil.escapeHTML(link) + "']"; - } - else { - open = "[quote='" + author + "']"; - } - } - - var header = DomTraverse.childByTag(element, 'HEADER'); - if (header !== null) element.removeChild(header); - - var divs = DomTraverse.childrenByTag(element, 'DIV'); - for (var i = 0, length = divs.length; i < length; i++) { - divs[i].outerHTML = divs[i].innerHTML + '\n'; - } - - element.outerHTML = open + element.innerHTML.replace(/^\n*/, '').replace(/\n*$/, '') + '[/quote]\n'; - }, - - /** - * Converts into smilies, [attach] or [img]. - * - * @param {Element} element target element - */ - _convertImage: function(element) { - if (element.classList.contains('smiley')) { - // smiley - element.outerHTML = (addSmileyPadding(element, true) ? ' ' : '') + elAttr(element, 'alt') + (addSmileyPadding(element, false) ? ' ' : ''); - return; - } - - var float = element.style.getPropertyValue('float') || 'none'; - var width = element.style.getPropertyValue('width'); - width = (typeof width === 'string') ? ~~width.replace(/px$/, '') : 0; - - if (element.classList.contains('redactorEmbeddedAttachment')) { - var attachmentId = elData(element, 'attachment-id'); - - if (width > 0) { - element.outerHTML = "[attach=" + attachmentId + "," + float + "," + width + "][/attach]"; - } - else if (float !== 'none') { - element.outerHTML = "[attach=" + attachmentId + "," + float + "][/attach]"; - } - else { - element.outerHTML = "[attach=" + attachmentId + "][/attach]"; - } - } - else { - // regular image - var source = element.src.trim(); - - if (width > 0) { - element.outerHTML = "[img='" + source + "'," + float + "," + width + "][/img]"; - } - else if (float !== 'none') { - element.outerHTML = "[img='" + source + "'," + float + "][/img]"; - } - else { - element.outerHTML = "[img]" + source + "[/img]"; - } - } - }, - - /** - * Converts
      and