From 0a047fdb51877b6f62927dc5234c2778c965b55c Mon Sep 17 00:00:00 2001 From: WoltLab Date: Mon, 14 Jun 2021 13:52:54 +0000 Subject: [PATCH] Updating minified JavaScript files --- .../redactor2/redactor.combined.min.js | 2 +- wcfsetup/install/files/js/WCF.Combined.min.js | 8 +- .../install/files/js/WCF.Combined.tiny.min.js | 4 +- .../install/files/js/WoltLabSuite.Core.min.js | 43223 +++++++++++++++- .../files/js/WoltLabSuite.Core.tiny.min.js | 43219 ++++++++++++++- 5 files changed, 86419 insertions(+), 37 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js index 290c240966..66602a1ef8 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js @@ -22,7 +22,7 @@ (function (window, undefined) { $.Redactor.prototype.WoltLabCaret=function(){"use strict";var u,f=!1,g=!1;return{init:function(){var t=this.caret.after;this.caret.after=function(e){e=this.caret.prepare(e),this.utils.isBlockTag(e.tagName)&&this.WoltLabCaret._addParagraphAfterBlock(e),t.call(this,e)}.bind(this);var n=this.caret.start;this.caret.start=function(e){if(g){if(!(e=this.caret.prepare(e)))return;"P"===e.nodeName&&"​"===e.innerHTML&&(e.innerHTML="
")}n.call(this,e)}.bind(this);var i=this.core.editor()[0];require(["Environment"],function(e){f="ios"===e.platform(),(g="safari"===e.browser())&&i.classList.add("jsSafariMarginClickTarget");var t=this.WoltLabCaret._handleEditorClick.bind(this),n=this.WoltLabCaret._handleEditorMouseUp.bind(this);g&&f?(i.addEventListener("touchstart",function(e){u=e.target},{passive:!0}),i.addEventListener("touchend",function(e){t(e),n(e)}.bind(this))):(i.addEventListener(WCF_CLICK_EVENT,function(e){this.WoltLabCaret._detectTripleClick(e),t(e)}.bind(this)),i.addEventListener("mouseup",n))}.bind(this));var o=this.caret.end;this.caret.end=function(e){"OL"!==(e=this.caret.prepare(e)).nodeName&&"UL"!==e.nodeName||null===(e=e.lastElementChild)&&(e=e.parentNode);var t,n=!1;if(e.nodeType===Node.ELEMENT_NODE&&e.lastChild&&"P"===e.lastChild.nodeName?n=!0:f?(t=this.core.editor()[0],e.parentNode===t&&"


"===t.innerHTML&&(n=!0)):"P"===e.nodeName&&0===e.childNodes.length&&(e.innerHTML="​",n=!0),n){var i=window.getSelection(),r=document.createRange();return r.selectNodeContents(e.lastChild),r.collapse(!1),i.removeAllRanges(),void i.addRange(r)}return"P"===e.nodeName&&1===e.childNodes.length&&"BR"===e.childNodes[0].nodeName?this.caret.before(e.childNodes[0]):o.call(this,e)}.bind(this);var r=this.selection.nodes;this.selection.nodes=function(e){var t=r.call(this,e);if(1===t.length&&t[0]===this.$editor[0]){var n=this.selection.range(this.selection.get());if(n.startContainer===n.endContainer)return[n.startContainer]}return t}.bind(this),this.WoltLabCaret._initInternalRange();var a=this.selection.saveInstant;this.selection.saveInstant=function(){var e,t,n=a.call(this);return n&&(n.isAtNodeStart=!1,!(e=window.getSelection()).rangeCount||e.isCollapsed||(t=e.getRangeAt(0)).startContainer.nodeType===Node.TEXT_NODE&&0===t.startOffset&&(n.isAtNodeStart=!0)),n}.bind(this);var d=this.selection.restoreInstant;this.selection.restoreInstant=function(e){if(void 0!==e||this.saved){var t=void 0!==e?e:this.saved;d.call(this,e);var n,i,r,o=window.getSelection();if(o.rangeCount)if(!0===t.isAtNodeStart){if(!o.isCollapsed){var a=o.getRangeAt(0),s=a.startContainer;if(t.node===s)return;for(;null!==s&&"P"!==s.nodeName;)s=s.parentNode;if(null!==s&&null!==(s=s.nextElementSibling)&&"P"===s.nodeName&&0===s.textContent.replace(/\u200B/g,"").length){s=s.nextElementSibling;for(var l=t.node;null!==l&&l!==s;)l=l.parentNode;l===s&&((a=a.cloneRange()).setStart(t.node,0),o.removeAllRanges(),o.addRange(a))}}}else o.isCollapsed&&(n=o.anchorNode,i=this.core.editor()[0],n.nodeType!==Node.TEXT_NODE||n.parentNode!==i||o.anchorOffset!==n.textContent.length||(r=n.nextElementSibling)&&"P"===r.nodeName&&this.caret.start(r))}}.bind(this),this.selection.nodes=function(e){var i=void 0===e?[]:$.isArray(e)?e:[e],t=this.selection.get(),n=this.selection.range(t),r=[],o=[];if(this.utils.isCollapsed())r=[this.selection.current()];else{var a=n.startContainer,s=n.endContainer;if(a===s)return[a];for(var l=n.commonAncestorContainer;a&&a!==s;)r.push(a=this.selection.nextNode(a,l));for(a=n.startContainer;a&&a!==l;)r.unshift(a),a=a.parentNode}return $.each(r,function(e,t){if(t){var n=1===t.nodeType&&t.tagName.toLowerCase();if($(t).hasClass("redactor-script-tag")||$(t).hasClass("redactor-selection-marker"))return;if(n&&0!==i.length&&-1===$.inArray(n,i))return;o.push(t)}}),0===o.length?[]:o}.bind(this),this.selection.nextNode=function(e,t){if(e.hasChildNodes())return e.firstChild;for(;e&&!e.nextSibling;)if(e=e.parentNode,t&&e===t)return null;return e?e.nextSibling:null}},paragraphAfterBlock:function(e){var t=e.nextElementSibling;t&&"P"!==t.nodeName&&(t=elCreate("p"),"


"===this.opts.emptyHtml?t.innerHTML="
":t.textContent="​",e.parentNode.insertBefore(t,e.nextSibling)),this.caret.after(e)},endOfEditor:function(){var e=this.core.editor()[0];document.activeElement!==e&&e.focus();var t=e.lastElementChild;"P"===t.nodeName?this.caret.end(t):this.caret.after(t)},_initInternalRange:function(){function i(){o=a.rangeCount?a.getRangeAt(0).cloneRange():null}var r=this.core.editor()[0],o=null,a=window.getSelection();this.WoltLabCaret.forceSelectionSave=i;function n(){if(null!==o){if(document.activeElement===r){var e=a.getRangeAt(0);if(0!==e.startOffset)return;for(var t=e.startContainer;t;){if(t.parentNode===r){if(t.previousSibling)return;break}if(t.previousSibling)return;t=t.parentNode}if(!t)return}var n=r.scrollLeft,i=r.scrollTop;r.focus(),r.scrollLeft=n,r.scrollTop=i,a.removeAllRanges(),a.addRange(o),o=null}}r.addEventListener("keyup",i),r.addEventListener("mouseup",function(){a.rangeCount&&i()});var e=this.selection.save;this.selection.save=function(){o=null,e.call(this)}.bind(this);var t=this.selection.restore;this.selection.restore=function(){o&&null===elBySel(".redactor-selection-marker",this.$editor[0])&&(n(),a.rangeCount&&this.utils.isRedactorParent(a.getRangeAt(0).commonAncestorContainer))||t.call(this)}.bind(this);var s=this.buffer.set;this.buffer.set=function(e){var t;document.activeElement!==r&&((t=window.getSelection()).rangeCount&&!1!==this.utils.isRedactorParent(t.anchorNode)?r.focus():n()),s.call(this,e),i()}.bind(this);var l=this.insert.html;this.insert.html=function(e,t){var n=elBySel(".redactor-selection-marker",this.$editor[0]);l.call(this,e,t),!n&&null!==elBySel(".redactor-selection-marker",this.$editor[0])||i()}.bind(this),require(["Environment"],function(e){"ios"===e.platform()&&(r.addEventListener("focus",function(){document.addEventListener("selectionchange",i)}),r.addEventListener("blur",function(){document.removeEventListener("selectionchange",i)}))}.bind(this))},_detectTripleClick:function(e){var t,n,i;e.detail<3||((t=window.getSelection()).isCollapsed||"TR"===(i=t.getRangeAt(0)).commonAncestorContainer.nodeName&&(n=elClosest(i.startContainer,"td"),(i=document.createRange()).selectNodeContents(n),t.removeAllRanges(),t.addRange(i)))},_handleEditorClick:function(e){var t=e.clientY,n=f&&u===e.target&&this.utils.isBlockTag(u.nodeName);if(void 0===t&&n&&(t=e.changedTouches[0].clientY),this.selection.get().isCollapsed||n&&void 0!==t){var i,r=this.selection.block();if(!1===r)if(this.selection.current()!==this.$editor[0]||(i=this.$editor[0].childNodes[this.selection.get().anchorOffset]).nodeType===Node.ELEMENT_NODE&&"TABLE"===i.nodeName&&(r=i),!1===r)return;var o=!1;g&&this.utils.isBlockTag(e.target.nodeName)&&t>e.target.getBoundingClientRect().bottom&&(r=e.target,o=!0);for(var a=e.target;a&&!this.utils.isBlockTag(a.nodeName);)a=a.parentNode;if(a&&(o||a!==r)&&("P"!==r.nodeName||(r=r.parentNode)!==this.$editor[0]&&this.utils.isBlockTag(r.nodeName))){if("TD"===r.nodeName)for(;"TABLE"!==r.nodeName;)r=r.parentNode;if(!r.nodeName.match(/^H\d$/)&&!$(r).closest("ol, ul",this.$editor[0]).length){for(var s,l,d,c,h=r;h;){if(t<(l=h.getBoundingClientRect()).top)s=!0,r=h;else{if(!(t>l.bottom))break;s=!1,r=h}if(!h.parentNode||h.parentNode===this.$editor[0])break;h=h.parentNode}void 0!==s&&((d=r[(s?"previous":"next")+"ElementSibling"])&&"P"===d.nodeName?this.caret.end(d):(this.buffer.set(),(c=elCreate("p")).textContent="​",r.parentNode.insertBefore(c,s?r:r.nextSibling),this.caret.end(c)))}}}},_handleEditorMouseUp:function(e){var t,n=window.getSelection();if(n.isCollapsed||g&&f&&u===e.target&&this.utils.isBlockTag(u.nodeName))if(e.target===this.$editor[0])(i=n.anchorNode).nodeType===Node.TEXT_NODE&&(i=i.parentNode),"KBD"===i.nodeName&&(null!==(t=i.previousSibling)&&"​"===t.textContent||(t=document.createTextNode("​"),i.parentNode.insertBefore(t,i)),this.caret.before(t));else if("KBD"===e.target.nodeName){var i,r,o,a=e.target;if((i=n.anchorNode).nodeType===Node.TEXT_NODE){for(t=i;(t=t.nextSibling)&&t.nodeType===Node.TEXT_NODE&&(""===t.textContent||"​"===t.textContent););t===a&&(0!==a.childNodes.length&&"​"===a.childNodes[0].textContent||(r=document.createTextNode("​"),a.insertBefore(r,a.firstChild)),(o=document.createRange()).setStartAfter(a.childNodes[0]),o.setEndAfter(a.childNodes[0]),n.removeAllRanges(),n.addRange(o))}}},_addParagraphAfterBlock:function(e){var t=e.nextElementSibling;t&&("P"===t.nodeName||this.utils.isBlockTag(t.nodeName))||((t=elCreate("p")).textContent="​",e.parentNode.insertBefore(t,e.nextSibling))}}}; })(this); // plugins/WoltLabClean.js -(function (window, undefined) { $.Redactor.prototype.WoltLabClean=function(){"use strict";return{init:function(){var n=this.clean.onSet;this.clean.onSet=function(e){e=(e=(e=e.replace(/\u200B/g,"")).replace(/&amp;/g,"@@@WCF_LITERAL_AMP@@@")).replace(/&/g,"&WCF_AMPERSAND&"),e=(e=(e=n.call(this,e)).replace(/&WCF_AMPERSAND&(amp;)?/g,"&")).replace(/@@@WCF_LITERAL_AMP@@@/g,"&amp;");var t=elCreate("div");return t.innerHTML=e,elBySelAll("*",t,function(e){for(var t,n=[],r=0,l=e.attributes.length;r",e.parentNode.insertBefore(t,e.nextSibling),e.removeChild(n.nextSibling),e.removeChild(n)):(n.previousElementSibling||n.previousSibling&&""!==n.previousSibling.textContent.replace(/\u200B/g,"").trim())&&e.removeChild(n))}),elBySelAll("span",t,function(e){var t;0\u200B<\/p>/g,"


")).replace(/&/g,"&WCF_AMPERSAND&"),e=(e=r.call(this,e)).replace(/&WCF_AMPERSAND&/g,"&"),t.innerHTML=e,elBySelAll("pre",t,function(e){n.hasOwnProperty(e.textContent)&&(e.textContent=n[e.textContent])}),e=t.innerHTML}.bind(this);var l=this.clean.savePreFormatting;this.clean.savePreFormatting=function(e){var t=this.clean.encodeEntities;return this.clean.encodeEntities=function(e){return WCF.String.escapeHTML(e)},e=l.call(this,e),this.clean.encodeEntities=t,e}.bind(this);var b=this.clean.onPaste;this.clean.onPaste=function(e,t,n){if(t.pre||this.utils.isCurrentOrParent("kbd"))return t.pre&&this.opts.preSpaces&&(e=e.replace(/\t/g,new Array(this.opts.preSpaces+1).join(" "))),WCF.String.escapeHTML(e);this.clean.isHtmlMsWord(e)&&(e=this.clean.cleanMsWord(e));var r,l=elCreate("div");l.innerHTML=e.replace(/@@@WOLTLAB-P-ALIGN-(?:left|right|center|justify)@@@/g,"");var i=!0;for(s=0,c=l.childElementCount;s",r.parentNode.insertBefore(g,r.nextSibling)),h.push(y))}h.forEach(function(e){r.style.removeProperty(e)})}return elBySelAll("span",l,function(e){if(!e.classList.contains("redactor-selection-marker"))if(e.hasAttribute("style")&&e.style.length)for(var t=e.style.getPropertyValue("color"),n=e.style.getPropertyValue("font-family"),r=e.style.getPropertyValue("font-size"),l=(t?1:0)+(n?1:0)+(r?1:0);1"):e.className.match(/\btext-(left|right|center|justify)\b/)&&e.insertBefore(document.createTextNode("@@@WOLTLAB-P-ALIGN-"+RegExp.$1+"@@@"),e.firstChild),e.removeAttribute("class"),e.removeAttribute("style")}),elBySelAll("img",l,function(e){e.removeAttribute("style")}),elBySelAll("br",l,function(e){e.parentNode.insertBefore(document.createTextNode("@@@WOLTLAB-BR-MARKER@@@"),e.nextSibling)}),elBySelAll("kbd",l,function(e){for(e.insertBefore(document.createTextNode("[tt]"),e.firstChild),e.appendChild(document.createTextNode("[/tt]"));e.childNodes.length;)e.parentNode.insertBefore(e.childNodes[0],e);elRemove(e)}),e=(e=(e=b.call(this,l.innerHTML,t,n)).replace(/\n*@@@WOLTLAB-BR-MARKER@@@\n*/g,"")).replace(/(

)?\s*@@@WOLTLAB-P-ALIGN-(left|right|center|justify)@@@/g,function(e,t,n){return t?'

':""}),l.innerHTML=e.replace(/&quot;/g,"""),elBySelAll("woltlab-br-marker",l,function(e){var t=e.parentNode;if(null!==t){for(var n=!1,r=t;null!==r;)"P"===r.nodeName&&(n=!0),r=r.parentNode;if(n){var l=elCreate("p"),i=!(l.innerHTML="
"),o=e.nextSibling;o&&"WOLTLAB-BR-MARKER"===o.nodeName&&(i=!0);for(var a=!i;e.nextSibling;)a&&0!==e.nextSibling.textContent.replace(/\u200B/g,"").trim().length&&(a=!1),l.appendChild(e.nextSibling);a||elRemove(l.firstElementChild);var s=e.previousSibling;s&&"BR"===s.nodeName&&elRemove(s),t.parentNode.insertBefore(l,t.nextSibling),i&&((l=elCreate("p")).innerHTML="
",t.parentNode.insertBefore(l,t.nextSibling))}else t.insertBefore(elCreate("br"),e);elRemove(e)}}),elBySelAll("p",l,function(e){var t=!1;0===e.childNodes.length?t=!0:""===e.textContent?(t=!0,elBySelAll("*",e,function(e){"SPAN"!==e.nodeName&&(t=!1)})):0===e.textContent.trim().length&&(elBySelAll("span",e,function(e){if(!e.hasAttribute("style")||!e.style.length){for(;e.childNodes.length;)e.parentNode.insertBefore(e.childNodes[0],e);elRemove(e)}}),0===e.children.length&&(e.innerHTML="
")),t&&elRemove(e)}),l.innerHTML}.bind(this);function i(e,t){for(var n,r,l={},i=0,o=t.length;i'),(n=elCreate("div")).innerHTML=e,elBySelAll("woltlab-custom-tag",n,function(e){var t=~~elData(e,"index");if(a[t]){var n=a[t],r=elCreate(n.element.nodeName);for(var l in n.attributes)n.attributes.hasOwnProperty(l)&&elAttr(r,l,n.attributes[l]);for(e.parentNode.insertBefore(r,e);e.childNodes.length;)r.appendChild(e.childNodes[0])}elRemove(e)}),e=n.innerHTML),(t.links&&this.opts.pasteLinks||t.images&&this.opts.pasteImages)&&(e=(e=e.replace(new RegExp("#@###\\[","gi"),"<")).replace(new RegExp("\\]###@#","gi"),">")),s.call(this,e,t)}.bind(this),this.clean.removeSpans=function(e){return e};var c=this.clean.getCurrentType;this.clean.getCurrentType=function(e,t){var n=c.call(this,e,t);return this.utils.isCurrentOrParent(["kbd"])&&(n.inline=!1,n.block=!1,n.encode=!0,n.pre=!0,n.paragraphize=!1,n.images=!1,n.links=!1),n}.bind(this);this.clean.removeEmptyInlineTags;this.clean.removeEmptyInlineTags=function(e){var t=this.opts.inlineTags,n=$("

").html($.parseHTML(e,document,!0)),r=this,l=n.find("span"),i=n.find(t.join(","));return i.filter(":not(span)").removeAttr("style"),i.each(function(){var e=$(this).html();0===this.attributes.length&&r.utils.isEmpty(e)&&$(this).replaceWith(function(){return $(this).contents()})}),l.each(function(){$(this).html();0===this.attributes.length&&$(this).replaceWith(function(){return $(this).contents()})}),e=(e=(e=(e=n.html()).replace("\x3c!--?php",""),n.remove(),e}.bind(this)},removeRedundantStyles:function(){var t,r=[];elBySelAll(["del","em","strong","sub","sup","u"].join(","),this.$editor[0],function(e){elBySelAll(e.nodeName,e,function(e){r.push(e)})}),this.opts.pastePlainText||(elBySelAll("span[style]",this.$editor[0],function(n){["color","font-family","font-size"].forEach(function(e){var t=n.style.getPropertyValue(e);t&&window.getComputedStyle(n.parentNode).getPropertyValue(e)===t&&r.push(n)})}),r.forEach(function(e){for(t=e.parentNode;e.childNodes.length;)t.insertBefore(e.childNodes[0],e);t.removeChild(e)}))}}}; })(this); +(function (window, undefined) { $.Redactor.prototype.WoltLabClean=function(){"use strict";return{init:function(){var n=this.clean.onSet;this.clean.onSet=function(e){e=(e=(e=e.replace(/\u200B/g,"")).replace(/&amp;/g,"@@@WCF_LITERAL_AMP@@@")).replace(/&/g,"&WCF_AMPERSAND&"),e=(e=(e=n.call(this,e)).replace(/&WCF_AMPERSAND&(amp;)?/g,"&")).replace(/@@@WCF_LITERAL_AMP@@@/g,"&amp;");var t=elCreate("div");return t.innerHTML=e,elBySelAll("*",t,function(e){for(var t,n=[],r=0,l=e.attributes.length;r",e.parentNode.insertBefore(t,e.nextSibling),e.removeChild(n.nextSibling),e.removeChild(n)):(n.previousElementSibling||n.previousSibling&&""!==n.previousSibling.textContent.replace(/\u200B/g,"").trim())&&e.removeChild(n))}),elBySelAll("span",t,function(e){var t;0\u200B<\/p>/g,"


")).replace(/&/g,"&WCF_AMPERSAND&"),e=(e=r.call(this,e)).replace(/&WCF_AMPERSAND&/g,"&"),t.innerHTML=e,elBySelAll("pre",t,function(e){n.hasOwnProperty(e.textContent)&&(e.textContent=n[e.textContent])}),e=t.innerHTML}.bind(this);var l=this.clean.savePreFormatting;this.clean.savePreFormatting=function(e){var t=this.clean.encodeEntities;return this.clean.encodeEntities=function(e){return WCF.String.escapeHTML(e)},e=l.call(this,e),this.clean.encodeEntities=t,e}.bind(this);var b=this.clean.onPaste;this.clean.onPaste=function(e,t,n){if(t.pre||this.utils.isCurrentOrParent("kbd"))return t.pre&&this.opts.preSpaces&&(e=e.replace(/\t/g,new Array(this.opts.preSpaces+1).join(" "))),WCF.String.escapeHTML(e);this.clean.isHtmlMsWord(e)&&(e=this.clean.cleanMsWord(e));var r,l=elCreate("div");l.innerHTML=e.replace(/@@@WOLTLAB-P-ALIGN-(?:left|right|center|justify)@@@/g,"");var i=!0;for(s=0,c=l.childElementCount;s",r.parentNode.insertBefore(g,r.nextSibling)),h.push(y))}h.forEach(function(e){r.style.removeProperty(e)})}return elBySelAll("span",l,function(e){if(!e.classList.contains("redactor-selection-marker"))if(e.hasAttribute("style")&&e.style.length)for(var t=e.style.getPropertyValue("color"),n=e.style.getPropertyValue("font-family"),r=e.style.getPropertyValue("font-size"),l=(t?1:0)+(n?1:0)+(r?1:0);0"):e.className.match(/\btext-(left|right|center|justify)\b/)&&e.insertBefore(document.createTextNode("@@@WOLTLAB-P-ALIGN-"+RegExp.$1+"@@@"),e.firstChild),e.removeAttribute("class"),e.removeAttribute("style")}),elBySelAll("img",l,function(e){e.removeAttribute("style")}),elBySelAll("br",l,function(e){e.parentNode.insertBefore(document.createTextNode("@@@WOLTLAB-BR-MARKER@@@"),e.nextSibling)}),elBySelAll("kbd",l,function(e){for(e.insertBefore(document.createTextNode("[tt]"),e.firstChild),e.appendChild(document.createTextNode("[/tt]"));e.childNodes.length;)e.parentNode.insertBefore(e.childNodes[0],e);elRemove(e)}),e=(e=(e=b.call(this,l.innerHTML,t,n)).replace(/\n*@@@WOLTLAB-BR-MARKER@@@\n*/g,"")).replace(/(

)?\s*@@@WOLTLAB-P-ALIGN-(left|right|center|justify)@@@/g,function(e,t,n){return t?'

':""}),l.innerHTML=e.replace(/&quot;/g,"""),elBySelAll("woltlab-br-marker",l,function(e){var t=e.parentNode;if(null!==t){for(var n=!1,r=t;null!==r;)"P"===r.nodeName&&(n=!0),r=r.parentNode;if(n){var l=elCreate("p"),i=!(l.innerHTML="
"),o=e.nextSibling;o&&"WOLTLAB-BR-MARKER"===o.nodeName&&(i=!0);for(var a=!i;e.nextSibling;)a&&0!==e.nextSibling.textContent.replace(/\u200B/g,"").trim().length&&(a=!1),l.appendChild(e.nextSibling);a||elRemove(l.firstElementChild);var s=e.previousSibling;s&&"BR"===s.nodeName&&elRemove(s),t.parentNode.insertBefore(l,t.nextSibling),i&&((l=elCreate("p")).innerHTML="
",t.parentNode.insertBefore(l,t.nextSibling))}else t.insertBefore(elCreate("br"),e);elRemove(e)}}),elBySelAll("p",l,function(e){var t=!1;0===e.childNodes.length?t=!0:""===e.textContent?(t=!0,elBySelAll("*",e,function(e){"SPAN"!==e.nodeName&&(t=!1)})):0===e.textContent.trim().length&&(elBySelAll("span",e,function(e){if(!e.hasAttribute("style")||!e.style.length){for(;e.childNodes.length;)e.parentNode.insertBefore(e.childNodes[0],e);elRemove(e)}}),0===e.children.length&&(e.innerHTML="
")),t&&elRemove(e)}),l.innerHTML}.bind(this);function i(e,t){for(var n,r,l={},i=0,o=t.length;i'),(n=elCreate("div")).innerHTML=e,elBySelAll("woltlab-custom-tag",n,function(e){var t=~~elData(e,"index");if(a[t]){var n=a[t],r=elCreate(n.element.nodeName);for(var l in n.attributes)n.attributes.hasOwnProperty(l)&&elAttr(r,l,n.attributes[l]);for(e.parentNode.insertBefore(r,e);e.childNodes.length;)r.appendChild(e.childNodes[0])}elRemove(e)}),e=n.innerHTML),(t.links&&this.opts.pasteLinks||t.images&&this.opts.pasteImages)&&(e=(e=e.replace(new RegExp("#@###\\[","gi"),"<")).replace(new RegExp("\\]###@#","gi"),">")),s.call(this,e,t)}.bind(this),this.clean.removeSpans=function(e){return e};var c=this.clean.getCurrentType;this.clean.getCurrentType=function(e,t){var n=c.call(this,e,t);return this.utils.isCurrentOrParent(["kbd"])&&(n.inline=!1,n.block=!1,n.encode=!0,n.pre=!0,n.paragraphize=!1,n.images=!1,n.links=!1),n}.bind(this);this.clean.removeEmptyInlineTags;this.clean.removeEmptyInlineTags=function(e){var t=this.opts.inlineTags,n=$("

").html($.parseHTML(e,document,!0)),r=this,l=n.find("span"),i=n.find(t.join(","));return i.filter(":not(span)").removeAttr("style"),i.each(function(){var e=$(this).html();0===this.attributes.length&&r.utils.isEmpty(e)&&$(this).replaceWith(function(){return $(this).contents()})}),l.each(function(){$(this).html();0===this.attributes.length&&$(this).replaceWith(function(){return $(this).contents()})}),e=(e=(e=(e=n.html()).replace("\x3c!--?php",""),n.remove(),e}.bind(this)},removeRedundantStyles:function(){var t,r=[];elBySelAll(["del","em","strong","sub","sup","u"].join(","),this.$editor[0],function(e){elBySelAll(e.nodeName,e,function(e){r.push(e)})}),this.opts.pastePlainText||(elBySelAll("span[style]",this.$editor[0],function(n){["color","font-family","font-size"].forEach(function(e){var t=n.style.getPropertyValue(e);t&&window.getComputedStyle(n.parentNode).getPropertyValue(e)===t&&r.push(n)})}),r.forEach(function(e){for(t=e.parentNode;e.childNodes.length;)t.insertBefore(e.childNodes[0],e);t.removeChild(e)}))}}}; })(this); // plugins/WoltLabCode.js (function (window, undefined) { $.Redactor.prototype.WoltLabCode=function(){"use strict";return{init:function(){require(["WoltLabSuite/Core/Ui/Redactor/Code"],function(t){new t(this)}.bind(this));var e=this.code.start;this.code.start=function(t){e.call(this,t),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","codeStart_"+this.$element[0].id),elBySelAll("kbd",this.$editor[0],function(t){var e,i=t.nextSibling;i&&i.nodeType===Node.TEXT_NODE&&"​"===i.textContent.substr(0,1)||(e=document.createTextNode("​"),t.parentNode.insertBefore(e,i))})}.bind(this);var i=this.code.set;this.code.set=function(t,e){i.call(this,t,e),this.utils.isEmpty()&&this.observe.toolbar()}.bind(this);var t=this.code.get;this.code.get=function(){return this.code.html=!1,this.code.startSync(this.core.editor().html()),t.call(this)}.bind(this)}}}; })(this); diff --git a/wcfsetup/install/files/js/WCF.Combined.min.js b/wcfsetup/install/files/js/WCF.Combined.min.js index e2ba490117..cf7df898c2 100755 --- a/wcfsetup/install/files/js/WCF.Combined.min.js +++ b/wcfsetup/install/files/js/WCF.Combined.min.js @@ -34,10 +34,10 @@ (function (window, undefined) { "use strict";WCF.ColorPicker=Class.extend({_bar:null,_barActive:!1,_barSelector:null,_callbackSubmit:null,_dialog:null,_didInit:!1,_elementID:"",_gradient:null,_gradientActive:!1,_gradientSelector:null,_hex:null,_hsv:{},_newColor:null,_oldColor:null,_rgba:{},_rgbaRegExp:null,init:function(t){this._callbackSubmit=null,this._elementID="",this._hsv={h:0,s:100,v:100},this._position={};var a=$(t);a.length?a.click($.proxy(this._open,this)):console.debug("[WCF.ColorPicker] Selector does not match any element, aborting.")},setCallbackSubmit:function(t){this._callbackSubmit=t},_open:function(t){this._didInit||(this._initColorPicker(),this._didInit=!0);var a=$(t.currentTarget);this._elementID=a.wcfIdentify(),this._parseColor(a);var i=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);this._oldColor.css({backgroundColor:"rgba("+i.r+", "+i.g+", "+i.b+", "+this._rgba.a.val()/100+")"}),this._dialog.wcfDialog({backdropCloseOnClick:!1,title:WCF.Language.get("wcf.style.colorPicker")}),window.setTimeout(function(){this._hex.focus()}.bind(this),200)},_parseColor:function(t){if(t.data("hsv")&&t.data("rgb")){var a=t.data("hsv");for(var i in a)this._hsv[i]=a[i];this._updateValues(t.data("rgb"),!0,!0),this._rgba.a.val(parseInt(t.data("alpha")))}else{t.data("color").match(/^rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)$/)&&t.data("color","rgba("+RegExp.$1+", "+RegExp.$2+", "+RegExp.$3+", 1)"),null===this._rgbaRegExp&&(this._rgbaRegExp=new RegExp("^rgba\\((\\d{1,3}), ?(\\d{1,3}), ?(\\d{1,3}), ?(1|1\\.00?|0|0?\\.[0-9]{1,2})\\)$")),this._rgbaRegExp.exec(t.data("color"));var s=RegExp.$4;0===s.indexOf(".")&&(s="0"+s),s*=100,this._updateValues({r:RegExp.$1,g:RegExp.$2,b:RegExp.$3,a:Math.round(s)},!0,!0)}},_initColorPicker:function(){this._dialog=$('
').hide().appendTo(document.body),this._gradient=$('
').appendTo(this._dialog),this._gradientSelector=$('').appendTo(this._gradient),this._bar=$('
').appendTo(this._dialog),this._barSelector=$('').appendTo(this._bar),this._gradient.mousedown($.proxy(this._mouseDownGradient,this)),this._bar.mousedown($.proxy(this._mouseDownBar,this));var a=this;$(document).mouseup(function(t){a._barActive?(a._barActive=!1,a._mouseBar(t)):a._gradientActive&&(a._gradientActive=!1,a._mouseGradient(t))}).mousemove(function(t){a._barActive?a._mouseBar(t):a._gradientActive&&a._mouseGradient(t)}),this._initColorPickerForm()},_initColorPickerForm:function(){var t=$('
').appendTo(this._dialog);$(""+WCF.Language.get("wcf.style.colorPicker.new")+"").appendTo(t);var a=$('
    ').appendTo(t);this._newColor=$('
  • ').appendTo(a).children("span"),this._oldColor=$('
  • ').appendTo(a).children("span"),$(""+WCF.Language.get("wcf.style.colorPicker.current")+"").appendTo(t);var i=$('
      ').appendTo(t);this._createInputElement("r","R",0,255).appendTo(i),this._createInputElement("g","G",0,255).appendTo(i),this._createInputElement("b","B",0,255).appendTo(i),this._createInputElement("a","a",0,100).appendTo(i);var s=$('
      ').appendTo(t);this._hex=$('').appendTo(s.find("label")),this._rgba.r.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.g.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.b.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.a.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._hex.blur($.proxy(this._blurHex,this)).keyup($.proxy(this._keyUpHex,this));var e=$('
      ').appendTo(this._dialog);$('").appendTo(e).click($.proxy(this._submit,this));var r=this;this._hex.on("paste",function(){r._hex.attr("maxlength","7"),setTimeout(function(){var t=r._hex.val();"#"==t.substring(0,1)&&(t=t.substr(1)),6'),r=$("
      ").appendTo(document.body),t=this._copyQuote.children("span.jsQuoteManagerStore").click($.proxy(this._saveQuote,this)),e&&$(''+WCF.Language.get("wcf.message.quote.quoteAndReply")+"").click($.proxy(this._saveAndInsertQuote,this)).insertAfter(t))},_getSelectedText:function(){var e=window.getSelection();return e.rangeCount?this._getNodeText(e.getRangeAt(0).cloneContents()):""},_saveFullQuote:function(e){e.preventDefault();var t=$(e.currentTarget);this._proxy.setOption("data",{actionName:"saveFullQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[t.data("objectID")]}),this._proxy.sendRequest(),t.data("isQuoted")?t.data("isQuoted",!1).children("a").removeClass("active"):t.data("isQuoted",!0).children("a").addClass("active");var s=t.parents(".buttonGroupNavigation");s.hasClass("jsMobileButtonGroupNavigation")&&s.children(".dropdownLabel").trigger("click")},_saveQuote:function(e){this._proxy.setOption("data",{actionName:"saveQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[this._objectID],parameters:{message:this._message,renderQuote:!0===e}}),this._proxy.sendRequest();var t=window.getSelection();t.rangeCount&&(t.removeAllRanges(),this._copyQuote[0].classList.remove("active"))},_saveAndInsertQuote:function(){this._saveQuote(!0)},_success:function(e){var t;switch(void 0!==e.returnValues.count&&(void 0!==e.returnValues.fullQuoteMessageIDs&&(e.returnValues.fullQuoteObjectIDs=e.returnValues.fullQuoteMessageIDs),t=void 0!==e.returnValues.fullQuoteObjectIDs?e.returnValues.fullQuoteObjectIDs:{},this._quoteManager.updateCount(e.returnValues.count,t)),e.actionName){case"saveQuote":case"saveFullQuote":e.returnValues.renderedQuote&&WCF.System.Event.fireEvent("com.woltlab.wcf.message.quote","insert",{forceInsert:"saveQuote"===e.actionName,quote:e.returnValues.renderedQuote})}},updateFullQuoteObjectIDs:function(i){for(var e in this._containers)this._containers[e].find(".jsQuoteMessage").each(function(e,t){var s=$(t).data("isQuoted",0);s.children("a").removeClass("active"),WCF.inArray(s.data("objectID"),i)&&s.data("isQuoted",1).children("a").addClass("active")})}}),WCF.Message.Quote.Manager=Class.extend({_buttons:{},_count:0,_dialog:null,_editorId:"",_editorIdAlternative:"",_form:null,_handlers:{},_hasTemplate:!1,_insertQuotes:!0,_proxy:null,_removeOnSubmit:[],_supportPaste:!1,_supportPasteOverride:!1,init:function(e,t,s,i){var n;this._buttons={insert:null,remove:null},this._count=parseInt(e)||0,this._dialog=null,this._editorId="",this._editorIdAlternative="",this._form=null,this._handlers={},this._hasTemplate=!1,this._insertQuotes=!0,this._removeOnSubmit=[],this._supportPaste=!1,this._supportPasteOverride=!1,!t||(n=$("#"+t)).length&&(this._editorId=t,this._supportPaste=!0,this._form=n.parents("form:eq(0)"),this._form.length?(this._form.submit(this._submit.bind(this)),this._removeOnSubmit=i||[]):(this._form=null,this._supportPaste=!0===s)),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this),url:"index.php?message-quote/&t="+SECURITY_TOKEN}),this._toggleShowQuotes(),WCF.System.Event.addListener("com.woltlab.wcf.quote","reload",this.countQuotes.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.message.quote","insert",function(e){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertQuote_"+(this._editorIdAlternative?this._editorIdAlternative:this._editorId),{author:e.quote.username,content:e.quote.text,isText:!e.quote.isFullQuote,link:e.quote.link})}.bind(this))},setAlternativeEditor:function(e){this._editorIdAlternative||this._supportPaste||(this._hasTemplate=!1,this._supportPaste=!0,this._supportPasteOverride=!0),"object"==typeof e&&(e=e[0].id),this._editorIdAlternative=e},clearAlternativeEditor:function(){this._supportPasteOverride&&(this._hasTemplate=!1,this._supportPaste=!1,this._supportPasteOverride=!1),this._editorIdAlternative=""},register:function(e,t){this._handlers[e]=t},updateCount:function(e,t){for(var s in this._count=parseInt(e)||0,this._toggleShowQuotes(),this._handlers){var i;this._handlers.hasOwnProperty(s)&&(i=t[s]||[],this._handlers[s].updateFullQuoteObjectIDs(i))}},insertQuotes:function(e,t,s){this._insertQuotes?new WCF.Action.Proxy({autoSend:!0,data:{actionName:"getRenderedQuotes",className:e,interfaceName:"wcf\\data\\IMessageQuoteAction",parameters:{parentObjectID:t}},success:s}):this._insertQuotes=!0},_toggleShowQuotes:function(){require(["WoltLabSuite/Core/Ui/Page/Action"],function(e){var t,s="showQuotes";this._count?(void 0===(t=e.get(s))&&((t=elCreate("a")).addEventListener("mousedown",this._click.bind(this)),e.add(s,t)),t.textContent=WCF.Language.get("wcf.message.quote.showQuotes",{count:this._count}),e.show(s)):e.remove(s),this._hasTemplate=!1}.bind(this))},_click:function(){var e=document.activeElement;e.classList.contains("redactor-layer")&&$("#"+elData(e,"element-id")).redactor("selection.save"),this._hasTemplate?this._dialog.wcfDialog("open"):(this._proxy.showLoadingOverlayOnce(),this._proxy.setOption("data",{actionName:"getQuotes",supportPaste:this._supportPaste}),this._proxy.sendRequest())},renderDialog:function(e){null===this._dialog&&(this._dialog=$("#messageQuoteList"),this._dialog.length||(this._dialog=$('
      ').hide().appendTo(document.body))),this._dialog.html(e);var t=$('
      ').appendTo(this._dialog);this._supportPaste&&(this._buttons.insert=$('").click($.proxy(this._insertSelected,this)).appendTo(t)),this._buttons.remove=$("").click($.proxy(this._removeSelected,this)).appendTo(t),this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.quote.manageQuotes")}),this._dialog.wcfDialog("render"),this._hasTemplate=!0;var i,s=this._dialog.find(".jsInsertQuote");this._supportPaste?s.click($.proxy(this._insertQuote,this)):s.hide(),this._dialog.find("input.jsCheckbox").change($.proxy(this._changeButtons,this)),this._removeOnSubmit.length&&(i=this)._dialog.find("input.jsRemoveQuote").each(function(e,t){var s=$(t).change($.proxy(this._change,this));WCF.inArray(s.parent("li").attr("data-quote-id"),i._removeOnSubmit)&&s.attr("checked","checked")})},_changeButtons:function(){this._dialog.find("input.jsCheckbox:checked").length?(this._supportPaste&&this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertSelectedQuotes")),this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeSelectedQuotes"))):(this._supportPaste&&this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertAllQuotes")),this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeAllQuotes")))},_change:function(e){var t,s=$(e.currentTarget),i=s.parent("li").attr("data-quote-id");s.prop("checked")?this._removeOnSubmit.push(i):-1!==(t=this._removeOnSubmit.indexOf(i))&&this._removeOnSubmit.splice(t,1)},_insertSelected:function(){this._dialog.find("input.jsCheckbox:checked").length||this._dialog.find("input.jsCheckbox").prop("checked","checked"),this._dialog.find("input.jsCheckbox:checked").each($.proxy(function(e,t){this._insertQuote(null,t)},this)),this._dialog.wcfDialog("close")},_insertQuote:function(e,t){var s=$(e?e.currentTarget:t).parents("li:eq(0)"),i=s.children(".jsFullQuote")[0].textContent.trim(),n=s.parents(".message:eq(0)"),a=n.data("username"),o=n.data("link"),r=!elDataBool(s[0],"is-full-quote");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertQuote_"+(this._editorIdAlternative?this._editorIdAlternative:this._editorId),{author:a,content:i,isText:r,link:o}),this._removeOnSubmit.push(s.data("quote-id")),null!==e&&require(["WoltLabSuite/Core/Environment"],function(e){var t=function(){this._dialog.wcfDialog("close")}.bind(this);"ios"===e.platform()?window.setTimeout(t,100):t()}.bind(this))},_removeSelected:function(){this._dialog.find("input.jsCheckbox:checked").length||this._dialog.find("input.jsCheckbox").prop("checked","checked");var s=[];if(this._dialog.find("input.jsCheckbox:checked").each(function(e,t){s.push($(t).parents("li").attr("data-quote-id"))}),s.length){var e=[];for(var t in this._handlers)this._handlers.hasOwnProperty(t)&&e.push(t);this._proxy.setOption("data",{actionName:"remove",getFullQuoteObjectIDs:0').appendTo(e)},getQuotesMarkedForRemoval:function(){return this._removeOnSubmit},markQuotesForRemoval:function(){this._removeOnSubmit.length&&(this._proxy.setOption("data",{actionName:"markForRemoval",quoteIDs:this._removeOnSubmit}),this._proxy.suppressErrors(),this._proxy.sendRequest())},removeMarkedQuotes:function(){this._removeOnSubmit.length&&(this._proxy.setOption("data",{actionName:"removeMarkedQuotes",getFullQuoteObjectIDs:0').hide().appendTo(document.body),t=!0):this._dialog.empty(),s=$('

      ").appendTo(this._dialog),$('').attr("value",n).appendTo(s),s=$('

      ").appendTo(this._dialog),$('').attr("value","[url='"+n+"']"+a+"[/url]").appendTo(s),s=$('

      ").appendTo(this._dialog),$('').attr("value",''+WCF.String.escapeHTML(a)+"").appendTo(s),""!==this._shareButtonsTemplate&&(s=$('

      '+WCF.Language.get("wcf.message.share")+"

      "+this._shareButtonsTemplate+"
      ").appendTo(this._dialog),elData(s.children(".jsMessageShareButtons")[0],"url",WCF.String.escapeHTML(n))),this._cache[o]=this._dialog.html(),t?this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.share")}):this._dialog.wcfDialog("open")):this._dialog.html(this._cache[o]).wcfDialog("open"),this._enableSelection()},_enableSelection:function(){var e=this._dialog.find("input").click(function(){$(this).select()});navigator.userAgent.match(/iP(ad|hone|od)/)&&e.keydown(function(){return!1}).removeAttr("readonly").click(function(){this.setSelectionRange(0,9999)})}}),WCF.Message.Share.Page=Class.extend({init:function(){require(["WoltLabSuite/Core/Ui/Message/Share"],function(e){e.init()})}}),WCF.Message.UserMention=Class.extend({init:function(){throw new Error("Support for mentions in Redactor are now enabled by adding the attribute 'data-support-mention=\"true\"' to the textarea element.")}}),$.widget("wcf.messageTabMenu",{_tabs:[],_tabsByName:{},options:{collapsible:!0},_create:function(){var s=this.element.find("> nav").find("> ul > li:not(.jsFlexibleMenuDropdown)"),e=this.element.find("> div, > fieldset");if(s.length==e.length){var i=this.element.data("preselect");e.each(function(e,t){if(null!==elBySel(".innerError",t))return i=$(s[e]).data("name"),!1}),"true"===i&&(i=!0),this._tabs=[],this._tabsByName={};for(var t=0;t ul > li[data-name] > a",l))&&$(r).trigger("mousedown");continue}if(!0===s)continue}o.tab.removeClass("active"),o.container.removeClass("active"),o.tab.children("a").attr("aria-expanded",!1)}null!==e&&(e.preventDefault(),e.stopPropagation()),null!==n&&this._trigger("show",{},{activeTab:n}),$(window).trigger("resize")},showTab:function(e,t){$.isNumeric(e)||void 0!==this._tabsByName[e]&&(e=this._tabsByName[e]),void 0!==this._tabs[e]?this._showTab(null,e,t):console.debug("[wcf.messageTabMenu] Cannot locate tab identified by '"+e+"'")},getTab:function(e){return void 0!==this._tabsByName[e]?this._tabs[this._tabsByName[e]].tab:null},getContainer:function(e){return void 0!==this._tabsByName[e]?this._tabs[this._tabsByName[e]].container:null}}); })(this); // WCF.Poll.js -(function (window, undefined) { "use strict";WCF.Poll={},WCF.Poll.Management=Class.extend({_container:null,_count:0,_editorId:"",_maxOptions:0,init:function(e,t,i,n,o){this._count=0,this._maxOptions=i||-1,this._container=$("#"+e).children("ol:eq(0)"),this._fieldName=o||"pollOptions",this._container.length?(t=t||[],this._createOptionList(t),n?(this._editorId=n,WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+n,this._reset.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","submit_"+n,this._submit.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","validate_"+n,this._validate.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","handleError_"+n,this._handleError.bind(this))):this._container.closest("form").submit($.proxy(this._submit,this)),require(["WoltLabSuite/Core/Ui/Sortable/List"],function(t){new t({containerId:e,options:{toleranceElement:"> div"}})})):console.debug("[WCF.Poll.Management] Invalid container id given, aborting.")},_createOptionList:function(t){for(var e=0,i=t.length;e').data("optionID",e);null===i?n.appendTo(this._container):n.insertAfter(i);var o=$('
      ').appendTo(n);$('').appendTo(o),$('').click($.proxy(this._addOption,this)).appendTo(o),$('').click($.proxy(this._removeOption,this)).appendTo(o);var s=$('').keydown($.proxy(this._keyDown,this)).appendTo(o);s.click(function(){document.activeElement!==this&&this.focus()}),null!==i&&s.focus(),WCF.DOMNodeInsertedHandler.execute(),this._count++,this._count===this._maxOptions&&this._container.find("span.jsAddOption").removeClass("pointer").addClass("disabled")},_keyDown:function(t){13===t.which&&($(t.currentTarget).parent().children(".jsAddOption").trigger("click"),t.preventDefault())},_addOption:function(t){if(t.preventDefault(),this._count===this._maxOptions)return!1;var e=$(t.currentTarget).closest("li",this._container[0]);this._createOption(void 0,void 0,e)},_removeOption:function(t){t.preventDefault(),$(t.currentTarget).closest("li",this._container[0]).remove(),this._count--,this._container.find("span.jsAddOption").addClass("pointer").removeClass("disabled"),0==this._container.children("li").length&&this._createOption()},_submit:function(i){var o=[];if(this._container.children("li").each(function(t,e){var i=$(e),n=$.trim(i.find("input").val());""!=n&&o.push(i.data("optionID")+"_"+n)}),"object"==typeof i.originalEvent&&i.originalEvent instanceof Event){if(o.length)for(var t=this._container.parents("form").find(".formSubmit"),e=0,n=o.length;e').val(o[e]).appendTo(t)}else i.poll={pollOptions:o},this._container.parents(".messageTabMenuContent:eq(0)").find("input").each(function(t,e){e.name&&("checkbox"===e.type&&!e.checked||(i.poll[e.name]=e.value))})},_reset:function(){for(var t=this._container[0];1 .jsPollVote"),i=this;this._inputElements[t]=e.find("input").change(function(){i._handleVoteButton(t)}),this._handleVoteButton(t);var n=e.data("maxVotes");this._inputElements[t].filter("[type=checkbox]").length&&(this._inputElements[t].change(function(){i._enforceMaxVotes(t,n)}),this._enforceMaxVotes(t,n))},_enforceMaxVotes:function(t,e){var i=this._inputElements[t];i.filter(":checked").length==e?i.filter(":not(:checked)").disable():i.enable()},_handleVoteButton:function(t){var e=this._inputElements[t],i=this._polls[t].find(".jsButtonPollVote");e.filter(":checked").length?i.enable():i.disable()},_toggleButtons:function(t){var e=this._polls[t].children(".formSubmit");e.find(".jsButtonPollShowParticipants, .jsButtonPollShowResult, .jsButtonPollShowVote, .jsButtonPollVote").hide();var i=!0;this._polls[t].data("inVote")?(i=!1,e.find(".jsButtonPollVote").show(),this._canViewResult[t]&&e.find(".jsButtonPollShowResult").show()):(this._canVote[t]&&(i=!1,e.find(".jsButtonPollShowVote").show()),this._canViewParticipants[t]&&(i=!1,e.find(".jsButtonPollShowParticipants").show())),i&&e.hide()},_vote:function(t){var n,e=$(t.currentTarget).data("pollID");this._canVote[e]&&(n=[],this._inputElements[e].each(function(t,e){var i=$(e);i.is(":checked")&&n.push(i.data("optionID"))}),n.length&&(this._proxy.setOption("data",{actionName:"vote",optionIDs:n,pollID:e}),this._proxy.sendRequest()))}}); })(this); +(function (window, undefined) { "use strict";WCF.Poll={},WCF.Poll.Management=Class.extend({_container:null,_count:0,_editorId:"",_maxOptions:0,init:function(e,t,i,n,o){this._count=0,this._maxOptions=i||-1,this._container=$("#"+e).children("ol:eq(0)"),this._fieldName=o||"pollOptions",this._container.length?(t=t||[],this._createOptionList(t),n?(this._editorId=n,WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+n,this._reset.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","submit_"+n,this._submit.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","validate_"+n,this._validate.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","handleError_"+n,this._handleError.bind(this))):this._container.closest("form").submit($.proxy(this._submit,this)),require(["WoltLabSuite/Core/Ui/Sortable/List"],function(t){new t({containerId:e,options:{toleranceElement:"> div"}})})):console.debug("[WCF.Poll.Management] Invalid container id given, aborting.")},_createOptionList:function(t){for(var e=0,i=t.length;e').data("optionID",e);null===i?n.appendTo(this._container):n.insertAfter(i);var o=$('
      ').appendTo(n);$('').appendTo(o),$('').click($.proxy(this._addOption,this)).appendTo(o),$('').click($.proxy(this._removeOption,this)).appendTo(o);var a=$('').keydown($.proxy(this._keyDown,this)).appendTo(o);a.click(function(){document.activeElement!==this&&this.focus()}),null!==i&&a.focus(),WCF.DOMNodeInsertedHandler.execute(),this._count++,this._count===this._maxOptions&&this._container.find("span.jsAddOption").removeClass("pointer").addClass("disabled")},_keyDown:function(t){13===t.which&&($(t.currentTarget).parent().children(".jsAddOption").trigger("click"),t.preventDefault())},_addOption:function(t){if(t.preventDefault(),this._count===this._maxOptions)return!1;var e=$(t.currentTarget).closest("li",this._container[0]);this._createOption(void 0,void 0,e)},_removeOption:function(t){t.preventDefault(),$(t.currentTarget).closest("li",this._container[0]).remove(),this._count--,this._container.find("span.jsAddOption").addClass("pointer").removeClass("disabled"),0==this._container.children("li").length&&this._createOption()},_submit:function(i){var o=[];if(this._container.children("li").each(function(t,e){var i=$(e),n=$.trim(i.find("input").val());""!=n&&o.push(i.data("optionID")+"_"+n)}),"object"==typeof i.originalEvent&&i.originalEvent instanceof Event){if(o.length)for(var t=this._container.parents("form").find(".formSubmit"),e=0,n=o.length;e').val(o[e]).appendTo(t)}else i.poll={pollOptions:o},this._container.parents(".messageTabMenuContent:eq(0)").find("input").each(function(t,e){e.name&&("checkbox"===e.type&&!e.checked||(i.poll[e.name]=e.value))})},_reset:function(){for(var t=this._container[0];1 .jsPollVote"),i=this;this._inputElements[t]=e.find("input").change(function(){i._handleVoteButton(t)}),this._handleVoteButton(t);var n=e.data("maxVotes");this._inputElements[t].filter("[type=checkbox]").length&&(this._inputElements[t].change(function(){i._enforceMaxVotes(t,n)}),this._enforceMaxVotes(t,n))},_enforceMaxVotes:function(t,e){var i=this._inputElements[t];i.filter(":checked").length==e?i.filter(":not(:checked)").disable():i.enable()},_handleVoteButton:function(t){var e=this._inputElements[t],i=this._polls[t].find(".jsButtonPollVote");e.filter(":checked").length?i.enable():i.disable()},_toggleButtons:function(t){var e=this._polls[t].children(".formSubmit");e.find(".jsButtonPollShowParticipants, .jsButtonPollShowResult, .jsButtonPollShowVote, .jsButtonPollVote").hide();var i=!0;this._polls[t].data("inVote")?(i=!1,e.find(".jsButtonPollVote").show(),this._canViewResult[t]&&e.find(".jsButtonPollShowResult").show()):(this._canVote[t]&&(i=!1,e.find(".jsButtonPollShowVote").show()),this._canViewParticipants[t]&&(i=!1,e.find(".jsButtonPollShowParticipants").show())),i&&e.hide()},_vote:function(t){var n,e=$(t.currentTarget).data("pollID");this._canVote[e]&&(n=[],this._inputElements[e].each(function(t,e){var i=$(e);i.is(":checked")&&n.push(i.data("optionID"))}),n.length&&(this._proxy.setOption("data",{actionName:"vote",optionIDs:n,pollID:e}),this._proxy.sendRequest()))}}); })(this); // WCF.Search.Message.js (function (window, undefined) { "use strict";WCF.Search.Message={},WCF.Search.Message.KeywordList=WCF.Search.Base.extend({_className:"wcf\\data\\search\\keyword\\SearchKeywordAction",_divider:null,_forceSubmit:!1,init:function(e,i,s){var t,r;$.isFunction(i)?(this._callback=i,this._excludedSearchValues=[],s&&(this._excludedSearchValues=s),this._searchInput=$(e).keyup($.proxy(this._keyUp,this)).keydown($.proxy(function(e){13===e.which&&this._itemCount&&-1!==this._itemIndex&&e.preventDefault()},this)),r=(t=WCF.Dropdown.getDropdownMenu(this._searchInput.parents(".dropdown").wcfIdentify())).find("li.dropdownDivider").last(),this._divider=$('
      ").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.activityPoint")})):(this._dialog.html(this._cache[t]),this._dialog.wcfDialog("open"))},_success:function(t,e,i){this._cache[t.returnValues.userID]=t.returnValues.template,this._show(t.returnValues.userID)}},WCF.User.Profile.TabMenu=Class.extend({_hasContent:{},_profileContent:null,_proxy:null,_userID:0,init:function(t){this._profileContent=$("#profileContent"),this._userID=t;var s=this._profileContent.data("active"),a=!1;this._profileContent.find("div.tabMenuContent").each($.proxy(function(t,e){var i=$(e).wcfIdentify();s===i?this._hasContent[i]=!0:(this._hasContent[i]=!1,a=!0)},this)),a&&(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._profileContent.on("wcftabsbeforeactivate",$.proxy(this._loadContent,this)),this._profileContent.find("> nav.tabMenu > ul > li").each($.proxy(function(t,e){var i=$(e);if(i.hasClass("ui-state-active"))return t&&this._loadContent(null,{newPanel:$("#"+i.attr("aria-controls"))}),!1},this))),$('.userProfileUser .contentDescription a[href$="#likes"]').click(function(t){t.preventDefault(),require(["Ui/TabMenu"],function(t){t.getTabMenu("profileContent").select("likes")})}.bind(this))},_loadContent:function(t,e){var i=$(e.newPanel),s=i.attr("id");this._hasContent[s]||(this._proxy.setOption("data",{actionName:"getContent",className:"wcf\\data\\user\\profile\\menu\\item\\UserProfileMenuItemAction",parameters:{data:{containerID:s,menuItem:i.data("menuItem"),userID:this._userID}}}),this._proxy.sendRequest())},_success:function(i,t,e){var s=i.returnValues.containerID;this._hasContent[s]=!0,require(["Dom/ChangeListener","Dom/Util"],function(t,e){e.insertHtml(i.returnValues.template,elById(s),"append"),t.trigger()})}}),WCF.User.Profile.Editor=Class.extend({_actionName:"",_active:!1,_buttons:{},_cachedTemplate:"",_proxy:null,_tab:null,_userID:0,init:function(t,e){this._actionName="",this._active=!1,this._cachedTemplate="",this._tab=$("#about"),this._userID=t,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initButtons(),e&&this._beginEdit()},_initButtons:function(){this._buttons={beginEdit:$(".jsButtonEditProfile:eq(0)").click(this._beginEdit.bind(this))}},_beginEdit:function(t){t&&t.preventDefault(),this._active||(this._active=!0,this._actionName="beginEdit",this._buttons.beginEdit.parent().addClass("active"),$("#profileContent").wcfTabs("select","about"),this._proxy.setOption("data",{actionName:"beginEdit",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID]}),this._proxy.sendRequest())},_save:function(){var r,l,i=null;elBySelAll(".redactor-layer",this._tab[0],function(t){var e={api:{throwError:elInnerError},valid:!0};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","validate_"+elData(t,"element-id"),e),e.valid||null!==i||(i=t.parentNode)}),i?i.scrollIntoView({behavior:"smooth"}):(this._actionName="save",r=/values\[([a-zA-Z0-9._-]+)\]/,l={},this._tab.find("input, textarea, select").each(function(t,e){var i=$(e),s=null;switch(i.getTagName()){case"input":var a=i.attr("type");if(("radio"===a||"checkbox"===a)&&!i.prop("checked"))return;break;case"textarea":i.data("redactor")&&(s=i.redactor("code.get"))}var n,o=i.attr("name");r.test(o)&&(n=RegExp.$1,null===s&&(s=i.val()),"checkbox"===i.attr("type")&&/\[\]$/.test(o)?(Array.isArray(l[n])||(l[n]=[]),l[n].push(s)):l[n]=s)}),this._proxy.setOption("data",{actionName:"save",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID],parameters:{values:l}}),this._proxy.sendRequest())},_restore:function(){this._actionName="restore",this._active=!1,this._buttons.beginEdit.parent().removeClass("active"),this._destroyEditor(),this._tab.html(this._cachedTemplate).children().css({height:"auto"})},_success:function(t,e,i){switch(this._actionName){case"beginEdit":this._prepareEdit(t);break;case"save":t.returnValues.success?(this._cachedTemplate=t.returnValues.template,this._restore()):this._prepareEdit(t,!0)}},_prepareEdit:function(i,s){this._destroyEditor();var a=this;this._tab.html(function(t,e){return!0!==s&&(a._cachedTemplate=e),i.returnValues.template}),this._tab.find("input[type=text]").attr("autocomplete","off"),this._tab.find(".formSubmit > button[data-type=save]").click($.proxy(this._save,this)),this._tab.find(".formSubmit > button[data-type=restore]").click($.proxy(this._restore,this)),this._tab.find("input").keyup(function(t){if(t.which===$.ui.keyCode.ENTER)return a._save(),t.preventDefault(),!1})},_destroyEditor:function(){this._tab.find("textarea").each(function(t,e){var i=$(e);i.data("redactor")&&i.redactor("core.destroy")})}}),WCF.User.Registration={},WCF.User.Registration.Validation=Class.extend({_actionName:"",_className:"",_confirmElement:null,_element:null,_errorMessages:{},_options:{},_proxy:null,init:function(t,e,i){this._element=t,this._element.blur($.proxy(this._blur,this)),this._confirmElement=e||null,null!==this._confirmElement&&this._confirmElement.blur($.proxy(this._blurConfirm,this)),i=i||{},this._setOptions(i),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),showLoadingOverlay:!1}),this._setErrorMessages()},_setOptions:function(t){},_setErrorMessages:function(){this._errorMessages={ajaxError:"",notEqual:""}},_blur:function(t){var e=this._element.val();if(!e)return this._showError(this._element,WCF.Language.get("wcf.global.form.error.empty"));if(null!==this._confirmElement){var i=this._confirmElement.val();if(""!=i&&e!=i)return this._showError(this._confirmElement,this._errorMessages.notEqual)}this._validateOptions()&&(this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:this._getParameters()}),this._proxy.sendRequest())},_getParameters:function(){return{}},_validateOptions:function(){return!0},_blurConfirm:function(t){if(!this._confirmElement.val())return this._showError(this._confirmElement,WCF.Language.get("wcf.global.form.error.empty"));this._blur(t)},_success:function(t,e,i){t.returnValues.isValid?(this._showSuccess(this._element),null!==this._confirmElement&&this._confirmElement.val()&&this._showSuccess(this._confirmElement)):this._showError(this._element,WCF.Language.get(this._errorMessages.ajaxError+t.returnValues.error))},_showError:function(t,e){t.parent().parent().addClass("formError").removeClass("formSuccess");var i=t.parent().find("small.innerError");i.length||(i=$("").addClass("innerError").insertAfter(t)),i.text(e)},_showSuccess:function(t){t.parent().parent().addClass("formSuccess").removeClass("formError"),t.next("small.innerError").remove()}}),WCF.User.Registration.Validation.Username=WCF.User.Registration.Validation.extend({_actionName:"validateUsername",_className:"wcf\\data\\user\\UserRegistrationAction",_setOptions:function(t){this._options=$.extend(!0,{minlength:3,maxlength:25},t)},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.username.error."}},_validateOptions:function(){var t=this._element.val();return!(t.lengththis._options.maxlength)||(this._showError(this._element,WCF.Language.get("wcf.user.username.error.invalid")),!1)},_getParameters:function(){return{username:this._element.val()}}}),WCF.User.Registration.Validation.EmailAddress=WCF.User.Registration.Validation.extend({_actionName:"validateEmailAddress",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{email:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.email.error.",notEqual:WCF.Language.get("wcf.user.confirmEmail.error.notEqual")}}}),WCF.User.Registration.Validation.Password=WCF.User.Registration.Validation.extend({_actionName:"validatePassword",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{password:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.password.error.",notEqual:WCF.Language.get("wcf.user.confirmPassword.error.notEqual")}}}),WCF.User.Registration.LostPassword=Class.extend({_email:null,_username:null,init:function(){this._email=$("#emailInput"),this._username=$("#usernameInput"),this._email.keyup($.proxy(this._checkEmail,this)),this._username.keyup($.proxy(this._checkUsername,this)),$.browser.mozilla&&$.browser.touch&&(this._email.on("input",$.proxy(this._checkEmail,this)),this._username.on("input",$.proxy(this._checkUsername,this))),this._checkEmail(),this._checkUsername()},_checkEmail:function(){""==this._email.val()?(this._username.enable(),this._username.parents("dl:eq(0)").removeClass("disabled")):(this._username.disable(),this._username.parents("dl:eq(0)").addClass("disabled"),this._username.val(""))},_checkUsername:function(){""==this._username.val()?(this._email.enable(),this._email.parents("dl:eq(0)").removeClass("disabled")):(this._email.disable(),this._email.parents("dl:eq(0)").addClass("disabled"),this._email.val(""))}}),WCF.Notification={},WCF.Notification.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".contentHeaderNavigation .jsMarkAllAsConfirmed").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.user.notification.markAllAsConfirmed.confirmMessage"),function(t){"confirm"===t&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"},success:function(){window.location.reload()}})})}),this._convertList()},_convertList:function(){$(".userNotificationItemList > .notificationItem").each(function(t,e){var i=$(e);i.data("isRead")||(i.find("a:not(.userLink)").prop("href",i.data("link")),$('').appendTo(i).click($.proxy(this._markAsConfirmed,this)));var s=e.querySelector(".details > p:first-child");s.classList.add("pointer"),s.addEventListener("click",function(t){window.location.href=i.data("link")})}.bind(this)),WCF.DOMNodeInsertedHandler.execute()},_markAsConfirmed:function(t){t.preventDefault();var e=$(t.currentTarget).parents(".notificationItem:eq(0)").data("objectID");return this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[e]}),this._proxy.sendRequest(),!1},_success:function(t,e,i){var s=$(".userNotificationItemList > .notificationItem[data-object-id="+t.returnValues.markAsRead+"]");s.data("isRead",!0),s.find(".newContentBadge").remove(),s.find(".notificationItemMarkAsConfirmed").remove(),s.removeClass("notificationUnconfirmed")}}),WCF.User.SignaturePreview=WCF.Message.Preview.extend({_handleResponse:function(t){var e=$("#previewContainer");e.length||(e=$('

      '+WCF.Language.get("wcf.global.preview")+'

      ').insertBefore($("#signatureContainer")).wcfFadeIn()),e.children("div").first().html(t.returnValues.message)}}),WCF.User.RecentActivityLoader=Class.extend({_container:null,_filteredByFollowedUsers:!1,_loadButton:null,_proxy:null,_userID:0,init:function(t,e){this._container=$("#recentActivities"),this._filteredByFollowedUsers=!0===e,this._userID=t,null===this._userID||this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._container.children("li").length?(this._loadButton=$('
    • ").appendTo(this._container),this._loadButton=this._loadButton.children("button").click($.proxy(this._click,this))):$('
    • '+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"
    • ").appendTo(this._container),WCF.User.userID&&$(".jsRecentActivitySwitchContext .button").click($.proxy(this._switchContext,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_click:function(){this._loadButton.enable();var t={lastEventID:this._container.data("lastEventID"),lastEventTime:this._container.data("lastEventTime")};this._userID?t.userID=this._userID:this._filteredByFollowedUsers&&(t.filteredByFollowedUsers=1),this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction",parameters:t}),this._proxy.sendRequest()},_switchContext:function(t){t.preventDefault(),$(t.currentTarget).hasClass("active")||new WCF.Action.Proxy({autoSend:!0,data:{actionName:"switchContext",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction"},success:function(){window.location.hash="#dashboardBoxRecentActivity",window.location.reload()}})},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastEventTime",t.returnValues.lastEventTime),this._container.data("lastEventID",t.returnValues.lastEventID),this._loadButton.enable()):($(""+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"").appendTo(this._loadButton.parent()),this._loadButton.remove())}}),WCF.User.LikeLoader=Class.extend({_container:null,_likeType:"received",_likeValue:1,_loadButton:null,_noMoreEntries:null,_proxy:null,_userID:0,init:function(t){var e;this._container=$("#likeList"),this._userID=t,this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),e=$('
    • "+WCF.Language.get("wcf.like.likes.noMoreEntries")+"
    • ").appendTo(this._container),this._loadButton=e.children("button").click($.proxy(this._click,this)),this._noMoreEntries=e.children("small").hide(),2==this._container.find("> li").length&&(this._loadButton.hide(),this._noMoreEntries.show()),$("#likeType .button").click($.proxy(this._clickLikeType,this)),$("#likeValue .button").click($.proxy(this._clickLikeValue,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_clickLikeType:function(t){var e=$(t.currentTarget);this._likeType!=e.data("likeType")&&(this._likeType=e.data("likeType"),$("#likeType .button").removeClass("active"),e.addClass("active"),this._reload())},_clickLikeValue:function(t){var e=$(t.currentTarget);this._likeValue!=e.data("likeValue")&&(this._likeValue=e.data("likeValue"),$("#likeValue .button").removeClass("active"),e.addClass("active"),$("#likeType > li:first-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesReceived")),$("#likeType > li:last-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesGiven")),this._container.find("> li.likeListMore button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.more")),this._container.find("> li.likeListMore small").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.noMoreEntries")),this._reload())},_reload:function(){this._container.find("> li:not(:first-child):not(:last-child)").remove(),this._container.data("lastLikeTime",0),this._click()},_click:function(){this._loadButton.enable();var t={lastLikeTime:this._container.data("lastLikeTime"),userID:this._userID,likeType:this._likeType,likeValue:this._likeValue};this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\like\\LikeAction",parameters:t}),this._proxy.sendRequest()},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastLikeTime",t.returnValues.lastLikeTime),this._noMoreEntries.hide(),this._loadButton.show().enable()):(this._noMoreEntries.show(),this._loadButton.hide())}}),WCF.User.ProfilePreview=WCF.Popover.extend({_proxy:null,_userProfiles:{},init:function(){this._super(".userLink"),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1}),WCF.System.ObjectStore.add("WCF.User.ProfilePreview",this)},_loadContent:function(){var a,n,o=$("#"+this._activeElementID).data("userID");this._userProfiles[o]?this._insertContent(this._activeElementID,this._userProfiles[o],!0):(this._proxy.setOption("data",{actionName:"getUserProfile",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[o]}),a=this._activeElementID,(n=this)._proxy.setOption("success",function(t,e,i){n._userProfiles[o]=t.returnValues.template,n._insertContent(a,t.returnValues.template,!0)}),this._proxy.setOption("failure",function(t,e,i,s){return n._userProfiles[o]=t.message,n._insertContent(a,t.message,!0),!1}),this._proxy.sendRequest())},purge:function(t){delete this._userProfiles[t],this._data={}}}),WCF.User.Action={},WCF.User.Action.Follow=Class.extend({_containerList:null,_followButtonSelector:".jsFollowButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._followButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._followButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("following")?"unfollow":"follow",className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._followButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.following?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unfollow")).children(".icon").removeClass("fa-plus").addClass("fa-minus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unfollow"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.follow")).children(".icon").removeClass("fa-minus").addClass("fa-plus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.follow"))),i.data("following",s.returnValues.following),!1},this)),(new WCF.System.Notification).show()}}),WCF.User.Action.Ignore=Class.extend({_containerList:null,_ignoreButtonSelector:".jsIgnoreButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._ignoreButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._ignoreButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("ignored")?"unignore":"ignore",className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._ignoreButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.isIgnoredUser?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unignore")).children(".icon").removeClass("fa-ban").addClass("fa-circle-o"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unignore"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.ignore")).children(".icon").removeClass("fa-circle-o").addClass("fa-ban"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.ignore"))),i.data("ignored",s.returnValues.isIgnoredUser),!1},this)),(new WCF.System.Notification).show();var i=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(t){t.purge(i._userID)})}}),WCF.User.Avatar={},WCF.User.Avatar.Upload=WCF.Upload.extend({_userID:0,init:function(t){this._super($("#avatarUpload > dd > div"),void 0,"wcf\\data\\user\\avatar\\UserAvatarAction"),this._userID=t||0,$("#avatarForm input[type=radio]").change(function(){"custom"==$(this).val()?$("#avatarUpload > dd > div").show():$("#avatarUpload > dd > div").hide()}),$("#avatarForm input[type=radio][value=custom]:checked").length||$("#avatarUpload > dd > div").hide()},_initFile:function(t){return $("#avatarUpload > dt > img")},_success:function(t,e){e.returnValues.url?(this._updateImage(e.returnValues.url),$("#avatarUpload > dd > .innerError").remove(),new WCF.System.Notification(WCF.Language.get("wcf.user.avatar.upload.success")).show()):e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.user.avatar.upload.error."+e.returnValues.errorType))},_updateImage:function(t){$("#avatarUpload > dt > img").remove();var e=$('').css({height:"auto","max-height":"96px","max-width":"96px",width:"auto"});$("#avatarUpload > dt").prepend(e),WCF.DOMNodeInsertedHandler.execute()},_getInnerErrorElement:function(){var t=$("#avatarUpload > dd > .innerError");return t.length||(t=$('
      '),$("#avatarUpload > dd").append(t)),t},_getParameters:function(){return{userID:this._userID}}}),WCF.User.List=Class.extend({_additionalParameters:{},_cache:{},_className:"",_dialog:null,_dialogTitle:"",_pageCount:0,_pageNo:1,_proxy:null,init:function(t,e,i){this._additionalParameters=i||{},this._cache={},this._className=t,this._dialog=null,this._dialogTitle=e,this._pageCount=0,this._pageNo=1,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},open:function(){this._pageNo=1,this._showPage()},_showPage:function(t,e){var i;e&&e.activePage&&(this._pageNo=e.activePage),0!=this._pageCount&&(this._pageNo<1||this._pageNo>this._pageCount)?console.debug("[WCF.User.List] Cannot access page "+this._pageNo+" of "+this._pageCount):this._cache[this._pageNo]?(i=!1,null===this._dialog&&(this._dialog=$("#userList"+this._className.hashCode()),0===this._dialog.length&&(this._dialog=$('
      ').hide().appendTo(document.body),i=!0)),this._dialog.empty(),this._dialog.html(this._cache[this._pageNo]),1"+t.returnValues.template+"
      ").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.objectWatch.manageSubscription")})):(this._dialog.html(t.returnValues.template),this._dialog.wcfDialog("open")),this._dialog.find(".formSubmit > .jsButtonSave").data("objectID",t.returnValues.objectID).data("objectType",t.returnValues.objectType).click($.proxy(this._save,this)),s=this._dialog.find("input[name=enableNotification]").disable(),this._dialog.find("input[name=subscribe]").change(function(t){1==$(t.currentTarget).val()?s.enable():s.disable()}),(a=this._dialog.find("input[name=subscribe]:checked")).length&&1==a.val()&&s.enable()):"saveSubscription"===t.actionName&&this._dialog.is(":visible")&&(this._dialog.wcfDialog("close"),this._updateSubscriptionStatus({isSubscribed:t.returnValues.subscribe,objectID:t.returnValues.objectID}),null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))),this._notification.show())},_save:function(t){var e=this._buttons[$(t.currentTarget).data("objectType")][$(t.currentTarget).data("objectID")],i=this._dialog.find("input[name=subscribe]:checked").val(),s=this._dialog.find("input[name=enableNotification]").is(":checked")?1:0;this._proxy.setOption("data",{actionName:"saveSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{enableNotification:s,objectID:e.data("objectID"),objectType:e.data("objectType"),subscribe:i}}),this._proxy.sendRequest()},_updateSubscriptionStatus:function(t){var e=$(this._buttonSelector+"[data-object-id="+t.objectID+"]"),i=e.children(".icon");if(t.isSubscribed)i.removeClass("fa-bookmark-o").addClass("fa-bookmark"),e.data("isSubscribed",!0);else if(e.data("removeOnUnsubscribe")?e.parent().remove():(i.removeClass("fa-bookmark").addClass("fa-bookmark-o"),e.data("isSubscribed",!1)),this._reloadOnUnsubscribe)return void window.location.reload();WCF.System.Event.fireEvent("com.woltlab.wcf.objectWatch","updatedSubscription",t)}}); })(this); +(function (window, undefined) { "use strict";WCF.User.Login=Class.extend({_loginSubmitButton:null,_password:null,_passwordContainer:null,_useCookies:null,_useCookiesContainer:null,init:function(t){this._loginSubmitButton=$("#loginSubmitButton"),this._password=$("#password"),this._passwordContainer=this._password.parents("dl"),this._useCookies=$("#useCookies"),this._useCookiesContainer=this._useCookies.parents("dl"),$("#loginForm").find("input[name=action]").change($.proxy(this._change,this)),t&&WCF.User.QuickLogin.init()},_change:function(t){"register"===$(t.currentTarget).val()?this._setState(!1,WCF.Language.get("wcf.user.button.register")):this._setState(!0,WCF.Language.get("wcf.user.button.login"))},_setState:function(t,e){t?(this._password.enable(),this._passwordContainer.removeClass("disabled"),this._useCookies.enable(),this._useCookiesContainer.removeClass("disabled")):(this._password.disable(),this._passwordContainer.addClass("disabled"),this._useCookies.disable(),this._useCookiesContainer.addClass("disabled")),this._loginSubmitButton.val(e)}}),WCF.User.Panel={},WCF.User.Panel.Abstract=Class.extend({_badge:null,_dropdown:null,_identifier:"",_loadData:!0,_markAllAsReadLink:null,_options:{},_proxy:null,_triggerElement:null,_button:null,_callbackFocus:null,_callbackCloseUuid:"",_wasInsideDropdown:!1,init:function(t,e,i){var s;this._dropdown=null,this._loadData=!0,this._identifier=e,this._triggerElement=t,this._options=i,this._callbackFocus=null,this._callbackCloseUuid="",this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this)}),this._triggerElement.click($.proxy(this.toggle,this)),this._button=elBySel("a",this._triggerElement[0]),this._button&&(elAttr(this._button,"role","button"),elAttr(this._button,"tabindex","0"),elAttr(this._button,"aria-haspopup",!0),elAttr(this._button,"aria-expanded",!1)),this._options.showAllLink&&this._triggerElement.dblclick($.proxy(this._dblClick,this)),!0===this._options.staticDropdown?this._loadData=!1:(s=this._triggerElement.find("span.badge")).length&&(this._badge=s)},toggle:function(t){return t instanceof Event&&t.preventDefault(),null===this._dropdown&&(this._dropdown=this._initDropdown()),this._dropdown.toggle()?(this._loadData||null===this._badge||!parseInt(this._badge.text())||this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding").length||(this._loadData=!0),this._loadData&&(this._loadData=!1,this._load()),elAttr(this._button,"aria-expanded",!0),null===this._callbackFocus&&(this._callbackFocus=this._maintainFocus.bind(this)),document.body.addEventListener("focus",this._callbackFocus,{capture:!0}),this._callbackCloseUuid=WCF.System.Event.addListener("WCF.Dropdown.Interactive.Instance","close",function(t){t.instance===this._dropdown&&(WCF.System.Event.removeListener("WCF.Dropdown.Interactive.Instance","close",this._callbackCloseUuid),document.body.removeEventListener("focus",this._callbackFocus,{capture:!0}))}.bind(this))):(elAttr(this._button,"aria-expanded",!1),WCF.System.Event.removeListener("WCF.Dropdown.Interactive.Instance","close",this._callbackCloseUuid),document.body.removeEventListener("focus",this._callbackFocus,{capture:!0})),!1},_dblClick:function(t){return t.preventDefault(),window.location=this._options.showAllLink,!1},_initDropdown:function(){var t=WCF.Dropdown.Interactive.Handler.create(this._triggerElement,this._identifier,this._options);return $('
    • '+WCF.Language.get("wcf.global.loading")+"
    • ").appendTo(t.getItemList()),t},_load:function(){},_success:function(t){var e,i,s;void 0!==t.returnValues.template&&(e=this._dropdown.getItemList().empty(),$(t.returnValues.template).appendTo(e),e.children().length||$('
    • '+this._options.noItems+"
    • ").appendTo(e),this._options.enableMarkAsRead&&(i=this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding"),null===this._markAllAsReadLink&&i.length&&(this._markAllAsReadLink=$('
    • ').appendTo(this._dropdown.getLinkList())).click(function(t){return this._dropdown.close(),this._markAllAsRead(),!1}.bind(this)),i.each(function(t,e){var i=$(e).addClass("interactiveDropdownItemOutstandingIcon"),s=i.data("objectID");$('
      ').appendTo(i).click(function(t){return this._markAsRead(t,s),!1}.bind(this))}.bind(this))),this._dropdown.getItemList().children().each(function(t,e){var i=$(e),s=i.data("link");s&&($.browser.msie?i.click(function(t){if("A"!==t.target.tagName)return window.location=s,!1}):(i.addClass("interactiveDropdownItemShadow"),$('').appendTo(i)),i.data("linkReplaceAll")&&i.find("> .box48 a:not(.userLink)").prop("href",s))}),this._dropdown.rebuildScrollbar()),void 0!==t.returnValues.totalCount&&this.updateBadge(t.returnValues.totalCount),this._options.enableMarkAsRead&&(t.returnValues.markAsRead?(s=this._dropdown.getItemList().children("li[data-object-id="+t.returnValues.markAsRead+"]")).length&&(s.removeClass("interactiveDropdownItemOutstanding").data("isRead",!0),s.children(".interactiveDropdownItemMarkAsRead").remove()):t.returnValues.markAllAsRead&&(this.resetItems(),this.updateBadge(0)))},_markAsRead:function(t,e){},_markAllAsRead:function(){},updateBadge:function(t){(t=parseInt(t)||0)?(null===this._badge&&(this._badge=$('').appendTo(this._triggerElement.children("a")),this._badge.before(" ")),this._badge.text(t)):null!==this._badge&&(this._badge.remove(),this._badge=null),this._options.enableMarkAsRead&&(t||null===this._markAllAsReadLink||(this._markAllAsReadLink.remove(),this._markAllAsReadLink=null)),WCF.System.Event.fireEvent("com.woltlab.wcf.userMenu","updateBadge",{count:t,identifier:this._identifier})},resetItems:function(){null!==this._dropdown&&(this._dropdown.resetItems(),this._loadData=!0)},_maintainFocus:function(t){var e;document.activeElement&&!document.activeElement.classList.contains("focus-visible")||((e=this._dropdown.getContainer()[0]).contains(t.target)?this._wasInsideDropdown=!0:this._wasInsideDropdown?(this._button.focus(),this._wasInsideDropdown=!1):elBySel("a",e).focus())}}),WCF.User.Panel.Notification=WCF.User.Panel.Abstract.extend({_favico:null,init:function(t){t.enableMarkAsRead=!0,this._super($("#userNotifications"),"userNotifications",t);try{var e;this._favico=new Favico({animation:"none",type:"circle"}),null!==this._badge&&(e=parseInt(this._badge.text())||0,this._favico.badge(e))}catch(t){console.debug("[WCF.User.Panel.Notification] Failed to initialized Favico: "+t.message)}WCF.System.PushNotification.addCallback("userNotificationCount",$.proxy(this.updateUserNotificationCount,this)),require(["EventHandler"],function(t){t.add("com.woltlab.wcf.UserMenuMobile","more",function(t){"com.woltlab.wcf.notifications"===t.identifier&&this.toggle()}.bind(this))}.bind(this))},_initDropdown:function(){var t=this._super();return $('
    • ').appendTo(t.getLinkList()),t},_load:function(){this._proxy.setOption("data",{actionName:"getOutstandingNotifications",className:"wcf\\data\\user\\notification\\UserNotificationAction"}),this._proxy.sendRequest()},_markAsRead:function(t,e){this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[e]}),this._proxy.sendRequest()},_markAllAsRead:function(t){this._proxy.setOption("data",{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"}),this._proxy.sendRequest()},resetItems:function(){this._super(),this._markAllAsReadLink&&(this._markAllAsReadLink.remove(),this._markAllAsReadLink=null)},updateBadge:function(t){t=parseInt(t)||0,$("#userNotifications").attr("data-count",t),null!==this._favico&&this._favico.badge(t),this._super(t)},updateUserNotificationCount:function(t){null!==this._dropdown&&this._dropdown.resetItems(),this.updateBadge(t)},_success:function(t){this._super(t),elBySelAll(".interactiveDropdownItemShadowLink",this._dropdown.getItemList()[0],function(t){t.addEventListener("click",function(t){t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||(this._dropdown.close(),WCF.System.Event.fireEvent("com.woltlab.wcf.UserMenuMobile","close"))}.bind(this))}.bind(this))}}),WCF.User.Panel.UserMenu=WCF.User.Panel.Abstract.extend({init:function(){this._super($("#userMenu"),"userMenu",{pointerOffset:"13px",staticDropdown:!0})}}),WCF.User.QuickLogin={init:function(){require(["EventHandler","Ui/Dialog"],function(t,s){var a=elById("loginForm"),n=elBySel(".loginFormLogin",a);n&&!n.nextElementSibling&&a.classList.add("loginFormLoginOnly");for(var o=elBySel(".loginFormRegister",a),e=function(t){if(t instanceof Event&&(t.preventDefault(),t.stopPropagation()),a.style.removeProperty("display"),s.openStatic("loginForm",null,{title:WCF.Language.get("wcf.user.login")}),null!==n&&null!==o){var e=n.offsetTop,i=0;if(a.clientWidth>2*n.clientWidth)for(;e"+this._cache[t]+"
      ").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.activityPoint")})):(this._dialog.html(this._cache[t]),this._dialog.wcfDialog("open"))},_success:function(t,e,i){this._cache[t.returnValues.userID]=t.returnValues.template,this._show(t.returnValues.userID)}},WCF.User.Profile.TabMenu=Class.extend({_hasContent:{},_profileContent:null,_proxy:null,_userID:0,init:function(t){this._profileContent=$("#profileContent"),this._userID=t;var s=this._profileContent.data("active"),a=!1;this._profileContent.find("div.tabMenuContent").each($.proxy(function(t,e){var i=$(e).wcfIdentify();s===i?this._hasContent[i]=!0:(this._hasContent[i]=!1,a=!0)},this)),a&&(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._profileContent.on("wcftabsbeforeactivate",$.proxy(this._loadContent,this)),this._profileContent.find("> nav.tabMenu > ul > li").each($.proxy(function(t,e){var i=$(e);if(i.hasClass("ui-state-active"))return t&&this._loadContent(null,{newPanel:$("#"+i.attr("aria-controls"))}),!1},this))),$('.userProfileUser .contentDescription a[href$="#likes"]').click(function(t){t.preventDefault(),require(["Ui/TabMenu"],function(t){t.getTabMenu("profileContent").select("likes")})}.bind(this))},_loadContent:function(t,e){var i=$(e.newPanel),s=i.attr("id");this._hasContent[s]||(this._proxy.setOption("data",{actionName:"getContent",className:"wcf\\data\\user\\profile\\menu\\item\\UserProfileMenuItemAction",parameters:{data:{containerID:s,menuItem:i.data("menuItem"),userID:this._userID}}}),this._proxy.sendRequest())},_success:function(i,t,e){var s=i.returnValues.containerID;this._hasContent[s]=!0,require(["Dom/ChangeListener","Dom/Util"],function(t,e){e.insertHtml(i.returnValues.template,elById(s),"append"),t.trigger()})}}),WCF.User.Profile.Editor=Class.extend({_actionName:"",_active:!1,_buttons:{},_cachedTemplate:"",_proxy:null,_tab:null,_userID:0,init:function(t,e){this._actionName="",this._active=!1,this._cachedTemplate="",this._tab=$("#about"),this._userID=t,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initButtons(),e&&this._beginEdit()},_initButtons:function(){this._buttons={beginEdit:$(".jsButtonEditProfile:eq(0)").click(this._beginEdit.bind(this))}},_beginEdit:function(t){t&&t.preventDefault(),this._active||(this._active=!0,this._actionName="beginEdit",this._buttons.beginEdit.parent().addClass("active"),$("#profileContent").wcfTabs("select","about"),this._proxy.setOption("data",{actionName:"beginEdit",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID]}),this._proxy.sendRequest())},_save:function(){var r,l,i=null;elBySelAll(".redactor-layer",this._tab[0],function(t){var e={api:{throwError:elInnerError},valid:!0};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","validate_"+elData(t,"element-id"),e),e.valid||null!==i||(i=t.parentNode)}),i?i.scrollIntoView({behavior:"smooth"}):(this._actionName="save",r=/values\[([a-zA-Z0-9._-]+)\]/,l={},this._tab.find("input, textarea, select").each(function(t,e){var i=$(e),s=null;switch(i.getTagName()){case"input":var a=i.attr("type");if(("radio"===a||"checkbox"===a)&&!i.prop("checked"))return;break;case"textarea":i.data("redactor")&&(s=i.redactor("code.get"))}var n,o=i.attr("name");r.test(o)&&(n=RegExp.$1,null===s&&(s=i.val()),"checkbox"===i.attr("type")&&/\[\]$/.test(o)?(Array.isArray(l[n])||(l[n]=[]),l[n].push(s)):l[n]=s)}),this._proxy.setOption("data",{actionName:"save",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID],parameters:{values:l}}),this._proxy.sendRequest())},_restore:function(){this._actionName="restore",this._active=!1,this._buttons.beginEdit.parent().removeClass("active"),this._destroyEditor(),this._tab.html(this._cachedTemplate).children().css({height:"auto"})},_success:function(t,e,i){switch(this._actionName){case"beginEdit":this._prepareEdit(t);break;case"save":t.returnValues.success?(this._cachedTemplate=t.returnValues.template,this._restore()):this._prepareEdit(t,!0)}},_prepareEdit:function(i,s){this._destroyEditor();var a=this;this._tab.html(function(t,e){return!0!==s&&(a._cachedTemplate=e),i.returnValues.template}),this._tab.find("input[type=text]").attr("autocomplete","off"),this._tab.find(".formSubmit > button[data-type=save]").click($.proxy(this._save,this)),this._tab.find(".formSubmit > button[data-type=restore]").click($.proxy(this._restore,this)),this._tab.find("input").keyup(function(t){if(t.which===$.ui.keyCode.ENTER)return a._save(),t.preventDefault(),!1})},_destroyEditor:function(){this._tab.find("textarea").each(function(t,e){var i=$(e);i.data("redactor")&&i.redactor("core.destroy")})}}),WCF.User.Registration={},WCF.User.Registration.Validation=Class.extend({_actionName:"",_className:"",_confirmElement:null,_element:null,_errorMessages:{},_options:{},_proxy:null,init:function(t,e,i){this._element=t,this._element.blur($.proxy(this._blur,this)),this._confirmElement=e||null,null!==this._confirmElement&&this._confirmElement.blur($.proxy(this._blurConfirm,this)),i=i||{},this._setOptions(i),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),showLoadingOverlay:!1}),this._setErrorMessages()},_setOptions:function(t){},_setErrorMessages:function(){this._errorMessages={ajaxError:"",notEqual:""}},_blur:function(t){var e=this._element.val();if(!e)return this._showError(this._element,WCF.Language.get("wcf.global.form.error.empty"));if(null!==this._confirmElement){var i=this._confirmElement.val();if(""!=i&&e!=i)return this._showError(this._confirmElement,this._errorMessages.notEqual)}this._validateOptions()&&(this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:this._getParameters()}),this._proxy.sendRequest())},_getParameters:function(){return{}},_validateOptions:function(){return!0},_blurConfirm:function(t){if(!this._confirmElement.val())return this._showError(this._confirmElement,WCF.Language.get("wcf.global.form.error.empty"));this._blur(t)},_success:function(t,e,i){t.returnValues.isValid?(this._showSuccess(this._element),null!==this._confirmElement&&this._confirmElement.val()&&this._showSuccess(this._confirmElement)):this._showError(this._element,WCF.Language.get(this._errorMessages.ajaxError+t.returnValues.error))},_showError:function(t,e){t.parent().parent().addClass("formError").removeClass("formSuccess");var i=t.parent().find("small.innerError");i.length||(i=$("").addClass("innerError").insertAfter(t)),i.text(e)},_showSuccess:function(t){t.parent().parent().addClass("formSuccess").removeClass("formError"),t.next("small.innerError").remove()}}),WCF.User.Registration.Validation.Username=WCF.User.Registration.Validation.extend({_actionName:"validateUsername",_className:"wcf\\data\\user\\UserRegistrationAction",_setOptions:function(t){this._options=$.extend(!0,{minlength:3,maxlength:25},t)},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.username.error."}},_validateOptions:function(){var t=this._element.val();return!(t.lengththis._options.maxlength)||(this._showError(this._element,WCF.Language.get("wcf.user.username.error.invalid")),!1)},_getParameters:function(){return{username:this._element.val()}}}),WCF.User.Registration.Validation.EmailAddress=WCF.User.Registration.Validation.extend({_actionName:"validateEmailAddress",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{email:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.email.error.",notEqual:WCF.Language.get("wcf.user.confirmEmail.error.notEqual")}}}),WCF.User.Registration.Validation.Password=WCF.User.Registration.Validation.extend({_actionName:"validatePassword",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{password:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.password.error.",notEqual:WCF.Language.get("wcf.user.confirmPassword.error.notEqual")}}}),WCF.User.Registration.LostPassword=Class.extend({_email:null,_username:null,init:function(){this._email=$("#emailInput"),this._username=$("#usernameInput"),this._email.keyup($.proxy(this._checkEmail,this)),this._username.keyup($.proxy(this._checkUsername,this)),$.browser.mozilla&&$.browser.touch&&(this._email.on("input",$.proxy(this._checkEmail,this)),this._username.on("input",$.proxy(this._checkUsername,this))),this._checkEmail(),this._checkUsername()},_checkEmail:function(){""==this._email.val()?(this._username.enable(),this._username.parents("dl:eq(0)").removeClass("disabled")):(this._username.disable(),this._username.parents("dl:eq(0)").addClass("disabled"),this._username.val(""))},_checkUsername:function(){""==this._username.val()?(this._email.enable(),this._email.parents("dl:eq(0)").removeClass("disabled")):(this._email.disable(),this._email.parents("dl:eq(0)").addClass("disabled"),this._email.val(""))}}),WCF.Notification={},WCF.Notification.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".contentHeaderNavigation .jsMarkAllAsConfirmed").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.user.notification.markAllAsConfirmed.confirmMessage"),function(t){"confirm"===t&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"},success:function(){window.location.reload()}})})}),this._convertList()},_convertList:function(){$(".userNotificationItemList > .notificationItem").each(function(t,e){var i=$(e);i.data("isRead")||(i.find("a:not(.userLink)").prop("href",i.data("link")),$('').appendTo(i).click($.proxy(this._markAsConfirmed,this)))}.bind(this)),WCF.DOMNodeInsertedHandler.execute()},_markAsConfirmed:function(t){t.preventDefault();var e=$(t.currentTarget).parents(".notificationItem:eq(0)").data("objectID");return this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[e]}),this._proxy.sendRequest(),!1},_success:function(t,e,i){var s=$(".userNotificationItemList > .notificationItem[data-object-id="+t.returnValues.markAsRead+"]");s.data("isRead",!0),s.find(".newContentBadge").remove(),s.find(".notificationItemMarkAsConfirmed").remove(),s.removeClass("notificationUnconfirmed")}}),WCF.User.SignaturePreview=WCF.Message.Preview.extend({_handleResponse:function(t){var e=$("#previewContainer");e.length||(e=$('

      '+WCF.Language.get("wcf.global.preview")+'

      ').insertBefore($("#signatureContainer")).wcfFadeIn()),e.children("div").first().html(t.returnValues.message)}}),WCF.User.RecentActivityLoader=Class.extend({_container:null,_filteredByFollowedUsers:!1,_loadButton:null,_proxy:null,_userID:0,init:function(t,e){this._container=$("#recentActivities"),this._filteredByFollowedUsers=!0===e,this._userID=t,null===this._userID||this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._container.children("li").length?(this._loadButton=$('
    • ").appendTo(this._container),this._loadButton=this._loadButton.children("button").click($.proxy(this._click,this))):$('
    • '+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"
    • ").appendTo(this._container),WCF.User.userID&&$(".jsRecentActivitySwitchContext .button").click($.proxy(this._switchContext,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_click:function(){this._loadButton.enable();var t={lastEventID:this._container.data("lastEventID"),lastEventTime:this._container.data("lastEventTime")};this._userID?t.userID=this._userID:this._filteredByFollowedUsers&&(t.filteredByFollowedUsers=1),this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction",parameters:t}),this._proxy.sendRequest()},_switchContext:function(t){t.preventDefault(),$(t.currentTarget).hasClass("active")||new WCF.Action.Proxy({autoSend:!0,data:{actionName:"switchContext",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction"},success:function(){window.location.hash="#dashboardBoxRecentActivity",window.location.reload()}})},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastEventTime",t.returnValues.lastEventTime),this._container.data("lastEventID",t.returnValues.lastEventID),this._loadButton.enable()):($(""+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"").appendTo(this._loadButton.parent()),this._loadButton.remove())}}),WCF.User.LikeLoader=Class.extend({_container:null,_likeType:"received",_likeValue:1,_loadButton:null,_noMoreEntries:null,_proxy:null,_userID:0,init:function(t){var e;this._container=$("#likeList"),this._userID=t,this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),e=$('
    • "+WCF.Language.get("wcf.like.likes.noMoreEntries")+"
    • ").appendTo(this._container),this._loadButton=e.children("button").click($.proxy(this._click,this)),this._noMoreEntries=e.children("small").hide(),2==this._container.find("> li").length&&(this._loadButton.hide(),this._noMoreEntries.show()),$("#likeType .button").click($.proxy(this._clickLikeType,this)),$("#likeValue .button").click($.proxy(this._clickLikeValue,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_clickLikeType:function(t){var e=$(t.currentTarget);this._likeType!=e.data("likeType")&&(this._likeType=e.data("likeType"),$("#likeType .button").removeClass("active"),e.addClass("active"),this._reload())},_clickLikeValue:function(t){var e=$(t.currentTarget);this._likeValue!=e.data("likeValue")&&(this._likeValue=e.data("likeValue"),$("#likeValue .button").removeClass("active"),e.addClass("active"),$("#likeType > li:first-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesReceived")),$("#likeType > li:last-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesGiven")),this._container.find("> li.likeListMore button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.more")),this._container.find("> li.likeListMore small").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.noMoreEntries")),this._reload())},_reload:function(){this._container.find("> li:not(:first-child):not(:last-child)").remove(),this._container.data("lastLikeTime",0),this._click()},_click:function(){this._loadButton.enable();var t={lastLikeTime:this._container.data("lastLikeTime"),userID:this._userID,likeType:this._likeType,likeValue:this._likeValue};this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\like\\LikeAction",parameters:t}),this._proxy.sendRequest()},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastLikeTime",t.returnValues.lastLikeTime),this._noMoreEntries.hide(),this._loadButton.show().enable()):(this._noMoreEntries.show(),this._loadButton.hide())}}),WCF.User.ProfilePreview=WCF.Popover.extend({_proxy:null,_userProfiles:{},init:function(){this._super(".userLink"),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1}),WCF.System.ObjectStore.add("WCF.User.ProfilePreview",this)},_loadContent:function(){var a,n,o=$("#"+this._activeElementID).data("userID");this._userProfiles[o]?this._insertContent(this._activeElementID,this._userProfiles[o],!0):(this._proxy.setOption("data",{actionName:"getUserProfile",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[o]}),a=this._activeElementID,(n=this)._proxy.setOption("success",function(t,e,i){n._userProfiles[o]=t.returnValues.template,n._insertContent(a,t.returnValues.template,!0)}),this._proxy.setOption("failure",function(t,e,i,s){return n._userProfiles[o]=t.message,n._insertContent(a,t.message,!0),!1}),this._proxy.sendRequest())},purge:function(t){delete this._userProfiles[t],this._data={}}}),WCF.User.Action={},WCF.User.Action.Follow=Class.extend({_containerList:null,_followButtonSelector:".jsFollowButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._followButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._followButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("following")?"unfollow":"follow",className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._followButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.following?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unfollow")).children(".icon").removeClass("fa-plus").addClass("fa-minus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unfollow"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.follow")).children(".icon").removeClass("fa-minus").addClass("fa-plus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.follow"))),i.data("following",s.returnValues.following),!1},this)),(new WCF.System.Notification).show()}}),WCF.User.Action.Ignore=Class.extend({_containerList:null,_ignoreButtonSelector:".jsIgnoreButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._ignoreButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._ignoreButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("ignored")?"unignore":"ignore",className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._ignoreButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.isIgnoredUser?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unignore")).children(".icon").removeClass("fa-ban").addClass("fa-circle-o"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unignore"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.ignore")).children(".icon").removeClass("fa-circle-o").addClass("fa-ban"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.ignore"))),i.data("ignored",s.returnValues.isIgnoredUser),!1},this)),(new WCF.System.Notification).show();var i=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(t){t.purge(i._userID)})}}),WCF.User.Avatar={},WCF.User.Avatar.Upload=WCF.Upload.extend({_userID:0,init:function(t){this._super($("#avatarUpload > dd > div"),void 0,"wcf\\data\\user\\avatar\\UserAvatarAction"),this._userID=t||0,$("#avatarForm input[type=radio]").change(function(){"custom"==$(this).val()?$("#avatarUpload > dd > div").show():$("#avatarUpload > dd > div").hide()}),$("#avatarForm input[type=radio][value=custom]:checked").length||$("#avatarUpload > dd > div").hide()},_initFile:function(t){return $("#avatarUpload > dt > img")},_success:function(t,e){e.returnValues.url?(this._updateImage(e.returnValues.url),$("#avatarUpload > dd > .innerError").remove(),new WCF.System.Notification(WCF.Language.get("wcf.user.avatar.upload.success")).show()):e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.user.avatar.upload.error."+e.returnValues.errorType))},_updateImage:function(t){$("#avatarUpload > dt > img").remove();var e=$('').css({height:"auto","max-height":"96px","max-width":"96px",width:"auto"});$("#avatarUpload > dt").prepend(e),WCF.DOMNodeInsertedHandler.execute()},_getInnerErrorElement:function(){var t=$("#avatarUpload > dd > .innerError");return t.length||(t=$(''),$("#avatarUpload > dd").append(t)),t},_getParameters:function(){return{userID:this._userID}}}),WCF.User.List=Class.extend({_additionalParameters:{},_cache:{},_className:"",_dialog:null,_dialogTitle:"",_pageCount:0,_pageNo:1,_proxy:null,init:function(t,e,i){this._additionalParameters=i||{},this._cache={},this._className=t,this._dialog=null,this._dialogTitle=e,this._pageCount=0,this._pageNo=1,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},open:function(){this._pageNo=1,this._showPage()},_showPage:function(t,e){var i;e&&e.activePage&&(this._pageNo=e.activePage),0!=this._pageCount&&(this._pageNo<1||this._pageNo>this._pageCount)?console.debug("[WCF.User.List] Cannot access page "+this._pageNo+" of "+this._pageCount):this._cache[this._pageNo]?(i=!1,null===this._dialog&&(this._dialog=$("#userList"+this._className.hashCode()),0===this._dialog.length&&(this._dialog=$('
      ').hide().appendTo(document.body),i=!0)),this._dialog.empty(),this._dialog.html(this._cache[this._pageNo]),1"+t.returnValues.template+"
      ").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.objectWatch.manageSubscription")})):(this._dialog.html(t.returnValues.template),this._dialog.wcfDialog("open")),this._dialog.find(".formSubmit > .jsButtonSave").data("objectID",t.returnValues.objectID).data("objectType",t.returnValues.objectType).click($.proxy(this._save,this)),s=this._dialog.find("input[name=enableNotification]").disable(),this._dialog.find("input[name=subscribe]").change(function(t){1==$(t.currentTarget).val()?s.enable():s.disable()}),(a=this._dialog.find("input[name=subscribe]:checked")).length&&1==a.val()&&s.enable()):"saveSubscription"===t.actionName&&this._dialog.is(":visible")&&(this._dialog.wcfDialog("close"),this._updateSubscriptionStatus({isSubscribed:t.returnValues.subscribe,objectID:t.returnValues.objectID}),null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))),this._notification.show())},_save:function(t){var e=this._buttons[$(t.currentTarget).data("objectType")][$(t.currentTarget).data("objectID")],i=this._dialog.find("input[name=subscribe]:checked").val(),s=this._dialog.find("input[name=enableNotification]").is(":checked")?1:0;this._proxy.setOption("data",{actionName:"saveSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{enableNotification:s,objectID:e.data("objectID"),objectType:e.data("objectType"),subscribe:i}}),this._proxy.sendRequest()},_updateSubscriptionStatus:function(t){var e=$(this._buttonSelector+"[data-object-id="+t.objectID+"]"),i=e.children(".icon");if(t.isSubscribed)i.removeClass("fa-bookmark-o").addClass("fa-bookmark"),e.data("isSubscribed",!0);else if(e.data("removeOnUnsubscribe")?e.parent().remove():(i.removeClass("fa-bookmark").addClass("fa-bookmark-o"),e.data("isSubscribed",!1)),this._reloadOnUnsubscribe)return void window.location.reload();WCF.System.Event.fireEvent("com.woltlab.wcf.objectWatch","updatedSubscription",t)}}); })(this); // WCF.Moderation.js (function (window, undefined) { "use strict";WCF.Moderation={},WCF.Moderation.Management=Class.extend({_buttonSelector:"",_className:"",_confirmationTemplate:{},_dialog:null,_languageItem:"",_proxy:null,_queueID:0,_redirectURL:"",init:function(e,t,i){this._buttonSelector?this._className?(this._dialog=null,this._queueID=e,this._redirectURL=t,this._languageItem=i,this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)}),$(this._buttonSelector).click($.proxy(this._click,this)),$("#moderationAssignUser").click($.proxy(this._clickAssignedUser,this))):console.debug("[WCF.Moderation.Management] Missing class name, aborting."):console.debug("[WCF.Moderation.Management] Missing button selector, aborting.")},_click:function(e){var a=$(e.currentTarget).wcfIdentify(),t="";this._confirmationTemplate[a]&&(t=this._confirmationTemplate[a]),WCF.System.Confirmation.show(WCF.Language.get(this._languageItem.replace(/{actionName}/,a)),$.proxy(function(e,t,i){var o;"confirm"===e&&(o={actionName:a,className:this._className,objectIDs:[this._queueID]},this._confirmationTemplate[a]&&(o.parameters={},$(i).find("input, textarea").each(function(e,t){var i=$(t),a=i.val();"input"===i.getTagName()&&"checkbox"===i.attr("type")&&(i.is(":checked")||(a=null)),null!==a&&(o.parameters[i.attr("name")]=a)})),this._proxy.setOption("data",o),this._proxy.sendRequest(),$(this._buttonSelector).disable())},this),{},t)},_clickAssignedUser:function(){this._proxy.setOption("data",{actionName:"getAssignUserForm",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[this._queueID]}),this._proxy.sendRequest()},_success:function(e,t,i){switch(e.actionName){case"getAssignUserForm":null===this._dialog?(this._dialog=$("
      ").hide().appendTo(document.body),this._dialog.html(e.returnValues.template).wcfDialog({title:WCF.Language.get("wcf.moderation.assignedUser")})):this._dialog.html(e.returnValues.template).wcfDialog("open"),this._dialog.find("button[data-type=submit]").click($.proxy(this._assignUser,this));break;case"assignUser":var a=$("#moderationAssignedUserContainer > dd > span").empty();e.returnValues.userID?$(''+WCF.String.escapeHTML(e.returnValues.username)+"").appendTo(a):a.append(e.returnValues.username),a.append(" "),e.returnValues.newStatus&&$("#moderationStatusContainer > dd").text(WCF.Language.get("wcf.moderation.status."+e.returnValues.newStatus)),this._dialog.wcfDialog("close"),(new WCF.System.Notification).show();break;default:var o=new WCF.System.Notification(WCF.Language.get("wcf.global.success")),n=this;o.show(function(){window.location=n._redirectURL})}},_failure:function(e,t,i,a){if(e.returnValues&&e.returnValues.fieldName&&"assignedUsername"==e.returnValues.fieldName){this._dialog.find("small.innerError").remove();var o="";switch(e.returnValues.errorType){case"empty":o=WCF.Language.get("wcf.global.form.error.empty");break;case"notAffected":o=WCF.Language.get("wcf.moderation.assignedUser.error.notAffected");break;default:o=WCF.Language.get("wcf.user.username.error."+e.returnValues.errorType,{username:this._dialog.find("#assignedUsername").val()})}return $(''+o+"").insertAfter(this._dialog.find("#assignedUsername")),!1}return!0},_assignUser:function(){var e=this._dialog.find("input[name=assignedUserID]:checked").val(),t="";if(-1==e&&(t=$.trim(this._dialog.find("#assignedUsername").val())),-1==e&&0==t.length)return this._dialog.find("small.innerError").remove(),void $(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(this._dialog.find("#assignedUsername"));this._proxy.setOption("data",{actionName:"assignUser",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[this._queueID],parameters:{assignedUserID:e,assignedUsername:t}}),this._proxy.sendRequest()}}),WCF.Moderation.Queue={},WCF.Moderation.Queue.MarkAsRead=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(document).on("dblclick",".moderationList .new .columnAvatar",$.proxy(this._dblclick,this))},_dblclick:function(e){this._proxy.setOption("data",{actionName:"markAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[$(e.currentTarget).parents(".moderationQueueEntry:eq(0)").data("queueID")]}),this._proxy.sendRequest()},_success:function(a,e,t){$(".moderationList .new").each(function(e,t){var i=$(t);WCF.inArray(i.data("queueID"),a.objectIDs)&&(i.removeClass("new"),i.find(".columnAvatar").off("dblclick"))})}}),WCF.Moderation.Queue.MarkAllAsRead=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".markAllAsReadButton").click($.proxy(this._click,this))},_click:function(e){e.preventDefault(),this._proxy.setOption("data",{actionName:"markAllAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"}),this._proxy.sendRequest()},_success:function(e,t,i){var a=WCF.Dropdown.Interactive.Handler.getDropdown("outstandingModeration");a&&(a.getLinkList().find(".interactiveDropdownItemMarkAllAsRead").remove(),a.getItemList().find(".interactiveDropdownItemMarkAsRead").remove()),$("#outstandingModeration .badgeUpdate").remove();var o=$(".moderationList");o.find(".new").removeClass("new"),o.find(".columnAvatar").off("dblclick")}}),WCF.Moderation.Activation={},WCF.Moderation.Activation.Management=WCF.Moderation.Management.extend({init:function(e,t){this._buttonSelector="#enableContent, #removeContent",this._className="wcf\\data\\moderation\\queue\\ModerationQueueActivationAction",this._super(e,t,"wcf.moderation.activation.{actionName}.confirmMessage")}}),WCF.Moderation.Report={},WCF.Moderation.Report.Content=Class.extend({_buttons:{},_buttonSelector:"",_dialog:null,_notification:null,_objectID:0,_objectType:"",_proxy:null,init:function(e,t){this._objectType=e,this._buttonSelector=t,this._buttons={},this._notification=null,this._objectID=0,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initButtons(),WCF.DOMNodeInsertedHandler.addCallback("WCF.Moderation.Report"+this._objectType.hashCode(),$.proxy(this._initButtons,this))},_initButtons:function(){var o=this;$(this._buttonSelector).each(function(e,t){var i=$(t),a=i.wcfIdentify();o._buttons[a]||(o._buttons[a]=i).click($.proxy(o._click,o))})},_click:function(e){e.preventDefault(),this._objectID=$(e.currentTarget).data("objectID"),this._proxy.setOption("data",{actionName:"prepareReport",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{objectID:this._objectID,objectType:this._objectType}}),this._proxy.sendRequest()},_success:function(e,t,i){e.returnValues.reported?(null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.moderation.report.success"))),this._dialog.wcfDialog("close"),this._notification.show()):e.returnValues.template&&(this._showDialog(e.returnValues.template),e.returnValues.alreadyReported||this._dialog.find(".jsSubmitReport").click($.proxy(this._submit,this)))},_showDialog:function(e){null===this._dialog&&(this._dialog=$("#moderationReport"),this._dialog.length||(this._dialog=$('
      ').hide().appendTo(document.body))),this._dialog.html(e).wcfDialog({title:WCF.Language.get("wcf.moderation.report.reportContent")}).wcfDialog("render")},_submit:function(){var e=this._dialog.find(".jsReportMessage").val();if(""==$.trim(e))return this._dialog.find(".section > dl").addClass("formError"),void(this._dialog.find(".innerError").length||this._dialog.find(".jsReportMessage").after($(''+WCF.Language.get("wcf.global.form.error.empty")+"")));this._proxy.setOption("data",{actionName:"report",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{message:e,objectID:this._objectID,objectType:this._objectType}}),this._proxy.sendRequest()}}),WCF.Moderation.Report.Management=WCF.Moderation.Management.extend({init:function(e,t){this._buttonSelector="#removeContent, #removeReport",this._className="wcf\\data\\moderation\\queue\\ModerationQueueReportAction",this._super(e,t,"wcf.moderation.report.{actionName}.confirmMessage"),this._confirmationTemplate.removeContent=$('
      "}}}}),define("WoltLabSuite/Core/Ui/User/PasswordStrength",["Core","Language"],function(e,t){"use strict";function i(e,t){return e.map(t).reduce(function(e,t){return e.concat(t)},[])}function n(e){return[].concat(e,e.split(/\W+/))}function a(i){var n=e.extend({},i.default_phrases);for(var a in n)if(n.hasOwnProperty(a))for(var r in n[a])if(n[a].hasOwnProperty(r)){var o="wcf.user.password.zxcvbn."+a+"."+r,s=t.get(o);s!==o&&(n[a][r]=s)}return new i(n)}function r(e,t){require(["zxcvbn"]).then(function(i){var n=i[0];this.init(n,e,t)}.bind(this))}var o=[];return elBySel('meta[property="og:site_name"]')&&o.push(elBySel('meta[property="og:site_name"]').getAttribute("content")),r.prototype={init:function(i,n,r){this._zxcvbn=i,this._input=n,this._options=e.extend({relatedInputs:[],staticDictionary:[]},r),this._options.feedbacker||(this._options.feedbacker=a(i.Feedback)),this._wrapper=elCreate("div"),this._wrapper.className="inputAddon inputAddonPasswordStrength",this._input.parentNode.insertBefore(this._wrapper,this._input),this._wrapper.appendChild(this._input);var o=elCreate("div");o.className="passwordStrengthRating";var s=elCreate("small");s.textContent=t.get("wcf.user.password.strength"),o.appendChild(s),this._score=elCreate("span"),this._score.className="passwordStrengthScore",elData(this._score,"score","-1"),o.appendChild(this._score),this._wrapper.appendChild(o),this._feedback=elCreate("div"),this._feedback.className="passwordStrengthFeedback",this._wrapper.appendChild(this._feedback),this._verdictResult=elCreate("input"),this._verdictResult.type="hidden",this._verdictResult.name=this._input.name+"_passwordStrengthVerdict",this._wrapper.parentNode.insertBefore(this._verdictResult,this._wrapper);var l=this._evaluate.bind(this);this._input.addEventListener("input",l),this._options.relatedInputs.forEach(function(e){e.addEventListener("input",l)}),""!==this._input.value.trim()&&this._evaluate()},_evaluate:function(e){var t=i(o.concat(this._options.staticDictionary,this._options.relatedInputs.map(function(e){return e.value.trim()})),n).filter(function(e){return e.length>0}),a=this._input.value.trim(),r=this._zxcvbn(a.substr(0,100),t);r.feedback=this._options.feedbacker.from_result(r),elData(this._score,"score",0===a.length?"-1":r.score),void 0!==e&&elInnerError(this._wrapper,r.feedback.warning),this._verdictResult.value=JSON.stringify(r)}},r}),define("WoltLabSuite/Core/Controller/Condition/Page/Dependence",["Dom/ChangeListener","Dom/Traverse","EventHandler","ObjectMap"],function(e,t,i,n){"use strict";var a=elBySelAll('input[name="pageIDs[]"]'),r=[],o=new n,s=new n,l=!1;return{register:function(e,i){if(r.push(e),o.set(e,i),s.set(e,[]),!l){for(var n=0,c=a.length;n
      "+i.get("wcf.map.route.origin")+'
      '+i.get("wcf.map.route.travelMode")+'
      "}},_calculateRoute:function(e){var t=n.getDialog(this).dialog;e.label&&(this._originInput.value=e.label),void 0===this._map&&(this._map=new google.maps.Map(elByClass("googleMap",t)[0],{disableDoubleClickZoom:WCF.Location.GoogleMaps.Settings.get("disableDoubleClickZoom"),draggable:WCF.Location.GoogleMaps.Settings.get("draggable"),mapTypeId:google.maps.MapTypeId.ROADMAP,scaleControl:WCF.Location.GoogleMaps.Settings.get("scaleControl"),scrollwheel:WCF.Location.GoogleMaps.Settings.get("scrollwheel")}),this._directionsService=new google.maps.DirectionsService,this._directionsRenderer=new google.maps.DirectionsRenderer,this._directionsRenderer.setMap(this._map),this._directionsRenderer.setPanel(elByClass("googleMapsDirections",t)[0]),this._googleLink=elByClass("googleMapsDirectionsGoogleLink",t)[0]);var i={destination:this._destination,origin:e.location,provideRouteAlternatives:!0,travelMode:google.maps.TravelMode[this._travelMode.value.toUpperCase()]};a.show(),this._directionsService.route(i,this._setRoute.bind(this)),elAttr(this._googleLink,"href",this._getGoogleMapsLink(e.location,this._travelMode.value)),this._lastOrigin=e.location},_getGoogleMapsLink:function(e,t){if(e){var i="https://www.google.com/maps/dir/?api=1&origin="+e.lat()+","+e.lng()+"&destination="+this._destination.lat()+","+this._destination.lng();return t&&(i+="&travelmode="+t),i}return"https://www.google.com/maps/search/?api=1&query="+this._destination.lat()+","+this._destination.lng()},_initDialog:function(){if(!this._didInitDialog){var e=n.getDialog(this).dialog;this._originInput=elBySel('input[name="origin"]',e),new WCF.Location.GoogleMaps.LocationSearch(this._originInput,this._calculateRoute.bind(this)),this._travelMode=elBySel('select[name="travelMode"]',e),this._travelMode.addEventListener("change",this._updateRoute.bind(this)),this._didInitDialog=!0}},_openDialog:function(){n.open(this)},_setRoute:function(t,n){a.hide(),"OK"===n?(elShow(this._map.getDiv().parentNode),google.maps.event.trigger(this._map,"resize"),this._directionsRenderer.setDirections(t),elShow(e.parentByTag(this._travelMode,"DL")),elShow(this._googleLink),elInnerError(this._originInput,!1)):("OVER_QUERY_LIMIT"!==n&&"REQUEST_DENIED"!==n&&(n="NOT_FOUND"),elInnerError(this._originInput,i.get("wcf.map.route.error."+n.toLowerCase())))},_updateRoute:function(){this._calculateRoute({location:this._lastOrigin})}},r}),define("WoltLabSuite/Core/Controller/User/Notification/Settings",["Language","Ui/ReusableDropdown"],function(e,t){"use strict";var i=null,n=null;return{init:function(){elBySelAll(".jsCheckboxNotificationSettingsState",void 0,function(e){e.addEventListener("change",this._stateChange.bind(this))}.bind(this)),elBySelAll(".notificationSettingsEmailType",void 0,function(e){e.addEventListener("click",this._click.bind(this))}.bind(this))},_stateChange:function(e){var t=elData(e.currentTarget,"object-id"),i=elBySel('.notificationSettingsEmailType[data-object-id="'+t+'"]');null!==i&&i.classList[e.currentTarget.checked?"remove":"add"]("disabled")},_click:function(e){e.preventDefault(),e.stopPropagation();var t=e.currentTarget;n=~~elData(t,"object-id"),this._createDropDown(),this._setCurrentEmailType(this._getEmailTypeInputElement().value),this._showDropDown(t)},_createDropDown:function(){null===i&&(i=elCreate("ul"),i.className="dropdownMenu",["instant","daily","divider","none"].forEach(function(t){var n=elCreate("li");if("divider"===t)n.className="dropdownDivider";else{var a=elCreate("a");a.href="#",a.textContent=e.get("wcf.user.notification.mailNotificationType."+t),n.appendChild(a),elData(n,"value",t),n.addEventListener(WCF_CLICK_EVENT,this._setEmailType.bind(this))}i.appendChild(n)}.bind(this)),t.init("UiNotificationSettingsEmailType",i))},_setCurrentEmailType:function(e){elBySelAll("li",i,function(t){var i=elData(t,"value");t.classList[i===e?"add":"remove"]("active")})},_showDropDown:function(e){t.toggleDropdown("UiNotificationSettingsEmailType",e)},_setEmailType:function(t){t.preventDefault();var i=elData(t.currentTarget,"value");this._getEmailTypeInputElement().value=i;var a=elBySel('.notificationSettingsEmailType[data-object-id="'+n+'"]');a.title=e.get("wcf.user.notification.mailNotificationType."+i);var r=elBySel(".jsIconNotificationSettingsEmailType",a);switch(r.classList.remove("fa-clock-o"),r.classList.remove("fa-flash"),r.classList.remove("fa-times"),r.classList.remove("green"),r.classList.remove("red"),i){case"daily":r.classList.add("fa-clock-o"),r.classList.add("green");break;case"instant":r.classList.add("fa-flash"),r.classList.add("green");break;case"none":r.classList.add("fa-times"),r.classList.add("red")}n=null},_getEmailTypeInputElement:function(){return elById("settings_"+n+"_mailNotificationType")}}}),define("WoltLabSuite/Core/Form/Builder/Container/SuffixFormField",["EventHandler","Ui/SimpleDropdown"],function(e,t){"use strict";function i(i,n){this._formId=i,this._suffixField=elById(n),this._suffixDropdownMenu=t.getDropdownMenu(n+"_dropdown"),this._suffixDropdownToggle=elByClass("dropdownToggle",t.getDropdown(n+"_dropdown"))[0];for(var a=this._suffixDropdownMenu.children,r=0,o=a.length;r'}},_destroyDropdown:function(e){e.formId===this._formId&&t.destroy(this._suffixDropdownMenu.id)}},i}),define("WoltLabSuite/Core/Form/Builder/Field/Acl",["Core","./Field"],function(e,t){"use strict";function i(e){this.init(e),this._aclList=null}return e.inherit(i,t,{_getData:function(){var e={};return e[this._fieldId]=this._aclList.getData(),e},_readField:function(){},setAclList:function(e){this._aclList=e}}),i}),define("WoltLabSuite/Core/Form/Builder/Field/Captcha",["Core","./Field","WoltLabSuite/Core/Controller/Captcha"],function(e,t,i){"use strict";function n(e){this.init(e)}return e.inherit(n,t,{_getData:function(){return i.has(this._fieldId)?i.getData(this._fieldId):{}},_readField:function(){},destroy:function(){i.has(this._fieldId)&&i.delete(this._fieldId)}}),n}),define("WoltLabSuite/Core/Form/Builder/Field/Checkboxes",["Core","./Field"],function(e,t){"use strict";function i(e){this.init(e)}return e.inherit(i,t,{_getData:function(){var e={};e[this._fieldId]=[];for(var t=0,i=this._fields.length;t1?e[this._fieldId+"_i18n"]=t.toObject():e[this._fieldId]=t.get(0),e},destroy:function(){i.unregister(this._fieldId)}}),n}),define("WoltLabSuite/Core/Ui/Comment/Response/Add",["Core","Language","Dom/ChangeListener","Dom/Util","Dom/Traverse","Ui/Notification","WoltLabSuite/Core/Ui/Comment/Add"],function(e,t,i,n,a,r,o){"use strict";function s(e,t){this.init(e,t)}return e.inherit(s,o,{init:function(t,i){s._super.prototype.init.call(this,t),this._options=e.extend({callbackInsert:null},i)},getContainer:function(){return this._isBusy?null:this._container},getContent:function(){return window.jQuery(this._textarea).redactor("code.get")},setContent:function(e){window.jQuery(this._textarea).redactor("code.set",e),window.jQuery(this._textarea).redactor("WoltLabCaret.endOfEditor");var t=elBySel(".innerError",this._textarea.parentNode);null!==t&&elRemove(t),this._content.classList.remove("collapsed"),this._focusEditor()},_getParameters:function(){var e=s._super.prototype._getParameters.call(this);return e.data.commentID=~~elData(this._container.closest(".comment"),"object-id"),e},_insertMessage:function(e){var o=a.childByClass(this._container.parentNode,"commentContent"),s=o.nextElementSibling;return null!==s&&s.classList.contains("commentResponseList")||(s=elCreate("ul"),s.className="containerList commentResponseList",elData(s,"responses",0),o.parentNode.insertBefore(s,o.nextSibling)),n.insertHtml(e.returnValues.template,s,"append"),r.show(t.get("wcf.global.success.add")),i.trigger(),window.jQuery(this._textarea).redactor("code.set",""),null!==this._options.callbackInsert&&this._options.callbackInsert(),elData(s,"responses",s.children.length),s.lastElementChild},_ajaxSetup:function(){var e=s._super.prototype._ajaxSetup.call(this);return e.data.actionName="addResponse",e}}),s}),define("WoltLabSuite/Core/Ui/Comment/Response/Edit",["Ajax","Core","Dictionary","Environment","EventHandler","Language","List","Dom/ChangeListener","Dom/Traverse","Dom/Util","Ui/Notification","Ui/ReusableDropdown","WoltLabSuite/Core/Ui/Scroll","WoltLabSuite/Core/Ui/Comment/Edit"],function(e,t,i,n,a,r,o,s,l,c,d,u,h,f){"use strict";function p(e){this.init(e)}return t.inherit(p,f,{init:function(e){this._activeElement=null,this._callbackClick=null,this._container=e,this._editorContainer=null,this._responses=new o,this.rebuild(),s.add("Ui/Comment/Response/Edit_"+c.identify(this._container),this.rebuild.bind(this))},rebuild:function(){elBySelAll(".commentResponse",this._container,function(e){if(!this._responses.has(e)){if(elDataBool(e,"can-edit")){var t=elBySel(".jsCommentResponseEditButton",e);null!==t&&(null===this._callbackClick&&(this._callbackClick=this._click.bind(this)),t.addEventListener(WCF_CLICK_EVENT,this._callbackClick))}this._responses.add(e)}}.bind(this))},_click:function(t){t.preventDefault(),null===this._activeElement?(this._activeElement=t.currentTarget.closest(".commentResponse"),this._prepare(),e.api(this,{actionName:"beginEdit",objectIDs:[this._getObjectId(this._activeElement)]})):d.show("wcf.message.error.editorAlreadyInUse",null,"warning")},_prepare:function(){this._editorContainer=elCreate("div"),this._editorContainer.className="commentEditorContainer",this._editorContainer.innerHTML='';var e=elBySel(".commentResponseContent",this._activeElement);e.insertBefore(this._editorContainer,e.firstChild)},_showMessage:function(e){c.setInnerHtml(elBySel(".commentResponseContent .userMessage",this._editorContainer.parentNode),e.returnValues.message),this._restoreMessage(),d.show()},_getEditorId:function(){return"commentResponseEditor"+this._getObjectId(this._activeElement)},_ajaxSetup:function(){return{data:{className:"wcf\\data\\comment\\response\\CommentResponseAction",parameters:{data:{objectTypeID:~~elData(this._container,"object-type-id")}}},silent:!0}}}),p}),define("WoltLabSuite/Core/Ui/Page/Header/Fixed",["Core","EventHandler","Ui/Alignment","Ui/CloseOverlay","Ui/SimpleDropdown","Ui/Screen"],function(e,t,i,n,a,r){"use strict";var o,s,l,c,d,u,h,f=!1;return{init:function(){o=elById("pageHeader"),s=elById("pageHeaderContainer"),this._initSearchBar(),r.on("screen-md-down",{match:function(){f=!0},unmatch:function(){f=!1},setup:function(){f=!0}}),t.add("com.woltlab.wcf.Search","close",this._closeSearchBar.bind(this))},_initSearchBar:function(){c=elById("pageHeaderSearch"),c.addEventListener(WCF_CLICK_EVENT,function(e){e.stopPropagation()}),l=elById("pageHeaderPanel"),d=elById("pageHeaderSearchInput"),u=elById("topMenu"),h=elById("userPanelSearchButton"),h.addEventListener(WCF_CLICK_EVENT,function(e){e.preventDefault(),e.stopPropagation(),o.classList.contains("searchBarOpen")?this._closeSearchBar():this._openSearchBar()}.bind(this)),n.add("WoltLabSuite/Core/Ui/Page/Header/Fixed",function(){o.classList.contains("searchBarForceOpen")||this._closeSearchBar()}.bind(this)),t.add("com.woltlab.wcf.MainMenuMobile","more",function(t){"com.woltlab.wcf.search"===t.identifier&&(t.handler.close(!0),e.triggerEvent(h,WCF_CLICK_EVENT))}.bind(this))},_openSearchBar:function(){window.WCF.Dropdown.Interactive.Handler.closeAll(),o.classList.add("searchBarOpen"),h.parentNode.classList.add("open"),f||i.set(c,u,{horizontal:"right"}),c.style.setProperty("top",l.clientHeight+"px",""),d.focus(),window.setTimeout(function(){d.selectionStart=d.selectionEnd=d.value.length},1)},_closeSearchBar:function(){o.classList.remove("searchBarOpen"),h.parentNode.classList.remove("open"),["bottom","left","right","top"].forEach(function(e){c.style.removeProperty(e)}),d.blur();var e=elBySel(".pageHeaderSearchType",c);a.close(e.id)}}}),define("WoltLabSuite/Core/Ui/Page/Search/Input",["Core","WoltLabSuite/Core/Ui/Search/Input"],function(e,t){"use strict";function i(e,t){this.init(e,t)}return e.inherit(i,t,{init:function(t,n){if(n=e.extend({ajax:{className:"wcf\\data\\page\\PageAction"},callbackSuccess:null},n),"function"!=typeof n.callbackSuccess)throw new Error("Expected a valid callback function for 'callbackSuccess'.");i._super.prototype.init.call(this,t,n),this._pageId=0},setPageId:function(e){this._pageId=e},_getParameters:function(e){var t=i._super.prototype._getParameters.call(this,e);return t.objectIDs=[this._pageId],t},_ajaxSuccess:function(e){this._options.callbackSuccess(e)}}),i}),define("WoltLabSuite/Core/Ui/Page/Search/Handler",["Language","StringUtil","Dom/Util","Ui/Dialog","./Input"],function(e,t,i,n,a){"use strict";var r=null,o=null,s=null,l=null,c=null,d=null;return{open:function(t,i,a,o){r=a,n.open(this),n.setTitle(this,i),s.textContent=o?e.get(o):e.get("wcf.page.pageObjectID.search.terms"),this._getSearchInputHandler().setPageId(t)},_buildList:function(i){if(this._resetList(),!Array.isArray(i.returnValues)||0===i.returnValues.length)return void elInnerError(o,e.get("wcf.page.pageObjectID.search.noResults"));for(var n,a,r,s=0,l=i.returnValues.length;s'),r=elCreate("li"),elData(r,"object-id",a.objectID),r.innerHTML='
      '+n+'

      '+t.escapeHTML(a.title)+"

      "+(a.description?"

      "+a.description+"

      ":"")+"
      ",r.addEventListener(WCF_CLICK_EVENT,this._click.bind(this)),c.appendChild(r);elShow(d)},_resetList:function(){elInnerError(o,!1),c.innerHTML="",elHide(d)},_getSearchInputHandler:function(){if(null===l){var e=this._buildList.bind(this);l=new a(elById("wcfUiPageSearchInput"),{callbackSuccess:e})}return l},_click:function(e){"A"!==e.target.nodeName&&(e.stopPropagation(),r(elData(e.currentTarget,"object-id")),n.close(this))},_dialogSetup:function(){return{id:"wcfUiPageSearchHandler",options:{onShow:function(){null===o&&(o=elById("wcfUiPageSearchInput"),s=o.parentNode.previousSibling.childNodes[0],c=elById("wcfUiPageSearchResultList"),d=elById("wcfUiPageSearchResultListContainer")),o.value="",elHide(d),c.innerHTML="",o.focus()},title:""},source:'

      '+e.get("wcf.page.pageObjectID.search.results")+'

        '}}}}),define("WoltLabSuite/Core/Ui/Reaction/Profile/Loader",["Ajax","Core","Language"],function(e,t,i){"use strict";function n(e){this.init(e)}return n.prototype={init:function(e){if(this._container=elById("likeList"),this._userID=e,this._reactionTypeID=null,this._targetType="received",this._options={parameters:[]},!this._userID)throw new Error("[WoltLabSuite/Core/Ui/Reaction/Profile/Loader] Invalid parameter 'userID' given.");var t=elCreate("li");t.className="likeListMore showMore",this._noMoreEntries=elCreate("small"),this._noMoreEntries.innerHTML=i.get("wcf.like.reaction.noMoreEntries"),this._noMoreEntries.style.display="none",t.appendChild(this._noMoreEntries),this._loadButton=elCreate("button"),this._loadButton.className="small",this._loadButton.innerHTML=i.get("wcf.like.reaction.more"),this._loadButton.addEventListener(WCF_CLICK_EVENT,this._loadReactions.bind(this)),this._loadButton.style.display="none",t.appendChild(this._loadButton),this._container.appendChild(t),2===elBySel("#likeList > li").length?this._noMoreEntries.style.display="":this._loadButton.style.display="",this._setupReactionTypeButtons(),this._setupTargetTypeButtons()},_setupReactionTypeButtons:function(){for(var e,t=elBySelAll("#reactionType .button"),i=0,n=t.length;i li:not(:first-child):not(:last-child)"),t=0,i=e.length;t li:nth-last-child(1)").insertAdjacentHTML("beforebegin",e.returnValues.template),elData(this._container,"last-like-time",e.returnValues.lastLikeTime),this._noMoreEntries.style.display="none",this._loadButton.style.display=""):(this._noMoreEntries.style.display="",this._loadButton.style.display="none")},_ajaxSetup:function(){return{data:{actionName:"load",className:"\\wcf\\data\\reaction\\ReactionAction"}}}},n}),define("WoltLabSuite/Core/Ui/User/Activity/Recent",["Ajax","Language","Dom/Util"],function(e,t,i){"use strict";function n(e){this.init(e)}return n.prototype={init:function(e){this._containerId=e;var i=elById(this._containerId);this._list=elBySel(".recentActivityList",i);var n=elCreate("li");n.className="showMore",this._list.childElementCount?(n.innerHTML='",n.children[0].addEventListener(WCF_CLICK_EVENT,this._showMore.bind(this))):n.innerHTML=""+t.get("wcf.user.recentActivity.noMoreEntries")+"",this._list.appendChild(n),this._showMoreItem=n,elBySelAll(".jsRecentActivitySwitchContext .button",i,function(e){e.addEventListener(WCF_CLICK_EVENT,function(t){t.preventDefault(),e.classList.contains("active")||this._switchContext()}.bind(this))}.bind(this))},_showMore:function(t){t.preventDefault(),this._showMoreItem.children[0].disabled=!0,e.api(this,{actionName:"load",parameters:{boxID:~~elData(this._list,"box-id"),filteredByFollowedUsers:elDataBool(this._list,"filtered-by-followed-users"),lastEventId:elData(this._list,"last-event-id"),lastEventTime:elData(this._list,"last-event-time"),userID:~~elData(this._list,"user-id")}})},_switchContext:function(){e.api(this,{actionName:"switchContext"},function(){window.location.hash="#"+this._containerId,window.location.reload()}.bind(this))},_ajaxSuccess:function(e){e.returnValues.template?(i.insertHtml(e.returnValues.template,this._showMoreItem,"before"),elData(this._list,"last-event-time",e.returnValues.lastEventTime),elData(this._list,"last-event-id",e.returnValues.lastEventID),this._showMoreItem.children[0].disabled=!1):this._showMoreItem.innerHTML=""+t.get("wcf.user.recentActivity.noMoreEntries")+""},_ajaxSetup:function(){return{data:{className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction"}}}},n}),define("WoltLabSuite/Core/Ui/User/CoverPhoto/Delete",["Ajax","EventHandler","Language","Ui/Confirmation","Ui/Notification"],function(e,t,i,n,a){"use strict";var r,o=0;return{init:function(e){r=elBySel(".jsButtonDeleteCoverPhoto"),r.addEventListener(WCF_CLICK_EVENT,this._click.bind(this)),o=e,t.add("com.woltlab.wcf.user","coverPhoto",function(e){"string"==typeof e.url&&e.url.length>0&&elShow(r.parentNode)})},_click:function(t){t.preventDefault(),n.show({confirm:e.api.bind(e,this),message:i.get("wcf.user.coverPhoto.delete.confirmMessage")})},_ajaxSuccess:function(e){elBySel(".userProfileCoverPhoto").style.setProperty("background-image","url("+e.returnValues.url+")",""),elHide(r.parentNode),a.show()},_ajaxSetup:function(){return{data:{actionName:"deleteCoverPhoto",className:"wcf\\data\\user\\UserProfileAction", -parameters:{userID:o}}}}}}),define("WoltLabSuite/Core/Ui/User/CoverPhoto/Upload",["Core","EventHandler","Upload","Ui/Notification","Ui/Dialog"],function(e,t,i,n,a){"use strict";function r(e){i.call(this,"coverPhotoUploadButtonContainer","coverPhotoUploadPreview",{action:"uploadCoverPhoto",className:"wcf\\data\\user\\UserProfileAction"}),this._userId=e}return e.inherit(r,i,{_getParameters:function(){return{userID:this._userId}},_success:function(e,i){elInnerError(this._button,i.returnValues.errorMessage),this._target.innerHTML="",i.returnValues.url&&(elBySel(".userProfileCoverPhoto").style.setProperty("background-image","url("+i.returnValues.url+")",""),a.close("userProfileCoverPhotoUpload"),n.show(),t.fire("com.woltlab.wcf.user","coverPhoto",{url:i.returnValues.url}))}}),r}),define("WoltLabSuite/Core/Ui/User/Trophy/List",["Ajax","Core","Dictionary","Dom/Util","Ui/Dialog","WoltLabSuite/Core/Ui/Pagination","Dom/ChangeListener","List"],function(e,t,i,n,a,r,o,s){"use strict";function l(){this.init()}return l.prototype={init:function(){this._cache=new i,this._knownElements=new s,this._options={className:"wcf\\data\\user\\trophy\\UserTrophyAction",parameters:{}},this._rebuild(),o.add("WoltLabSuite/Core/Ui/User/Trophy/List",this._rebuild.bind(this))},_rebuild:function(){elBySelAll(".userTrophyOverlayList",void 0,function(e){this._knownElements.has(e)||(e.addEventListener(WCF_CLICK_EVENT,this._open.bind(this,elData(e,"user-id"))),this._knownElements.add(e))}.bind(this))},_open:function(e,t){t.preventDefault(),this._currentPageNo=1,this._currentUser=e,this._showPage()},_showPage:function(t){if(void 0!==t&&(this._currentPageNo=t),this._cache.has(this._currentUser)){if(0!==this._cache.get(this._currentUser).get("pageCount")&&(this._currentPageNo<1||this._currentPageNo>this._cache.get(this._currentUser).get("pageCount")))throw new RangeError("pageNo must be between 1 and "+this._cache.get(this._currentUser).get("pageCount")+" ("+this._currentPageNo+" given).")}else this._cache.set(this._currentUser,new i);if(this._cache.get(this._currentUser).has(this._currentPageNo)){var n=a.open(this,this._cache.get(this._currentUser).get(this._currentPageNo));if(a.setTitle("userTrophyListOverlay",this._cache.get(this._currentUser).get("title")),this._cache.get(this._currentUser).get("pageCount")>1){var o=elBySel(".jsPagination",n.content);null!==o&&new r(o,{activePage:this._currentPageNo,maxPage:this._cache.get(this._currentUser).get("pageCount"),callbackSwitch:this._showPage.bind(this)})}}else this._options.parameters.pageNo=this._currentPageNo,this._options.parameters.userID=this._currentUser,e.api(this,{parameters:this._options.parameters})},_ajaxSuccess:function(e){void 0!==e.returnValues.pageCount&&this._cache.get(this._currentUser).set("pageCount",~~e.returnValues.pageCount),this._cache.get(this._currentUser).set(this._currentPageNo,e.returnValues.template),this._cache.get(this._currentUser).set("title",e.returnValues.title),this._showPage()},_ajaxSetup:function(){return{data:{actionName:"getGroupedUserTrophyList",className:this._options.className}}},_dialogSetup:function(){return{id:"userTrophyListOverlay",options:{title:""},source:null}}},l}),define("WoltLabSuite/Core/Form/Builder/Field/Controller/Label",["Core","Dom/Util","Language","Ui/SimpleDropdown"],function(e,t,i,n){"use strict";function a(e,t,i){this.init(e,t,i)}return a.prototype={init:function(a,r,o){this._formFieldContainer=elById(a+"Container"),this._labelChooser=elByClass("labelChooser",this._formFieldContainer)[0],this._options=e.extend({forceSelection:!1,showWithoutSelection:!1},o),this._input=elCreate("input"),this._input.type="hidden",this._input.id=a,this._input.name=a,this._input.value=~~r,this._formFieldContainer.appendChild(this._input);var s=t.identify(this._labelChooser),l=n.getDropdownMenu(s);null===l&&(n.init(elByClass("dropdownToggle",this._labelChooser)[0]),l=n.getDropdownMenu(s));var c=null;if(this._options.showWithoutSelection||!this._options.forceSelection){c=elCreate("ul"),l.appendChild(c);var d=elCreate("li");d.className="dropdownDivider",c.appendChild(d)}if(this._options.showWithoutSelection){var u=elCreate("li");elData(u,"label-id",-1),this._blockScroll(u),c.appendChild(u);var h=elCreate("span");u.appendChild(h);var f=elCreate("span");f.className="badge label",f.innerHTML=i.get("wcf.label.withoutSelection"),h.appendChild(f)}if(!this._options.forceSelection){var u=elCreate("li");elData(u,"label-id",0),this._blockScroll(u),c.appendChild(u);var h=elCreate("span");u.appendChild(h);var f=elCreate("span");f.className="badge label",f.innerHTML=i.get("wcf.label.none"),h.appendChild(f)}elBySelAll("li:not(.dropdownDivider)",l,function(e){e.addEventListener("click",this._click.bind(this)),r&&~~elData(e,"label-id")===r&&this._selectLabel(e)}.bind(this))},_blockScroll:function(e){e.addEventListener("wheel",function(e){e.preventDefault()},{passive:!1})},_click:function(e){e.preventDefault(),this._selectLabel(e.currentTarget,!1)},_selectLabel:function(e){var t=elData(e,"label-id");t||(t=0);var i=elBySel("span > span",e),n=elBySel(".dropdownToggle > span",this._labelChooser);n.className=i.className,n.textContent=i.textContent,this._input.value=t}},a}),define("WoltLabSuite/Core/Form/Builder/Field/Controller/Rating",["Dictionary","Environment"],function(e,t){"use strict";function i(e,t,i,n){this.init(e,t,i,n)}return i.prototype={init:function(t,i,n,a){if(this._field=elBySel("#"+t+"Container"),null===this._field)throw new Error("Unknown field with id '"+t+"'");this._input=elCreate("input"),this._input.id=t,this._input.name=t,this._input.type="hidden",this._input.value=i,this._field.appendChild(this._input),this._activeCssClasses=n,this._defaultCssClasses=a,this._ratingElements=new e;var r=elBySel(".ratingList",this._field);r.addEventListener("mouseleave",this._restoreRating.bind(this)),elBySelAll("li",r,function(e){e.classList.contains("ratingMetaButton")?(e.addEventListener("click",this._metaButtonClick.bind(this)),e.addEventListener("mouseenter",this._restoreRating.bind(this))):(this._ratingElements.set(~~elData(e,"rating"),e),e.addEventListener("click",this._listItemClick.bind(this)),e.addEventListener("mouseenter",this._listItemMouseEnter.bind(this)),e.addEventListener("mouseleave",this._listItemMouseLeave.bind(this)))}.bind(this))},_listItemClick:function(e){this._input.value=~~elData(e.currentTarget,"rating"),"desktop"!==t.platform()&&this._restoreRating()},_listItemMouseEnter:function(e){var t=elData(e.currentTarget,"rating");this._ratingElements.forEach(function(e,i){var n=elByClass("icon",e)[0];this._toggleIcon(n,~~i<=~~t)}.bind(this))},_listItemMouseLeave:function(){this._ratingElements.forEach(function(e){var t=elByClass("icon",e)[0];this._toggleIcon(t,!1)}.bind(this))},_metaButtonClick:function(e){"removeRating"===elData(e.currentTarget,"action")&&(this._input.value="",this._listItemMouseLeave())},_restoreRating:function(){this._ratingElements.forEach(function(e,t){var i=elByClass("icon",e)[0];this._toggleIcon(i,~~t<=~~this._input.value)}.bind(this))},_toggleIcon:function(e,t){if(t=t||!1){for(var i=0;i nav > ul > li[data-name="+this._container.id+"]",this._container.parentNode.parentNode);if(null===l)throw new Error("Cannot find tab menu entry for tab '"+this._container.id+"'.");if(t)elShow(this._container),elShow(l);else{elHide(this._container),elHide(l);var c=a.getTabMenu(i.identify(l.closest(".tabMenuContainer")));c.getActiveTab()===l&&c.selectFirstVisible()}n.checkContainers()}}}}),r}),define("WoltLabSuite/Core/Form/Builder/Field/Dependency/Container/TabMenu",["./Abstract","Core","Dom/Util","../Manager","Ui/TabMenu"],function(e,t,i,n,a){"use strict";function r(e){this.init(e)}return t.inherit(r,e,{checkContainer:function(){if(!n.isHiddenByDependencies(this._container)){for(var e=!elIsHidden(this._container),t=!1,r=elBySelAll("#"+i.identify(this._container)+" > nav > ul > li",this._container.parentNode),o=0,s=r.length;o 0) { + ary.splice(i - 1, 2); + i -= 2; + } + } + } + } + + /** + * Given a relative module name, like ./something, normalize it to + * a real name that can be mapped to a path. + * @param {String} name the relative name + * @param {String} baseName a real name that the name arg is relative + * to. + * @param {Boolean} applyMap apply the map config to the value. Should + * only be done if this normalization is for a dependency ID. + * @returns {String} normalized name + */ + function normalize(name, baseName, applyMap) { + var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, + foundMap, foundI, foundStarMap, starI, + baseParts = baseName && baseName.split('/'), + normalizedBaseParts = baseParts, + map = config.map, + starMap = map && map['*']; + + + //Adjust any relative paths. + if (name) { + name = name.split('/'); + lastIndex = name.length - 1; + + // If wanting node ID compatibility, strip .js from end + // of IDs. Have to do this here, and not in nameToUrl + // because node allows either .js or non .js to map + // to same file. + if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { + name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); + } + + // Starts with a '.' so need the baseName + if (name[0].charAt(0) === '.' && baseParts) { + //Convert baseName to array, and lop off the last part, + //so that . matches that 'directory' and not name of the baseName's + //module. For instance, baseName of 'one/two/three', maps to + //'one/two/three.js', but we want the directory, 'one/two' for + //this normalization. + normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); + name = normalizedBaseParts.concat(name); + } + + trimDots(name); + name = name.join('/'); + } + + // Apply map config if available. + if (applyMap && map && (baseParts || starMap)) { + nameParts = name.split('/'); + + outerLoop: for (i = nameParts.length; i > 0; i -= 1) { + nameSegment = nameParts.slice(0, i).join('/'); + + if (baseParts) { + // Find the longest baseName segment match in the config. + // So, do joins on the biggest to smallest lengths of baseParts. + for (j = baseParts.length; j > 0; j -= 1) { + mapValue = getOwn(map, baseParts.slice(0, j).join('/')); + + // baseName segment has config, find if it has one for + // this name. + if (mapValue) { + mapValue = getOwn(mapValue, nameSegment); + if (mapValue) { + // Match, update name to the new value. + foundMap = mapValue; + foundI = i; + break outerLoop; + } + } + } + } + + // Check for a star map match, but just hold on to it, + // if there is a shorter segment match later in a matching + // config, then favor over this star map. + if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) { + foundStarMap = getOwn(starMap, nameSegment); + starI = i; + } + } + + if (!foundMap && foundStarMap) { + foundMap = foundStarMap; + foundI = starI; + } + + if (foundMap) { + nameParts.splice(0, foundI, foundMap); + name = nameParts.join('/'); + } + } + + // If the name points to a package's name, use + // the package main instead. + pkgMain = getOwn(config.pkgs, name); + + return pkgMain ? pkgMain : name; + } + + function makeShimExports(value) { + function fn() { + var ret; + if (value.init) { + ret = value.init.apply(global, arguments); + } + return ret || (value.exports && getGlobal(value.exports)); + } + return fn; + } + + function takeQueue(anonId) { + var i, id, args, shim; + for (i = 0; i < queue.length; i += 1) { + // Peek to see if anon + if (typeof queue[i][0] !== 'string') { + if (anonId) { + queue[i].unshift(anonId); + anonId = undef; + } else { + // Not our anon module, stop. + break; + } + } + args = queue.shift(); + id = args[0]; + i -= 1; + + if (!(id in defined) && !(id in waiting)) { + if (id in deferreds) { + main.apply(undef, args); + } else { + waiting[id] = args; + } + } + } + + // if get to the end and still have anonId, then could be + // a shimmed dependency. + if (anonId) { + shim = getOwn(config.shim, anonId) || {}; + main(anonId, shim.deps || [], shim.exportsFn); + } + } + + function makeRequire(relName, topLevel) { + var req = function (deps, callback, errback, alt) { + var name, cfg; + + if (topLevel) { + takeQueue(); + } + + if (typeof deps === "string") { + if (handlers[deps]) { + return handlers[deps](relName); + } + // Just return the module wanted. In this scenario, the + // deps arg is the module name, and second arg (if passed) + // is just the relName. + // Normalize module name, if it contains . or .. + name = makeMap(deps, relName, true).id; + if (!(name in defined)) { + throw new Error('Not loaded: ' + name); + } + return defined[name]; + } else if (deps && !Array.isArray(deps)) { + // deps is a config object, not an array. + cfg = deps; + deps = undef; + + if (Array.isArray(callback)) { + // callback is an array, which means it is a dependency list. + // Adjust args if there are dependencies + deps = callback; + callback = errback; + errback = alt; + } + + if (topLevel) { + // Could be a new context, so call returned require + return req.config(cfg)(deps, callback, errback); + } + } + + // Support require(['a']) + callback = callback || function () { + // In case used later as a promise then value, return the + // arguments as an array. + return slice.call(arguments, 0); + }; + + // Complete async to maintain expected execution semantics. + return asyncResolve.then(function () { + // Grab any modules that were defined after a require call. + takeQueue(); + + return main(undef, deps || [], callback, errback, relName); + }); + }; + + req.isBrowser = typeof document !== 'undefined' && + typeof navigator !== 'undefined'; + + req.nameToUrl = function (moduleName, ext, skipExt) { + var paths, syms, i, parentModule, url, + parentPath, bundleId, + pkgMain = getOwn(config.pkgs, moduleName); + + if (pkgMain) { + moduleName = pkgMain; + } + + bundleId = getOwn(bundlesMap, moduleName); + + if (bundleId) { + return req.nameToUrl(bundleId, ext, skipExt); + } + + // If a colon is in the URL, it indicates a protocol is used and it is + // just an URL to a file, or if it starts with a slash, contains a query + // arg (i.e. ?) or ends with .js, then assume the user meant to use an + // url and not a module id. The slash is important for protocol-less + // URLs as well as full paths. + if (urlRegExp.test(moduleName)) { + // Just a plain path, not module name lookup, so just return it. + // Add extension if it is included. This is a bit wonky, only non-.js + // things pass an extension, this method probably needs to be + // reworked. + url = moduleName + (ext || ''); + } else { + // A module that needs to be converted to a path. + paths = config.paths; + + syms = moduleName.split('/'); + // For each module name segment, see if there is a path + // registered for it. Start with most specific name + // and work up from it. + for (i = syms.length; i > 0; i -= 1) { + parentModule = syms.slice(0, i).join('/'); + + parentPath = getOwn(paths, parentModule); + if (parentPath) { + // If an array, it means there are a few choices, + // Choose the one that is desired + if (Array.isArray(parentPath)) { + parentPath = parentPath[0]; + } + syms.splice(0, i, parentPath); + break; + } + } + + // Join the path parts together, then figure out if baseUrl is needed. + url = syms.join('/'); + url += (ext || (/^data\:|^blob\:|\?/.test(url) || skipExt ? '' : '.js')); + url = (url.charAt(0) === '/' || + url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; + } + + return config.urlArgs && !/^blob\:/.test(url) ? + url + config.urlArgs(moduleName, url) : url; + }; + + /** + * Converts a module name + .extension into an URL path. + * *Requires* the use of a module name. It does not support using + * plain URLs like nameToUrl. + */ + req.toUrl = function (moduleNamePlusExt) { + var ext, + index = moduleNamePlusExt.lastIndexOf('.'), + segment = moduleNamePlusExt.split('/')[0], + isRelative = segment === '.' || segment === '..'; + + // Have a file extension alias, and it is not the + // dots from a relative path. + if (index !== -1 && (!isRelative || index > 1)) { + ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length); + moduleNamePlusExt = moduleNamePlusExt.substring(0, index); + } + + return req.nameToUrl(normalize(moduleNamePlusExt, relName), ext, true); + }; + + req.defined = function (id) { + return makeMap(id, relName, true).id in defined; + }; + + req.specified = function (id) { + id = makeMap(id, relName, true).id; + return id in defined || id in deferreds; + }; + + return req; + } + + function resolve(name, d, value) { + if (name) { + defined[name] = value; + if (requirejs.onResourceLoad) { + requirejs.onResourceLoad(context, d.map, d.deps); + } + } + d.finished = true; + d.resolve(value); + } + + function reject(d, err) { + d.finished = true; + d.rejected = true; + d.reject(err); + } + + function makeNormalize(relName) { + return function (name) { + return normalize(name, relName, true); + }; + } + + function defineModule(d) { + d.factoryCalled = true; + + var ret, + name = d.map.id; + + try { + ret = context.execCb(name, d.factory, d.values, defined[name]); + } catch(err) { + return reject(d, err); + } + + if (name) { + // Favor return value over exports. If node/cjs in play, + // then will not have a return value anyway. Favor + // module.exports assignment over exports object. + if (ret === undef) { + if (d.cjsModule) { + ret = d.cjsModule.exports; + } else if (d.usingExports) { + ret = defined[name]; + } + } + } else { + // Remove the require deferred from the list to + // make cycle searching faster. Do not need to track + // it anymore either. + requireDeferreds.splice(requireDeferreds.indexOf(d), 1); + } + resolve(name, d, ret); + } + + // This method is attached to every module deferred, + // so the "this" in here is the module deferred object. + function depFinished(val, i) { + if (!this.rejected && !this.depDefined[i]) { + this.depDefined[i] = true; + this.depCount += 1; + this.values[i] = val; + if (!this.depending && this.depCount === this.depMax) { + defineModule(this); + } + } + } + + function makeDefer(name, calculatedMap) { + var d = {}; + d.promise = new Promise(function (resolve, reject) { + d.resolve = resolve; + d.reject = function(err) { + if (!name) { + requireDeferreds.splice(requireDeferreds.indexOf(d), 1); + } + reject(err); + }; + }); + d.map = name ? (calculatedMap || makeMap(name)) : {}; + d.depCount = 0; + d.depMax = 0; + d.values = []; + d.depDefined = []; + d.depFinished = depFinished; + if (d.map.pr) { + // Plugin resource ID, implicitly + // depends on plugin. Track it in deps + // so cycle breaking can work + d.deps = [makeMap(d.map.pr)]; + } + return d; + } + + function getDefer(name, calculatedMap) { + var d; + if (name) { + d = (name in deferreds) && deferreds[name]; + if (!d) { + d = deferreds[name] = makeDefer(name, calculatedMap); + } + } else { + d = makeDefer(); + requireDeferreds.push(d); + } + return d; + } + + function makeErrback(d, name) { + return function (err) { + if (!d.rejected) { + if (!err.dynaId) { + err.dynaId = 'id' + (errCount += 1); + err.requireModules = [name]; + } + reject(d, err); + } + }; + } + + function waitForDep(depMap, relName, d, i) { + d.depMax += 1; + + // Do the fail at the end to catch errors + // in the then callback execution. + callDep(depMap, relName).then(function (val) { + d.depFinished(val, i); + }, makeErrback(d, depMap.id)).catch(makeErrback(d, d.map.id)); + } + + function makeLoad(id) { + var fromTextCalled; + function load(value) { + // Protect against older plugins that call load after + // calling load.fromText + if (!fromTextCalled) { + resolve(id, getDefer(id), value); + } + } + + load.error = function (err) { + getDefer(id).reject(err); + }; + + load.fromText = function (text, textAlt) { + /*jslint evil: true */ + var d = getDefer(id), + map = makeMap(makeMap(id).n), + plainId = map.id; + + fromTextCalled = true; + + // Set up the factory just to be a return of the value from + // plainId. + d.factory = function (p, val) { + return val; + }; + + // As of requirejs 2.1.0, support just passing the text, to reinforce + // fromText only being called once per resource. Still + // support old style of passing moduleName but discard + // that moduleName in favor of the internal ref. + if (textAlt) { + text = textAlt; + } + + // Transfer any config to this other module. + if (hasProp(config.config, id)) { + config.config[plainId] = config.config[id]; + } + + try { + req.exec(text); + } catch (e) { + reject(d, new Error('fromText eval for ' + plainId + + ' failed: ' + e)); + } + + // Execute any waiting define created by the plainId + takeQueue(plainId); + + // Mark this as a dependency for the plugin + // resource + d.deps = [map]; + waitForDep(map, null, d, d.deps.length); + }; + + return load; + } + + load = typeof importScripts === 'function' ? + function (map) { + var url = map.url; + if (urlFetched[url]) { + return; + } + urlFetched[url] = true; + + // Ask for the deferred so loading is triggered. + // Do this before loading, since loading is sync. + getDefer(map.id); + importScripts(url); + takeQueue(map.id); + } : + function (map) { + var script, + id = map.id, + url = map.url; + + if (urlFetched[url]) { + return; + } + urlFetched[url] = true; + + script = document.createElement('script'); + script.setAttribute('data-requiremodule', id); + script.type = config.scriptType || 'text/javascript'; + script.charset = 'utf-8'; + script.async = true; + + loadCount += 1; + + script.addEventListener('load', function () { + loadCount -= 1; + takeQueue(id); + }, false); + script.addEventListener('error', function () { + loadCount -= 1; + var err, + pathConfig = getOwn(config.paths, id); + if (pathConfig && Array.isArray(pathConfig) && + pathConfig.length > 1) { + script.parentNode.removeChild(script); + // Pop off the first array value, since it failed, and + // retry + pathConfig.shift(); + var d = getDefer(id); + d.map = makeMap(id); + // mapCache will have returned previous map value, update the + // url, which will also update mapCache value. + d.map.url = req.nameToUrl(id); + load(d.map); + } else { + err = new Error('Load failed: ' + id + ': ' + script.src); + err.requireModules = [id]; + getDefer(id).reject(err); + } + }, false); + + script.src = url; + + // If the script is cached, IE10 executes the script body and the + // onload handler synchronously here. That's a spec violation, + // so be sure to do this asynchronously. + if (document.documentMode === 10) { + asap.then(function() { + document.head.appendChild(script); + }); + } else { + document.head.appendChild(script); + } + }; + + function callPlugin(plugin, map, relName) { + plugin.load(map.n, makeRequire(relName), makeLoad(map.id), config); + } + + callDep = function (map, relName) { + var args, bundleId, + name = map.id, + shim = config.shim[name]; + + if (name in waiting) { + args = waiting[name]; + delete waiting[name]; + main.apply(undef, args); + } else if (!(name in deferreds)) { + if (map.pr) { + // If a bundles config, then just load that file instead to + // resolve the plugin, as it is built into that bundle. + if ((bundleId = getOwn(bundlesMap, name))) { + map.url = req.nameToUrl(bundleId); + load(map); + } else { + return callDep(makeMap(map.pr)).then(function (plugin) { + // Redo map now that plugin is known to be loaded + var newMap = map.prn ? map : makeMap(name, relName, true), + newId = newMap.id, + shim = getOwn(config.shim, newId); + + // Make sure to only call load once per resource. Many + // calls could have been queued waiting for plugin to load. + if (!(newId in calledPlugin)) { + calledPlugin[newId] = true; + if (shim && shim.deps) { + req(shim.deps, function () { + callPlugin(plugin, newMap, relName); + }); + } else { + callPlugin(plugin, newMap, relName); + } + } + return getDefer(newId).promise; + }); + } + } else if (shim && shim.deps) { + req(shim.deps, function () { + load(map); + }); + } else { + load(map); + } + } + + return getDefer(name).promise; + }; + + // Turns a plugin!resource to [plugin, resource] + // with the plugin being undefined if the name + // did not have a plugin prefix. + function splitPrefix(name) { + var prefix, + index = name ? name.indexOf('!') : -1; + if (index > -1) { + prefix = name.substring(0, index); + name = name.substring(index + 1, name.length); + } + return [prefix, name]; + } + + /** + * Makes a name map, normalizing the name, and using a plugin + * for normalization if necessary. Grabs a ref to plugin + * too, as an optimization. + */ + makeMap = function (name, relName, applyMap) { + if (typeof name !== 'string') { + return name; + } + + var plugin, url, parts, prefix, result, prefixNormalized, + cacheKey = name + ' & ' + (relName || '') + ' & ' + !!applyMap; + + parts = splitPrefix(name); + prefix = parts[0]; + name = parts[1]; + + if (!prefix && (cacheKey in mapCache)) { + return mapCache[cacheKey]; + } + + if (prefix) { + prefix = normalize(prefix, relName, applyMap); + plugin = (prefix in defined) && defined[prefix]; + } + + // Normalize according + if (prefix) { + if (plugin && plugin.normalize) { + name = plugin.normalize(name, makeNormalize(relName)); + prefixNormalized = true; + } else { + // If nested plugin references, then do not try to + // normalize, as it will not normalize correctly. This + // places a restriction on resourceIds, and the longer + // term solution is not to normalize until plugins are + // loaded and all normalizations to allow for async + // loading of a loader plugin. But for now, fixes the + // common uses. Details in requirejs#1131 + name = name.indexOf('!') === -1 ? + normalize(name, relName, applyMap) : + name; + } + } else { + name = normalize(name, relName, applyMap); + parts = splitPrefix(name); + prefix = parts[0]; + name = parts[1]; + + url = req.nameToUrl(name); + } + + // Using ridiculous property names for space reasons + result = { + id: prefix ? prefix + '!' + name : name, // fullName + n: name, + pr: prefix, + url: url, + prn: prefix && prefixNormalized + }; + + if (!prefix) { + mapCache[cacheKey] = result; + } + + return result; + }; + + handlers = { + require: function (name) { + return makeRequire(name); + }, + exports: function (name) { + var e = defined[name]; + if (typeof e !== 'undefined') { + return e; + } else { + return (defined[name] = {}); + } + }, + module: function (name) { + return { + id: name, + uri: '', + exports: handlers.exports(name), + config: function () { + return getOwn(config.config, name) || {}; + } + }; + } + }; + + function breakCycle(d, traced, processed) { + var id = d.map.id; + + traced[id] = true; + if (!d.finished && d.deps) { + d.deps.forEach(function (depMap) { + var depId = depMap.id, + dep = !hasProp(handlers, depId) && getDefer(depId, depMap); + + // Only force things that have not completed + // being defined, so still in the registry, + // and only if it has not been matched up + // in the module already. + if (dep && !dep.finished && !processed[depId]) { + if (hasProp(traced, depId)) { + d.deps.forEach(function (depMap, i) { + if (depMap.id === depId) { + d.depFinished(defined[depId], i); + } + }); + } else { + breakCycle(dep, traced, processed); + } + } + }); + } + processed[id] = true; + } + + function check(d) { + var err, mid, dfd, + notFinished = [], + waitInterval = config.waitSeconds * 1000, + // It is possible to disable the wait interval by using waitSeconds 0. + expired = waitInterval && + (startTime + waitInterval) < (new Date()).getTime(); + + if (loadCount === 0) { + // If passed in a deferred, it is for a specific require call. + // Could be a sync case that needs resolution right away. + // Otherwise, if no deferred, means it was the last ditch + // timeout-based check, so check all waiting require deferreds. + if (d) { + if (!d.finished) { + breakCycle(d, {}, {}); + } + } else if (requireDeferreds.length) { + requireDeferreds.forEach(function (d) { + breakCycle(d, {}, {}); + }); + } + } + + // If still waiting on loads, and the waiting load is something + // other than a plugin resource, or there are still outstanding + // scripts, then just try back later. + if (expired) { + // If wait time expired, throw error of unloaded modules. + for (mid in deferreds) { + dfd = deferreds[mid]; + if (!dfd.finished) { + notFinished.push(dfd.map.id); + } + } + err = new Error('Timeout for modules: ' + notFinished); + err.requireModules = notFinished; + req.onError(err); + } else if (loadCount || requireDeferreds.length) { + // Something is still waiting to load. Wait for it, but only + // if a later check is not already scheduled. Using setTimeout + // because want other things in the event loop to happen, + // to help in dependency resolution, and this is really a + // last ditch check, mostly for detecting timeouts (cycles + // should come through the main() use of check()), so it can + // wait a bit before doing the final check. + if (!checkingLater) { + checkingLater = true; + setTimeout(function () { + checkingLater = false; + check(); + }, 70); + } + } + } + + // Used to break out of the promise try/catch chains. + function delayedError(e) { + setTimeout(function () { + if (!e.dynaId || !trackedErrors[e.dynaId]) { + trackedErrors[e.dynaId] = true; + req.onError(e); + } + }); + return e; + } + + main = function (name, deps, factory, errback, relName) { + if (name) { + // Only allow main calling once per module. + if (name in calledDefine) { + return; + } + calledDefine[name] = true; + } + + var d = getDefer(name); + + // This module may not have dependencies + if (deps && !Array.isArray(deps)) { + // deps is not an array, so probably means + // an object literal or factory function for + // the value. Adjust args. + factory = deps; + deps = []; + } + + // Create fresh array instead of modifying passed in value. + deps = deps ? slice.call(deps, 0) : null; + + if (!errback) { + if (hasProp(config, 'defaultErrback')) { + if (config.defaultErrback) { + errback = config.defaultErrback; + } + } else { + errback = delayedError; + } + } + + if (errback) { + d.promise.catch(errback); + } + + // Use name if no relName + relName = relName || name; + + // Call the factory to define the module, if necessary. + if (typeof factory === 'function') { + + if (!deps.length && factory.length) { + // Remove comments from the callback string, + // look for require calls, and pull them into the dependencies, + // but only if there are function args. + factory + .toString() + .replace(commentRegExp, commentReplace) + .replace(cjsRequireRegExp, function (match, dep) { + deps.push(dep); + }); + + // May be a CommonJS thing even without require calls, but still + // could use exports, and module. Avoid doing exports and module + // work though if it just needs require. + // REQUIRES the function to expect the CommonJS variables in the + // order listed below. + deps = (factory.length === 1 ? + ['require'] : + ['require', 'exports', 'module']).concat(deps); + } + + // Save info for use later. + d.factory = factory; + d.deps = deps; + + d.depending = true; + deps.forEach(function (depName, i) { + var depMap; + deps[i] = depMap = makeMap(depName, relName, true); + depName = depMap.id; + + // Fast path CommonJS standard dependencies. + if (depName === "require") { + d.values[i] = handlers.require(name); + } else if (depName === "exports") { + // CommonJS module spec 1.1 + d.values[i] = handlers.exports(name); + d.usingExports = true; + } else if (depName === "module") { + // CommonJS module spec 1.1 + d.values[i] = d.cjsModule = handlers.module(name); + } else if (depName === undefined) { + d.values[i] = undefined; + } else { + waitForDep(depMap, relName, d, i); + } + }); + d.depending = false; + + // Some modules just depend on the require, exports, modules, so + // trigger their definition here if so. + if (d.depCount === d.depMax) { + defineModule(d); + } + } else if (name) { + // May just be an object definition for the module. Only + // worry about defining if have a module name. + resolve(name, d, factory); + } + + startTime = (new Date()).getTime(); + + if (!name) { + check(d); + } + + return d.promise; + }; + + req = makeRequire(null, true); + + /* + * Just drops the config on the floor, but returns req in case + * the config return value is used. + */ + req.config = function (cfg) { + if (cfg.context && cfg.context !== contextName) { + var existingContext = getOwn(contexts, cfg.context); + if (existingContext) { + return existingContext.req.config(cfg); + } else { + return newContext(cfg.context).config(cfg); + } + } + + // Since config changed, mapCache may not be valid any more. + mapCache = obj(); + + // Make sure the baseUrl ends in a slash. + if (cfg.baseUrl) { + if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') { + cfg.baseUrl += '/'; + } + } + + // Convert old style urlArgs string to a function. + if (typeof cfg.urlArgs === 'string') { + var urlArgs = cfg.urlArgs; + cfg.urlArgs = function(id, url) { + return (url.indexOf('?') === -1 ? '?' : '&') + urlArgs; + }; + } + + // Save off the paths and packages since they require special processing, + // they are additive. + var shim = config.shim, + objs = { + paths: true, + bundles: true, + config: true, + map: true + }; + + eachProp(cfg, function (value, prop) { + if (objs[prop]) { + if (!config[prop]) { + config[prop] = {}; + } + mixin(config[prop], value, true, true); + } else { + config[prop] = value; + } + }); + + // Reverse map the bundles + if (cfg.bundles) { + eachProp(cfg.bundles, function (value, prop) { + value.forEach(function (v) { + if (v !== prop) { + bundlesMap[v] = prop; + } + }); + }); + } + + // Merge shim + if (cfg.shim) { + eachProp(cfg.shim, function (value, id) { + // Normalize the structure + if (Array.isArray(value)) { + value = { + deps: value + }; + } + if ((value.exports || value.init) && !value.exportsFn) { + value.exportsFn = makeShimExports(value); + } + shim[id] = value; + }); + config.shim = shim; + } + + // Adjust packages if necessary. + if (cfg.packages) { + cfg.packages.forEach(function (pkgObj) { + var location, name; + + pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; + + name = pkgObj.name; + location = pkgObj.location; + if (location) { + config.paths[name] = pkgObj.location; + } + + // Save pointer to main module ID for pkg name. + // Remove leading dot in main, so main paths are normalized, + // and remove any trailing .js, since different package + // envs have different conventions: some use a module name, + // some use a file name. + config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main') + .replace(currDirRegExp, '') + .replace(jsSuffixRegExp, ''); + }); + } + + // If a deps array or a config callback is specified, then call + // require with those args. This is useful when require is defined as a + // config object before require.js is loaded. + if (cfg.deps || cfg.callback) { + req(cfg.deps, cfg.callback); + } + + return req; + }; + + req.onError = function (err) { + throw err; + }; + + context = { + id: contextName, + defined: defined, + waiting: waiting, + config: config, + deferreds: deferreds, + req: req, + execCb: function execCb(name, callback, args, exports) { + return callback.apply(exports, args); + } + }; + + contexts[contextName] = context; + + return req; + } + + requirejs = topReq = newContext('_'); + + if (typeof require !== 'function') { + require = topReq; + } + + /** + * Executes the text. Normally just uses eval, but can be modified + * to use a better, environment-specific call. Only used for transpiling + * loader plugins, not for plain JS modules. + * @param {String} text the text to execute/evaluate. + */ + topReq.exec = function (text) { + /*jslint evil: true */ + return eval(text); + }; + + topReq.contexts = contexts; + + define = function () { + queue.push(slice.call(arguments, 0)); + }; + + define.amd = { + jQuery: true + }; + + if (bootstrapConfig) { + topReq.config(bootstrapConfig); + } + + // data-main support. + if (topReq.isBrowser && !contexts._.config.skipDataMain) { + dataMain = document.querySelectorAll('script[data-main]')[0]; + dataMain = dataMain && dataMain.getAttribute('data-main'); + if (dataMain) { + // Strip off any trailing .js since dataMain is now + // like a module name. + dataMain = dataMain.replace(jsSuffixRegExp, ''); + + // Set final baseUrl if there is not already an explicit one, + // but only do so if the data-main value is not a loader plugin + // module ID. + if ((!bootstrapConfig || !bootstrapConfig.baseUrl) && + dataMain.indexOf('!') === -1) { + // Pull off the directory of data-main for use as the + // baseUrl. + src = dataMain.split('/'); + dataMain = src.pop(); + subPath = src.length ? src.join('/') + '/' : './'; + + topReq.config({baseUrl: subPath}); + } + + topReq([dataMain]); + } + } +}(this, (typeof Promise !== 'undefined' ? Promise : undefined))); + +define("requireLib", function(){}); + +//noinspection JSUnresolvedVariable +requirejs.config({ + paths: { + enquire: '3rdParty/enquire', + favico: '3rdParty/favico', + 'perfect-scrollbar': '3rdParty/perfect-scrollbar', + 'Pica': '3rdParty/pica', + prism: '3rdParty/prism', + zxcvbn: '3rdParty/zxcvbn', + }, + shim: { + enquire: { exports: 'enquire' }, + favico: { exports: 'Favico' }, + 'perfect-scrollbar': { exports: 'PerfectScrollbar' } + }, + map: { + '*': { + 'Ajax': 'WoltLabSuite/Core/Ajax', + 'AjaxJsonp': 'WoltLabSuite/Core/Ajax/Jsonp', + 'AjaxRequest': 'WoltLabSuite/Core/Ajax/Request', + 'CallbackList': 'WoltLabSuite/Core/CallbackList', + 'ColorUtil': 'WoltLabSuite/Core/ColorUtil', + 'Core': 'WoltLabSuite/Core/Core', + 'DateUtil': 'WoltLabSuite/Core/Date/Util', + 'Devtools': 'WoltLabSuite/Core/Devtools', + 'Dictionary': 'WoltLabSuite/Core/Dictionary', + 'Dom/ChangeListener': 'WoltLabSuite/Core/Dom/Change/Listener', + 'Dom/Traverse': 'WoltLabSuite/Core/Dom/Traverse', + 'Dom/Util': 'WoltLabSuite/Core/Dom/Util', + 'Environment': 'WoltLabSuite/Core/Environment', + 'EventHandler': 'WoltLabSuite/Core/Event/Handler', + 'EventKey': 'WoltLabSuite/Core/Event/Key', + 'Language': 'WoltLabSuite/Core/Language', + 'List': 'WoltLabSuite/Core/List', + 'ObjectMap': 'WoltLabSuite/Core/ObjectMap', + 'Permission': 'WoltLabSuite/Core/Permission', + 'StringUtil': 'WoltLabSuite/Core/StringUtil', + 'Ui/Alignment': 'WoltLabSuite/Core/Ui/Alignment', + 'Ui/CloseOverlay': 'WoltLabSuite/Core/Ui/CloseOverlay', + 'Ui/Confirmation': 'WoltLabSuite/Core/Ui/Confirmation', + 'Ui/Dialog': 'WoltLabSuite/Core/Ui/Dialog', + 'Ui/Notification': 'WoltLabSuite/Core/Ui/Notification', + 'Ui/ReusableDropdown': 'WoltLabSuite/Core/Ui/Dropdown/Reusable', + 'Ui/Screen': 'WoltLabSuite/Core/Ui/Screen', + 'Ui/Scroll': 'WoltLabSuite/Core/Ui/Scroll', + 'Ui/SimpleDropdown': 'WoltLabSuite/Core/Ui/Dropdown/Simple', + 'Ui/TabMenu': 'WoltLabSuite/Core/Ui/TabMenu', + 'Upload': 'WoltLabSuite/Core/Upload', + 'User': 'WoltLabSuite/Core/User' + } + }, + waitSeconds: 0 +}); + +/* Define jQuery shim. We cannot use the shim object in the configuration above, + because it tries to load the file, even if the exported global already exists. + This shim is needed for jQuery plugins supporting an AMD loaded jQuery, because + we break the AMD support of jQuery for BC reasons. +*/ +define('jquery', [],function() { + return window.jQuery; +}); + + +define("require.config", function(){}); + +/** + * Collection of global short hand functions. + * + * @author Alexander Ebert + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + */ +(function(window, document) { + /** + * Shorthand function to retrieve or set an attribute. + * + * @param {Element} element target element + * @param {string} attribute attribute name + * @param {?=} value attribute value, omit if attribute should be read + * @return {(string|undefined)} attribute value, empty string if attribute is not set or undefined if `value` was omitted + */ + window.elAttr = function(element, attribute, value) { + if (value === undefined) { + return element.getAttribute(attribute) || ''; + } + + element.setAttribute(attribute, value); + }; + + /** + * Shorthand function to retrieve a boolean attribute. + * + * @param {Element} element target element + * @param {string} attribute attribute name + * @return {boolean} true if value is either `1` or `true` + */ + window.elAttrBool = function(element, attribute) { + var value = elAttr(element, attribute); + + return (value === "1" || value === "true"); + }; + + /** + * Shorthand function to find elements by class name. + * + * @param {string} className CSS class name + * @param {Element=} context target element, assuming `document` if omitted + * @return {NodeList} matching elements + */ + window.elByClass = function(className, context) { + return (context || document).getElementsByClassName(className); + }; + + /** + * Shorthand function to retrieve an element by id. + * + * @param {string} id element id + * @return {(Element|null)} matching element or null if not found + */ + window.elById = function(id) { + return document.getElementById(id); + }; + + /** + * Shorthand function to find an element by CSS selector. + * + * @param {string} selector CSS selector + * @param {Element=} context target element, assuming `document` if omitted + * @return {(Element|null)} matching element or null if no match + */ + window.elBySel = function(selector, context) { + return (context || document).querySelector(selector); + }; + + /** + * Shorthand function to find elements by CSS selector. + * + * @param {string} selector CSS selector + * @param {Element=} context target element, assuming `document` if omitted + * @param {function=} callback callback function passed to forEach() + * @return {NodeList} matching elements + */ + window.elBySelAll = function(selector, context, callback) { + var nodeList = (context || document).querySelectorAll(selector); + if (typeof callback === 'function') { + Array.prototype.forEach.call(nodeList, callback); + } + + return nodeList; + }; + + /** + * Shorthand function to find elements by tag name. + * + * @param {string} tagName element tag name + * @param {Element=} context target element, assuming `document` if omitted + * @return {NodeList} matching elements + */ + window.elByTag = function(tagName, context) { + return (context || document).getElementsByTagName(tagName); + }; + + /** + * Shorthand function to create a DOM element. + * + * @param {string} tagName element tag name + * @return {Element} new DOM element + */ + window.elCreate = function(tagName) { + return document.createElement(tagName); + }; + + /** + * Returns the closest element (parent for text nodes), optionally matching + * the provided selector. + * + * @param {Node} node start node + * @param {string=} selector optional CSS selector + * @return {Element} closest matching element + */ + window.elClosest = function (node, selector) { + if (!(node instanceof Node)) { + throw new TypeError('Provided element is not a Node.'); + } + + // retrieve the parent element for text nodes + if (node.nodeType === Node.TEXT_NODE) { + node = node.parentNode; + + // text node had no parent + if (node === null) return null; + } + + if (typeof selector !== 'string') selector = ''; + + if (selector.length === 0) return node; + + return node.closest(selector); + }; + + /** + * Shorthand function to retrieve or set a 'data-' attribute. + * + * @param {Element} element target element + * @param {string} attribute attribute name + * @param {?=} value attribute value, omit if attribute should be read + * @return {(string|undefined)} attribute value, empty string if attribute is not set or undefined if `value` was omitted + */ + window.elData = function(element, attribute, value) { + attribute = 'data-' + attribute; + + if (value === undefined) { + return element.getAttribute(attribute) || ''; + } + + element.setAttribute(attribute, value); + }; + + /** + * Shorthand function to retrieve a boolean 'data-' attribute. + * + * @param {Element} element target element + * @param {string} attribute attribute name + * @return {boolean} true if value is either `1` or `true` + */ + window.elDataBool = function(element, attribute) { + var value = elData(element, attribute); + + return (value === "1" || value === "true"); + }; + + /** + * Shorthand function to hide an element by setting its 'display' value to 'none'. + * + * @param {Element} element DOM element + */ + window.elHide = function(element) { + element.style.setProperty('display', 'none', ''); + }; + + /** + * Shorthand function to check if given element is hidden by setting its 'display' + * value to 'none'. + * + * @param {Element} element DOM element + * @return {boolean} + */ + window.elIsHidden = function(element) { + return element.style.getPropertyValue('display') === 'none'; + } + + /** + * Displays or removes an error message below the provided element. + * + * @param {Element} element DOM element + * @param {string?} errorMessage error message; `false`, `null` and `undefined` are treated as an empty string + * @param {boolean?} isHtml defaults to false, causes `errorMessage` to be treated as text only + * @return {?Element} the inner error element or null if it was removed + */ + window.elInnerError = function (element, errorMessage, isHtml) { + var parent = element.parentNode; + if (parent === null) { + throw new Error('Only elements that have a parent element or document are valid.'); + } + + if (typeof errorMessage !== 'string') { + if (errorMessage === undefined || errorMessage === null || errorMessage === false) { + errorMessage = ''; + } + else { + throw new TypeError('The error message must be a string; `false`, `null` or `undefined` can be used as a substitute for an empty string.'); + } + } + + var insertTarget = parent; + var referenceElement = element; + if (insertTarget.classList.contains('inputAddon')) { + insertTarget = parent.parentElement; + referenceElement = parent; + } + + var innerError = referenceElement.nextElementSibling; + if (innerError === null || innerError.nodeName !== 'SMALL' || !innerError.classList.contains('innerError')) { + if (errorMessage === '') { + innerError = null; + } + else { + innerError = elCreate('small'); + innerError.className = 'innerError'; + insertTarget.insertBefore(innerError, referenceElement.nextSibling); + } + } + + if (errorMessage === '') { + if (innerError !== null) { + parent.removeChild(innerError); + innerError = null; + } + } + else { + innerError[(isHtml ? 'innerHTML' : 'textContent')] = errorMessage; + } + + return innerError; + }; + + /** + * Shorthand function to remove an element. + * + * @param {Node} element DOM node + */ + window.elRemove = function(element) { + element.parentNode.removeChild(element); + }; + + /** + * Shorthand function to show an element previously hidden by using `elHide()`. + * + * @param {Element} element DOM element + */ + window.elShow = function(element) { + element.style.removeProperty('display'); + }; + + /** + * Toggles visibility of an element using the display style. + * + * @param {Element} element DOM element + */ + window.elToggle = function (element) { + if (element.style.getPropertyValue('display') === 'none') { + elShow(element); + } + else { + elHide(element); + } + }; + + /** + * Shorthand function to iterative over an array-like object, arguments passed are the value and the index second. + * + * Do not use this function if a simple `for()` is enough or `list` is a plain object. + * + * @param {object} list array-like object + * @param {function} callback callback function + */ + window.forEach = function(list, callback) { + for (var i = 0, length = list.length; i < length; i++) { + callback(list[i], i); + } + }; + + /** + * Shorthand function to check if an object has a property while ignoring the chain. + * + * @param {object} obj target object + * @param {string} property property name + * @return {boolean} false if property does not exist or belongs to the chain + */ + window.objOwns = function(obj, property) { + return obj.hasOwnProperty(property); + }; + + /** + * Returns a function, that, as long as it continues to be invoked, will not + * be triggered. The function will be called after it stops being called for + * N milliseconds. If `immediate` is passed, trigger the function on the + * leading edge, instead of the trailing. + * + * @param {function} func + * @param {number} wait + * @param {boolean} immediate + * @return function + * @see https://davidwalsh.name/javascript-debounce-function + */ + window.debounce = function (func, wait, immediate) { + var timeout; + + return function() { + var context = this; + var args = arguments; + + clearTimeout(timeout); + + timeout = setTimeout(function() { + timeout = null; + + if (!immediate) { + func.apply(context, args) + } + }, wait); + + if (immediate && !timeout) { + func.apply(context, args) + } + }; + }; + + /* assigns a global constant defining the proper 'click' event depending on the browser, + enforcing 'touchstart' on mobile devices for a better UX. We're using defineProperty() + here because at the time of writing Safari does not support 'const'. Thanks Safari. + */ + var clickEvent = ('touchstart' in document.documentElement || 'ontouchstart' in window || navigator.MaxTouchPoints > 0 || navigator.msMaxTouchPoints > 0) ? 'touchstart' : 'click'; + Object.defineProperty(window, 'WCF_CLICK_EVENT', { + value: 'click' //clickEvent + }); + + /* Overwrites any history states after 'initial' with 'skip' on initial page load. + This is done, as the necessary DOM of other history states may not exist any more. + On forward navigation these 'skip' states are automatically skipped, otherwise the + user might have to press the forward button several times. + Note: A 'skip' state cannot be hit in the 'popstate' event when navigation backwards, + because the history already is left of all the 'skip' states for the current page. + Note 2: Setting the URL component of `history.replaceState()` to an empty string will + cause the Internet Explorer to discard the path and query string from the + address bar. + */ + (function() { + var stateDepth = 0; + function check() { + if (window.history.state && window.history.state.name && window.history.state.name !== 'initial') { + window.history.replaceState({ + name: 'skip', + depth: ++stateDepth + }, ''); + window.history.back(); + + // window.history does not update in this iteration of the event loop + setTimeout(check, 1); + } + else { + window.history.replaceState({name: 'initial'}, ''); + } + } + check(); + + window.addEventListener('popstate', function(event) { + if (event.state && event.state.name && event.state.name === 'skip') { + window.history.go(event.state.depth); + } + }); + })(); + + /** + * Provides a hashCode() method for strings, similar to Java's String.hashCode(). + * + * @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ + */ + window.String.prototype.hashCode = function() { + var $char; + var $hash = 0; + + if (this.length) { + for (var $i = 0, $length = this.length; $i < $length; $i++) { + $char = this.charCodeAt($i); + $hash = (($hash << 5) - $hash) + $char; + $hash = $hash & $hash; // convert to 32bit integer + } + } + + return $hash; + }; +})(window, document); + +define("wcf.globalHelper", function(){}); + +/** + * Provides the basic core functionality. + * + * @author Alexander Ebert + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module Core (alias) + * @module WoltLabSuite/Core/Core + */ +define('WoltLabSuite/Core/Core',[], function() { + "use strict"; + + var _clone = function(variable) { + if (typeof variable === 'object' && (Array.isArray(variable) || Core.isPlainObject(variable))) { + return _cloneObject(variable); + } + + return variable; + }; + + var _cloneObject = function(obj) { + if (!obj) { + return null; + } + + if (Array.isArray(obj)) { + return obj.slice(); + } + + var newObj = {}; + for (var key in obj) { + if (obj.hasOwnProperty(key) && typeof obj[key] !== 'undefined') { + newObj[key] = _clone(obj[key]); + } + } + + return newObj; + }; + + //noinspection JSUnresolvedVariable + var _prefix = 'wsc' + window.WCF_PATH.hashCode() + '-'; + + /** + * @exports WoltLabSuite/Core/Core + */ + var Core = { + /** + * Deep clones an object. + * + * @param {object} obj source object + * @return {object} cloned object + */ + clone: function(obj) { + return _clone(obj); + }, + + /** + * Converts WCF 2.0-style URLs into the default URL layout. + * + * @param string url target url + * @return rewritten url + */ + convertLegacyUrl: function(url) { + return url.replace(/^index\.php\/(.*?)\/\?/, function(match, controller) { + var parts = controller.split(/([A-Z][a-z0-9]+)/); + controller = ''; + for (var i = 0, length = parts.length; i < length; i++) { + var part = parts[i].trim(); + if (part.length) { + if (controller.length) controller += '-'; + controller += part.toLowerCase(); + } + } + + return 'index.php?' + controller + '/&'; + }); + }, + + /** + * Merges objects with the first argument. + * + * @param {object} out destination object + * @param {...object} arguments variable number of objects to be merged into the destination object + * @return {object} destination object with all provided objects merged into + */ + extend: function(out) { + out = out || {}; + var newObj = this.clone(out); + + for (var i = 1, length = arguments.length; i < length; i++) { + var obj = arguments[i]; + + if (!obj) continue; + + for (var key in obj) { + if (objOwns(obj, key)) { + if (!Array.isArray(obj[key]) && typeof obj[key] === 'object') { + if (this.isPlainObject(obj[key])) { + // object literals have the prototype of Object which in return has no parent prototype + newObj[key] = this.extend(out[key], obj[key]); + } + else { + newObj[key] = obj[key]; + } + } + else { + newObj[key] = obj[key]; + } + } + } + } + + return newObj; + }, + + /** + * Inherits the prototype methods from one constructor to another + * constructor. + * + * Usage: + * + * function MyDerivedClass() {} + * Core.inherit(MyDerivedClass, TheAwesomeBaseClass, { + * // regular prototype for `MyDerivedClass` + * + * overwrittenMethodFromBaseClass: function(foo, bar) { + * // do stuff + * + * // invoke parent + * MyDerivedClass._super.prototype.overwrittenMethodFromBaseClass.call(this, foo, bar); + * } + * }); + * + * @see https://github.com/nodejs/node/blob/7d14dd9b5e78faabb95d454a79faa513d0bbc2a5/lib/util.js#L697-L735 + * @param {function} constructor inheriting constructor function + * @param {function} superConstructor inherited constructor function + * @param {object=} propertiesObject additional prototype properties + */ + inherit: function(constructor, superConstructor, propertiesObject) { + if (constructor === undefined || constructor === null) { + throw new TypeError("The constructor must not be undefined or null."); + } + if (superConstructor === undefined || superConstructor === null) { + throw new TypeError("The super constructor must not be undefined or null."); + } + if (superConstructor.prototype === undefined) { + throw new TypeError("The super constructor must have a prototype."); + } + + constructor._super = superConstructor; + constructor.prototype = Core.extend(Object.create(superConstructor.prototype, { + constructor: { + configurable: true, + enumerable: false, + value: constructor, + writable: true + } + }), propertiesObject || {}); + }, + + /** + * Returns true if `obj` is an object literal. + * + * @param {*} obj target object + * @returns {boolean} true if target is an object literal + */ + isPlainObject: function(obj) { + if (typeof obj !== 'object' || obj === null || obj.nodeType) { + return false; + } + + return (Object.getPrototypeOf(obj) === Object.prototype); + }, + + /** + * Returns the object's class name. + * + * @param {object} obj target object + * @return {string} object class name + */ + getType: function(obj) { + return Object.prototype.toString.call(obj).replace(/^\[object (.+)\]$/, '$1'); + }, + + /** + * Returns a RFC4122 version 4 compilant UUID. + * + * @see http://stackoverflow.com/a/2117523 + * @return {string} + */ + getUuid: function() { + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); + return v.toString(16); + }); + }, + + /** + * Recursively serializes an object into an encoded URI parameter string. + * + * @param {object} obj target object + * @param {string=} prefix parameter prefix + * @return {string} encoded parameter string + */ + serialize: function(obj, prefix) { + var parameters = []; + + for (var key in obj) { + if (objOwns(obj, key)) { + var parameterKey = (prefix) ? prefix + '[' + key + ']' : key; + var value = obj[key]; + + if (typeof value === 'object') { + parameters.push(this.serialize(value, parameterKey)); + } + else { + parameters.push(encodeURIComponent(parameterKey) + '=' + encodeURIComponent(value)); + } + } + } + + return parameters.join('&'); + }, + + /** + * Triggers a custom or built-in event. + * + * @param {Element} element target element + * @param {string} eventName event name + */ + triggerEvent: function(element, eventName) { + if (eventName === 'click' && element instanceof HTMLElement) { + element.click(); + return; + } + + var event; + + try { + event = new Event(eventName, { + bubbles: true, + cancelable: true + }); + } + catch (e) { + event = document.createEvent('Event'); + event.initEvent(eventName, true, true); + } + + element.dispatchEvent(event); + }, + + /** + * Returns the unique prefix for the localStorage. + * + * @return {string} prefix for the localStorage + */ + getStoragePrefix: function() { + return _prefix; + } + }; + + return Core; +}); + +/** + * Dictionary implementation relying on an object or if supported on a Map to hold key => value data. + * + * If you're looking for a dictionary with object keys, please see `WoltLabSuite/Core/ObjectMap`. + * + * @author Tim Duesterhus, Alexander Ebert + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module Dictionary (alias) + * @module WoltLabSuite/Core/Dictionary + */ +define('WoltLabSuite/Core/Dictionary',['Core'], function(Core) { + "use strict"; + + var _hasMap = objOwns(window, 'Map') && typeof window.Map === 'function'; + + /** + * @constructor + */ + function Dictionary() { + this._dictionary = (_hasMap) ? new Map() : {}; + } + Dictionary.prototype = { + /** + * Sets a new key with given value, will overwrite an existing key. + * + * @param {(number|string)} key key + * @param {?} value value + */ + set: function(key, value) { + if (typeof key === 'number') key = key.toString(); + + if (typeof key !== "string") { + throw new TypeError("Only strings can be used as keys, rejected '" + key + "' (" + typeof key + ")."); + } + + if (_hasMap) this._dictionary.set(key, value); + else this._dictionary[key] = value; + }, + + /** + * Removes a key from the dictionary. + * + * @param {(number|string)} key key + */ + 'delete': function(key) { + if (typeof key === 'number') key = key.toString(); + + if (_hasMap) this._dictionary['delete'](key); + else this._dictionary[key] = undefined; + }, + + /** + * Returns true if dictionary contains a value for given key and is not undefined. + * + * @param {(number|string)} key key + * @return {boolean} true if key exists and value is not undefined + */ + has: function(key) { + if (typeof key === 'number') key = key.toString(); + + if (_hasMap) return this._dictionary.has(key); + else { + return (objOwns(this._dictionary, key) && typeof this._dictionary[key] !== "undefined"); + } + }, + + /** + * Retrieves a value by key, returns undefined if there is no match. + * + * @param {(number|string)} key key + * @return {*} + */ + get: function(key) { + if (typeof key === 'number') key = key.toString(); + + if (this.has(key)) { + if (_hasMap) return this._dictionary.get(key); + else return this._dictionary[key]; + } + + return undefined; + }, + + /** + * Iterates over the dictionary keys and values, callback function should expect the + * value as first parameter and the key name second. + * + * @param {function<*, string>} callback callback for each iteration + */ + forEach: function(callback) { + if (typeof callback !== "function") { + throw new TypeError("forEach() expects a callback as first parameter."); + } + + if (_hasMap) { + this._dictionary.forEach(callback); + } + else { + var keys = Object.keys(this._dictionary); + for (var i = 0, length = keys.length; i < length; i++) { + callback(this._dictionary[keys[i]], keys[i]); + } + } + }, + + /** + * Merges one or more Dictionary instances into this one. + * + * @param {...Dictionary} var_args one or more Dictionary instances + */ + merge: function() { + for (var i = 0, length = arguments.length; i < length; i++) { + var dictionary = arguments[i]; + if (!(dictionary instanceof Dictionary)) { + throw new TypeError("Expected an object of type Dictionary, but argument " + i + " is not."); + } + + dictionary.forEach((function(value, key) { + this.set(key, value); + }).bind(this)); + } + }, + + /** + * Returns the object representation of the dictionary. + * + * @return {object} dictionary's object representation + */ + toObject: function() { + if (!_hasMap) return Core.clone(this._dictionary); + + var object = { }; + this._dictionary.forEach(function(value, key) { + object[key] = value; + }); + + return object; + } + }; + + /** + * Creates a new Dictionary based on the given object. + * All properties that are owned by the object will be added + * as keys to the resulting Dictionary. + * + * @param {object} object + * @return {Dictionary} + */ + Dictionary.fromObject = function(object) { + var result = new Dictionary(); + + for (var key in object) { + if (objOwns(object, key)) { + result.set(key, object[key]); + } + } + + return result; + }; + + Object.defineProperty(Dictionary.prototype, 'size', { + enumerable: false, + configurable: true, + get: function() { + if (_hasMap) { + return this._dictionary.size; + } + else { + return Object.keys(this._dictionary).length; + } + } + }); + + return Dictionary; +}); + + + +define('WoltLabSuite/Core/Template.grammar',['require'],function(require){ +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,44],$V1=[5,9,11,12,13,18,19,21,22,23,25,26,28,29,30,32,33,34,35,37,39,41],$V2=[1,25],$V3=[1,27],$V4=[1,33],$V5=[1,31],$V6=[1,32],$V7=[1,28],$V8=[1,29],$V9=[1,26],$Va=[1,35],$Vb=[1,41],$Vc=[1,40],$Vd=[11,12,15,42,43,47,49,51,52,54,55],$Ve=[9,11,12,13,18,19,21,23,26,28,30,32,33,34,35,37,39],$Vf=[11,12,15,42,43,46,47,48,49,51,52,54,55],$Vg=[1,64],$Vh=[1,65],$Vi=[18,37,39],$Vj=[12,15]; +var parser = {trace: function trace () { }, +yy: {}, +symbols_: {"error":2,"TEMPLATE":3,"CHUNK_STAR":4,"EOF":5,"CHUNK_STAR_repetition0":6,"CHUNK":7,"PLAIN_ANY":8,"T_LITERAL":9,"COMMAND":10,"T_ANY":11,"T_WS":12,"{if":13,"COMMAND_PARAMETERS":14,"}":15,"COMMAND_repetition0":16,"COMMAND_option0":17,"{/if}":18,"{include":19,"COMMAND_PARAMETER_LIST":20,"{implode":21,"{/implode}":22,"{foreach":23,"COMMAND_option1":24,"{/foreach}":25,"{plural":26,"PLURAL_PARAMETER_LIST":27,"{lang}":28,"{/lang}":29,"{":30,"VARIABLE":31,"{#":32,"{@":33,"{ldelim}":34,"{rdelim}":35,"ELSE":36,"{else}":37,"ELSE_IF":38,"{elseif":39,"FOREACH_ELSE":40,"{foreachelse}":41,"T_VARIABLE":42,"T_VARIABLE_NAME":43,"VARIABLE_repetition0":44,"VARIABLE_SUFFIX":45,"[":46,"]":47,".":48,"(":49,"VARIABLE_SUFFIX_option0":50,")":51,"=":52,"COMMAND_PARAMETER_VALUE":53,"T_QUOTED_STRING":54,"T_DIGITS":55,"COMMAND_PARAMETERS_repetition_plus0":56,"COMMAND_PARAMETER":57,"T_PLURAL_PARAMETER_NAME":58,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"EOF",9:"T_LITERAL",11:"T_ANY",12:"T_WS",13:"{if",15:"}",18:"{/if}",19:"{include",21:"{implode",22:"{/implode}",23:"{foreach",25:"{/foreach}",26:"{plural",28:"{lang}",29:"{/lang}",30:"{",32:"{#",33:"{@",34:"{ldelim}",35:"{rdelim}",37:"{else}",39:"{elseif",41:"{foreachelse}",42:"T_VARIABLE",43:"T_VARIABLE_NAME",46:"[",47:"]",48:".",49:"(",51:")",52:"=",54:"T_QUOTED_STRING",55:"T_DIGITS"}, +productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[8,1],[8,1],[10,7],[10,3],[10,5],[10,6],[10,3],[10,3],[10,3],[10,3],[10,3],[10,1],[10,1],[36,2],[38,4],[40,2],[31,3],[45,3],[45,2],[45,3],[20,5],[20,3],[53,1],[53,1],[53,1],[14,1],[57,1],[57,1],[57,1],[57,1],[57,1],[57,1],[57,1],[57,3],[27,5],[27,3],[58,1],[58,1],[6,0],[6,2],[16,0],[16,2],[17,0],[17,1],[24,0],[24,1],[44,0],[44,2],[50,0],[50,1],[56,1],[56,2]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1: + return $$[$0-1] + ";"; +break; +case 2: + + var result = $$[$0].reduce(function (carry, item) { + if (item.encode && !carry[1]) carry[0] += " + '" + item.value; + else if (item.encode && carry[1]) carry[0] += item.value; + else if (!item.encode && carry[1]) carry[0] += "' + " + item.value; + else if (!item.encode && !carry[1]) carry[0] += " + " + item.value; + + carry[1] = item.encode; + return carry; + }, [ "''", false ]); + if (result[1]) result[0] += "'"; + + this.$ = result[0]; + +break; +case 3: case 4: +this.$ = { encode: true, value: $$[$0].replace(/\\/g, '\\\\').replace(/'/g, "\\'").replace(/(\r\n|\n|\r)/g, '\\n') }; +break; +case 5: +this.$ = { encode: false, value: $$[$0] }; +break; +case 8: + + this.$ = "(function() { if (" + $$[$0-5] + ") { return " + $$[$0-3] + "; } " + $$[$0-2].join(' ') + " " + ($$[$0-1] || '') + " return ''; })()"; + +break; +case 9: + + if (!$$[$0-1]['file']) throw new Error('Missing parameter file'); + + this.$ = $$[$0-1]['file'] + ".fetch(v)"; + +break; +case 10: + + if (!$$[$0-3]['from']) throw new Error('Missing parameter from'); + if (!$$[$0-3]['item']) throw new Error('Missing parameter item'); + if (!$$[$0-3]['glue']) $$[$0-3]['glue'] = "', '"; + + this.$ = "(function() { return " + $$[$0-3]['from'] + ".map(function(item) { v[" + $$[$0-3]['item'] + "] = item; return " + $$[$0-1] + "; }).join(" + $$[$0-3]['glue'] + "); })()"; + +break; +case 11: + + if (!$$[$0-4]['from']) throw new Error('Missing parameter from'); + if (!$$[$0-4]['item']) throw new Error('Missing parameter item'); + + this.$ = "(function() {" + + "var looped = false, result = '';" + + "if (" + $$[$0-4]['from'] + " instanceof Array) {" + + "for (var i = 0; i < " + $$[$0-4]['from'] + ".length; i++) { looped = true;" + + "v[" + $$[$0-4]['key'] + "] = i;" + + "v[" + $$[$0-4]['item'] + "] = " + $$[$0-4]['from'] + "[i];" + + "result += " + $$[$0-2] + ";" + + "}" + + "} else {" + + "for (var key in " + $$[$0-4]['from'] + ") {" + + "if (!" + $$[$0-4]['from'] + ".hasOwnProperty(key)) continue;" + + "looped = true;" + + "v[" + $$[$0-4]['key'] + "] = key;" + + "v[" + $$[$0-4]['item'] + "] = " + $$[$0-4]['from'] + "[key];" + + "result += " + $$[$0-2] + ";" + + "}" + + "}" + + "return (looped ? result : " + ($$[$0-1] || "''") + "); })()" + +break; +case 12: + + this.$ = "I18nPlural.getCategoryFromTemplateParameters({" + var needsComma = false; + for (var key in $$[$0-1]) { + if (objOwns($$[$0-1], key)) { + this.$ += (needsComma ? ',' : '') + key + ': ' + $$[$0-1][key]; + needsComma = true; + } + } + this.$ += "})"; + +break; +case 13: +this.$ = "Language.get(" + $$[$0-1] + ", v)"; +break; +case 14: +this.$ = "StringUtil.escapeHTML(" + $$[$0-1] + ")"; +break; +case 15: +this.$ = "StringUtil.formatNumeric(" + $$[$0-1] + ")"; +break; +case 16: +this.$ = $$[$0-1]; +break; +case 17: +this.$ = "'{'"; +break; +case 18: +this.$ = "'}'"; +break; +case 19: +this.$ = "else { return " + $$[$0] + "; }"; +break; +case 20: +this.$ = "else if (" + $$[$0-2] + ") { return " + $$[$0] + "; }"; +break; +case 21: +this.$ = $$[$0]; +break; +case 22: +this.$ = "v['" + $$[$0-1] + "']" + $$[$0].join('');; +break; +case 23: +this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 24: +this.$ = "['" + $$[$0] + "']"; +break; +case 25: case 39: +this.$ = $$[$0-2] + ($$[$0-1] || '') + $$[$0]; +break; +case 26: case 40: + this.$ = $$[$0]; this.$[$$[$0-4]] = $$[$0-2]; +break; +case 27: case 41: + this.$ = {}; this.$[$$[$0-2]] = $$[$0]; +break; +case 31: +this.$ = $$[$0].join(''); +break; +case 44: case 46: case 52: +this.$ = []; +break; +case 45: case 47: case 53: case 57: +$$[$0-1].push($$[$0]); +break; +case 56: +this.$ = [$$[$0]]; +break; +} +}, +table: [o([5,9,11,12,13,19,21,23,26,28,30,32,33,34,35],$V0,{3:1,4:2,6:3}),{1:[3]},{5:[1,4]},o([5,18,22,25,29,37,39,41],[2,2],{7:5,8:6,10:8,9:[1,7],11:[1,9],12:[1,10],13:[1,11],19:[1,12],21:[1,13],23:[1,14],26:[1,15],28:[1,16],30:[1,17],32:[1,18],33:[1,19],34:[1,20],35:[1,21]}),{1:[2,1]},o($V1,[2,45]),o($V1,[2,3]),o($V1,[2,4]),o($V1,[2,5]),o($V1,[2,6]),o($V1,[2,7]),{11:$V2,12:$V3,14:22,31:30,42:$V4,43:$V5,49:$V6,52:$V7,54:$V8,55:$V9,56:23,57:24},{20:34,43:$Va},{20:36,43:$Va},{20:37,43:$Va},{27:38,43:$Vb,55:$Vc,58:39},o([9,11,12,13,19,21,23,26,28,29,30,32,33,34,35],$V0,{6:3,4:42}),{31:43,42:$V4},{31:44,42:$V4},{31:45,42:$V4},o($V1,[2,17]),o($V1,[2,18]),{15:[1,46]},o([15,47,51],[2,31],{31:30,57:47,11:$V2,12:$V3,42:$V4,43:$V5,49:$V6,52:$V7,54:$V8,55:$V9}),o($Vd,[2,56]),o($Vd,[2,32]),o($Vd,[2,33]),o($Vd,[2,34]),o($Vd,[2,35]),o($Vd,[2,36]),o($Vd,[2,37]),o($Vd,[2,38]),{11:$V2,12:$V3,14:48,31:30,42:$V4,43:$V5,49:$V6,52:$V7,54:$V8,55:$V9,56:23,57:24},{43:[1,49]},{15:[1,50]},{52:[1,51]},{15:[1,52]},{15:[1,53]},{15:[1,54]},{52:[1,55]},{52:[2,42]},{52:[2,43]},{29:[1,56]},{15:[1,57]},{15:[1,58]},{15:[1,59]},o($Ve,$V0,{6:3,4:60}),o($Vd,[2,57]),{51:[1,61]},o($Vf,[2,52],{44:62}),o($V1,[2,9]),{31:66,42:$V4,53:63,54:$Vg,55:$Vh},o([9,11,12,13,19,21,22,23,26,28,30,32,33,34,35],$V0,{6:3,4:67}),o([9,11,12,13,19,21,23,25,26,28,30,32,33,34,35,41],$V0,{6:3,4:68}),o($V1,[2,12]),{31:66,42:$V4,53:69,54:$Vg,55:$Vh},o($V1,[2,13]),o($V1,[2,14]),o($V1,[2,15]),o($V1,[2,16]),o($Vi,[2,46],{16:70}),o($Vd,[2,39]),o([11,12,15,42,43,47,51,52,54,55],[2,22],{45:71,46:[1,72],48:[1,73],49:[1,74]}),{12:[1,75],15:[2,27]},o($Vj,[2,28]),o($Vj,[2,29]),o($Vj,[2,30]),{22:[1,76]},{24:77,25:[2,50],40:78,41:[1,79]},{12:[1,80],15:[2,41]},{17:81,18:[2,48],36:83,37:[1,85],38:82,39:[1,84]},o($Vf,[2,53]),{11:$V2,12:$V3,14:86,31:30,42:$V4,43:$V5,49:$V6,52:$V7,54:$V8,55:$V9,56:23,57:24},{43:[1,87]},{11:$V2,12:$V3,14:89,31:30,42:$V4,43:$V5,49:$V6,50:88,51:[2,54],52:$V7,54:$V8,55:$V9,56:23,57:24},{20:90,43:$Va},o($V1,[2,10]),{25:[1,91]},{25:[2,51]},o([9,11,12,13,19,21,23,25,26,28,30,32,33,34,35],$V0,{6:3,4:92}),{27:93,43:$Vb,55:$Vc,58:39},{18:[1,94]},o($Vi,[2,47]),{18:[2,49]},{11:$V2,12:$V3,14:95,31:30,42:$V4,43:$V5,49:$V6,52:$V7,54:$V8,55:$V9,56:23,57:24},o([9,11,12,13,18,19,21,23,26,28,30,32,33,34,35],$V0,{6:3,4:96}),{47:[1,97]},o($Vf,[2,24]),{51:[1,98]},{51:[2,55]},{15:[2,26]},o($V1,[2,11]),{25:[2,21]},{15:[2,40]},o($V1,[2,8]),{15:[1,99]},{18:[2,19]},o($Vf,[2,23]),o($Vf,[2,25]),o($Ve,$V0,{6:3,4:100}),o($Vi,[2,20])], +defaultActions: {4:[2,1],40:[2,42],41:[2,43],78:[2,51],83:[2,49],89:[2,55],90:[2,26],92:[2,21],93:[2,40],96:[2,19]}, +parseError: function parseError (str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + var error = new Error(str); + error.hash = hash; + throw error; + } +}, +parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; + } + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + _token_stack: + var lex = function () { + var token; + token = lexer.lex() || EOF; + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + }; + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; +}}; + +/* generated by jison-lex 0.3.4 */ +var lexer = (function(){ +var lexer = ({ + +EOF:1, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + +// resets the lexer, sets new input +setInput:function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0,0]; + } + this.offset = 0; + return this; + }, + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + + this._input = this._input.slice(1); + return ch; + }, + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; + }, + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + + } + return this; + }, + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); + }, + +// displays already matched input, i.e. for error messages +pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + +// displays upcoming input, i.e. for error messages +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + +// displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function(match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } + return false; + }, + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + +// return next match that has a token +lex:function lex () { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin (condition) { + this.conditionStack.push(condition); + }, + +// pop the previously active lexer condition state off the condition stack +popState:function popState () { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules () { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState (n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + +// alias for begin(condition) +pushState:function pushState (condition) { + this.begin(condition); + }, + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0:/* comment */ +break; +case 1: yy_.yytext = yy_.yytext.substring(9, yy_.yytext.length - 10); return 9; +break; +case 2:return 54; +break; +case 3:return 54; +break; +case 4:return 42; +break; +case 5: return 55; +break; +case 6: return 43; +break; +case 7:return 48; +break; +case 8:return 46; +break; +case 9:return 47; +break; +case 10:return 49; +break; +case 11:return 51; +break; +case 12:return 52; +break; +case 13:return 34; +break; +case 14:return 35; +break; +case 15: this.begin('command'); return 32; +break; +case 16: this.begin('command'); return 33; +break; +case 17: this.begin('command'); return 13; +break; +case 18: this.begin('command'); return 39; +break; +case 19: this.begin('command'); return 39; +break; +case 20:return 37; +break; +case 21:return 18; +break; +case 22:return 28; +break; +case 23:return 29; +break; +case 24: this.begin('command'); return 19; +break; +case 25: this.begin('command'); return 21; +break; +case 26: this.begin('command'); return 26; +break; +case 27:return 22; +break; +case 28: this.begin('command'); return 23; +break; +case 29:return 41; +break; +case 30:return 25; +break; +case 31: this.begin('command'); return 30; +break; +case 32: this.popState(); return 15; +break; +case 33:return 12; +break; +case 34:return 5; +break; +case 35:return 11; +break; +} +}, +rules: [/^(?:\{\*[\s\S]*?\*\})/,/^(?:\{literal\}[\s\S]*?\{\/literal\})/,/^(?:"([^"]|\\\.)*")/,/^(?:'([^']|\\\.)*')/,/^(?:\$)/,/^(?:[0-9]+)/,/^(?:[_a-zA-Z][_a-zA-Z0-9]*)/,/^(?:\.)/,/^(?:\[)/,/^(?:\])/,/^(?:\()/,/^(?:\))/,/^(?:=)/,/^(?:\{ldelim\})/,/^(?:\{rdelim\})/,/^(?:\{#)/,/^(?:\{@)/,/^(?:\{if )/,/^(?:\{else if )/,/^(?:\{elseif )/,/^(?:\{else\})/,/^(?:\{\/if\})/,/^(?:\{lang\})/,/^(?:\{\/lang\})/,/^(?:\{include )/,/^(?:\{implode )/,/^(?:\{plural )/,/^(?:\{\/implode\})/,/^(?:\{foreach )/,/^(?:\{foreachelse\})/,/^(?:\{\/foreach\})/,/^(?:\{(?!\s))/,/^(?:\})/,/^(?:\s+)/,/^(?:$)/,/^(?:[^{])/], +conditions: {"command":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35],"inclusive":true},"INITIAL":{"rules":[0,1,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35],"inclusive":true}} +}); +return lexer; +})(); +parser.lexer = lexer; +return parser; +}); +/** + * Provides helper functions for Number handling. + * + * @author Tim Duesterhus + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/NumberUtil + */ +define('WoltLabSuite/Core/NumberUtil',[], function() { + "use strict"; + + /** + * @exports WoltLabSuite/Core/NumberUtil + */ + var NumberUtil = { + /** + * Decimal adjustment of a number. + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round + * @param {Number} value The number. + * @param {Integer} exp The exponent (the 10 logarithm of the adjustment base). + * @returns {Number} The adjusted value. + */ + round: function (value, exp) { + // If the exp is undefined or zero... + if (typeof exp === 'undefined' || +exp === 0) { + return Math.round(value); + } + value = +value; + exp = +exp; + + // If the value is not a number or the exp is not an integer... + if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) { + return NaN; + } + + // Shift + value = value.toString().split('e'); + value = Math.round(+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp))); + + // Shift back + value = value.toString().split('e'); + return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp)); + } + }; + + return NumberUtil; +}); + +/** + * Provides helper functions for String handling. + * + * @author Tim Duesterhus, Joshua Ruesweg + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module StringUtil (alias) + * @module WoltLabSuite/Core/StringUtil + */ +define('WoltLabSuite/Core/StringUtil',['Language', './NumberUtil'], function(Language, NumberUtil) { + "use strict"; + + /** + * @exports WoltLabSuite/Core/StringUtil + */ + return { + /** + * Adds thousands separators to a given number. + * + * @see http://stackoverflow.com/a/6502556/782822 + * @param {?} number + * @return {String} + */ + addThousandsSeparator: function(number) { + // Fetch Language, as it cannot be provided because of a circular dependency + if (Language === undefined) Language = require('Language'); + + return String(number).replace(/(^-?\d{1,3}|\d{3})(?=(?:\d{3})+(?:$|\.))/g, '$1' + Language.get('wcf.global.thousandsSeparator')); + }, + + /** + * Escapes special HTML-characters within a string + * + * @param {?} string + * @return {String} + */ + escapeHTML: function (string) { + return String(string).replace(/&/g, '&').replace(/"/g, '"').replace(//g, '>'); + }, + + /** + * Escapes a String to work with RegExp. + * + * @see https://github.com/sstephenson/prototype/blob/master/src/prototype/lang/regexp.js#L25 + * @param {?} string + * @return {String} + */ + escapeRegExp: function(string) { + return String(string).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); + }, + + /** + * Rounds number to given count of floating point digits, localizes decimal-point and inserts thousands separators. + * + * @param {?} number + * @param {int} decimalPlaces The number of decimal places to leave after rounding. + * @return {String} + */ + formatNumeric: function(number, decimalPlaces) { + // Fetch Language, as it cannot be provided because of a circular dependency + if (Language === undefined) Language = require('Language'); + + number = String(NumberUtil.round(number, decimalPlaces || -2)); + var numberParts = number.split('.'); + + number = this.addThousandsSeparator(numberParts[0]); + if (numberParts.length > 1) number += Language.get('wcf.global.decimalPoint') + numberParts[1]; + + number = number.replace('-', '\u2212'); + + return number; + }, + + /** + * Makes a string's first character lowercase. + * + * @param {?} string + * @return {String} + */ + lcfirst: function(string) { + return String(string).substring(0, 1).toLowerCase() + string.substring(1); + }, + + /** + * Makes a string's first character uppercase. + * + * @param {?} string + * @return {String} + */ + ucfirst: function(string) { + return String(string).substring(0, 1).toUpperCase() + string.substring(1); + }, + + /** + * Unescapes special HTML-characters within a string. + * + * @param {?} string + * @return {String} + */ + unescapeHTML: function(string) { + return String(string).replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); + }, + + /** + * Shortens numbers larger than 1000 by using unit suffixes. + * + * @param {?} number + * @return {String} + */ + shortUnit: function(number) { + var unitSuffix = ''; + + if (number >= 1000000) { + number /= 1000000; + + if (number > 10) { + number = Math.floor(number); + } + else { + number = NumberUtil.round(number, -1); + } + + unitSuffix = 'M'; + } + else if (number >= 1000) { + number /= 1000; + + if (number > 10) { + number = Math.floor(number); + } + else { + number = NumberUtil.round(number, -1); + } + + unitSuffix = 'k'; + } + + return this.formatNumeric(number) + unitSuffix; + } + }; +}); + +/** + * Generates plural phrases for the `plural` template plugin. + * + * @author Matthias Schmidt, Marcel Werk + * @copyright 2001-2020 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/I18n/Plural + */ +define('WoltLabSuite/Core/I18n/Plural',['StringUtil'], function(StringUtil) { + "use strict"; + + var PLURAL_FEW = 'few'; + var PLURAL_MANY = 'many'; + var PLURAL_ONE = 'one'; + var PLURAL_OTHER = 'other'; + var PLURAL_TWO = 'two'; + var PLURAL_ZERO = 'zero'; + + return { + /** + * Returns the plural category for the given value. + * + * @param {number} value + * @param {?string} languageCode + * @return string + */ + getCategory: function(value, languageCode) { + if (!languageCode) { + languageCode = document.documentElement.lang; + } + + // Fallback: handle unknown languages as English + if (typeof this[languageCode] !== 'function') { + languageCode = 'en'; + } + + var category = this[languageCode](value); + if (category) { + return category; + } + + return PLURAL_OTHER; + }, + + /** + * Returns the value for a `plural` element used in the template. + * + * @param {object} parameters + * @see wcf\system\template\plugin\PluralFunctionTemplatePlugin::execute() + */ + getCategoryFromTemplateParameters: function(parameters) { + if (!parameters['value'] ) { + throw new Error('Missing parameter value'); + } + if (!parameters['other']) { + throw new Error('Missing parameter other'); + } + + var value = parameters['value']; + if (Array.isArray(value)) { + value = value.length; + } + + // handle numeric attributes + for (var key in parameters) { + if (objOwns(parameters, key) && key == ~~key && key == value) { + return parameters[key]; + } + } + + var category = this.getCategory(value); + if (!parameters[category]) { + category = PLURAL_OTHER; + } + + var string = parameters[category]; + if (string.indexOf('#') !== -1) { + return string.replace('#', StringUtil.formatNumeric(value)); + } + + return string; + }, + + /** + * `f` is the fractional number as a whole number (1.234 yields 234) + * + * @param {number} n + * @return {integer} + */ + getF: function(n) { + n = n.toString(); + var pos = n.indexOf('.'); + if (pos === -1) { + return 0; + } + + return parseInt(n.substr(pos + 1), 10); + }, + + /** + * `v` represents the number of digits of the fractional part (1.234 yields 3) + * + * @param {number} n + * @return {integer} + */ + getV: function(n) { + return n.toString().replace(/^[^.]*\.?/, '').length; + }, + + // Afrikaans + af: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Amharic + am: function(n) { + var i = Math.floor(Math.abs(n)); + if (n == 1 || i === 0) return PLURAL_ONE; + }, + + // Arabic + ar: function(n) { + if (n == 0) return PLURAL_ZERO; + if (n == 1) return PLURAL_ONE; + if (n == 2) return PLURAL_TWO; + + var mod100 = n % 100; + if (mod100 >= 3 && mod100 <= 10) return PLURAL_FEW; + if (mod100 >= 11 && mod100 <= 99) return PLURAL_MANY; + }, + + // Assamese + as: function(n) { + var i = Math.floor(Math.abs(n)); + if (n == 1 || i === 0) return PLURAL_ONE; + }, + + // Azerbaijani + az: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Belarusian + be: function(n) { + var mod10 = n % 10; + var mod100 = n % 100; + + if (mod10 == 1 && mod100 != 11) return PLURAL_ONE; + if (mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) return PLURAL_FEW; + if (mod10 == 0 || (mod10 >= 5 && mod10 <= 9) || (mod100 >= 11 && mod100 <= 14)) return PLURAL_MANY; + }, + + // Bulgarian + bg: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Bengali + bn: function(n) { + var i = Math.floor(Math.abs(n)); + if (n == 1 || i === 0) return PLURAL_ONE; + }, + + // Tibetan + bo: function(n) {}, + + // Bosnian + bs: function(n) { + var v = this.getV(n); + var f = this.getF(n); + var mod10 = n % 10; + var mod100 = n % 100; + var fMod10 = f % 10; + var fMod100 = f % 100; + + if ((v == 0 && mod10 == 1 && mod100 != 11) || (fMod10 == 1 && fMod100 != 11)) return PLURAL_ONE; + if ((v == 0 && mod10 >= 2 && mod10 <= 4 && mod100 >= 12 && mod100 <= 14) + || (fMod10 >= 2 && fMod10 <= 4 && fMod100 >= 12 && fMod100 <= 14)) return PLURAL_FEW; + }, + + // Czech + cs: function(n) { + var v = this.getV(n); + + if (n == 1 && v === 0) return PLURAL_ONE; + if (n >= 2 && n <= 4 && v === 0) return PLURAL_FEW; + if (v === 0) return PLURAL_MANY; + }, + + // Welsh + cy: function(n) { + if (n == 0) return PLURAL_ZERO; + if (n == 1) return PLURAL_ONE; + if (n == 2) return PLURAL_TWO; + if (n == 3) return PLURAL_FEW; + if (n == 6) return PLURAL_MANY; + }, + + // Danish + da: function(n) { + if (n > 0 && n < 2) return PLURAL_ONE; + }, + + // Greek + el: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Catalan (ca) + // German (de) + // English (en) + // Estonian (et) + // Finnish (fi) + // Italian (it) + // Dutch (nl) + // Swedish (sv) + // Swahili (sw) + // Urdu (ur) + en: function(n) { + if (n == 1 && this.getV(n) === 0) return PLURAL_ONE; + }, + + // Spanish + es: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Basque + eu: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Persian + fa: function(n) { + if (n >= 0 && n <= 1) return PLURAL_ONE; + }, + + // French + fr: function(n) { + if (n >= 0 && n < 2) return PLURAL_ONE; + }, + + // Irish + ga: function(n) { + if (n == 1) return PLURAL_ONE; + if (n == 2) return PLURAL_TWO; + if (n == 3 || n == 4 || n == 5 || n == 6) return PLURAL_FEW; + if (n == 7 || n == 8 || n == 9 || n == 10) return PLURAL_MANY; + }, + + // Gujarati + gu: function(n) { + if (n >= 0 && n <= 1) return PLURAL_ONE; + }, + + // Hebrew + he: function(n) { + var v = this.getV(n); + + if (n == 1 && v === 0) return PLURAL_ONE; + if (n == 2 && v === 0) return PLURAL_TWO; + if (n > 10 && v === 0 && n % 10 == 0) return PLURAL_MANY; + }, + + // Hindi + hi: function(n) { + if (n >= 0 && n <= 1) return PLURAL_ONE; + }, + + // Croatian + hr: function(n) { + // same as Bosnian + return this.bs(n); + }, + + // Hungarian + hu: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Armenian + hy: function(n) { + if (n >= 0 && n < 2) return PLURAL_ONE; + }, + + // Indonesian + id: function(n) {}, + + // Icelandic + is: function(n) { + var f = this.getF(n); + + if (f === 0 && n % 10 === 1 && !(n % 100 === 11) || !(f === 0)) return PLURAL_ONE; + }, + + // Japanese + ja: function(n) {}, + + // Javanese + jv: function(n) {}, + + // Georgian + ka: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Kazakh + kk: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Khmer + km: function(n) {}, + + // Kannada + kn: function(n) { + if (n >= 0 && n <= 1) return PLURAL_ONE; + }, + + // Korean + ko: function(n) {}, + + // Kurdish + ku: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Kyrgyz + ky: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Luxembourgish + lb: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Lao + lo: function(n) {}, + + // Lithuanian + lt: function(n) { + var mod10 = n % 10; + var mod100 = n % 100; + + if (mod10 == 1 && !(mod100 >= 11 && mod100 <= 19)) return PLURAL_ONE; + if (mod10 >= 2 && mod10 <= 9 && !(mod100 >= 11 && mod100 <= 19)) return PLURAL_FEW; + if (this.getF(n) != 0) return PLURAL_MANY; + }, + + // Latvian + lv: function(n) { + var mod10 = n % 10; + var mod100 = n % 100; + var v = this.getV(n); + var f = this.getF(n); + var fMod10 = f % 10; + var fMod100 = f % 100; + + if (mod10 == 0 || (mod100 >= 11 && mod100 <= 19) || (v == 2 && fMod100 >= 11 && fMod100 <= 19)) return PLURAL_ZERO; + if ((mod10 == 1 && mod100 != 11) || (v == 2 && fMod10 == 1 && fMod100 != 11) || (v != 2 && fMod10 == 1)) return PLURAL_ONE; + }, + + // Macedonian + mk: function(n) { + var v = this.getV(n); + var f = this.getF(n); + var mod10 = n % 10; + var mod100 = n % 100; + var fMod10 = f % 10; + var fMod100 = f % 100; + + if ((v == 0 && mod10 == 1 && mod100 != 11) || (fMod10 == 1 && fMod100 != 11)) return PLURAL_ONE; + }, + + // Malayalam + ml: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Mongolian + mn: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Marathi + mr: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Malay + ms: function(n) {}, + + // Maltese + mt: function(n) { + var mod100 = n % 100; + + if (n == 1) return PLURAL_ONE; + if (n == 0 || (mod100 >= 2 && mod100 <= 10)) return PLURAL_FEW; + if (mod100 >= 11 && mod100 <= 19) return PLURAL_MANY; + }, + + // Burmese + my: function(n) {}, + + // Norwegian + no: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Nepali + ne: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Odia + or: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Punjabi + pa: function(n) { + if (n == 1 || n == 0) return PLURAL_ONE; + }, + + // Polish + pl: function(n) { + var v = this.getV(n); + var mod10 = n % 10; + var mod100 = n % 100; + + if (n == 1 && v == 0) return PLURAL_ONE; + if (v == 0 && mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) return PLURAL_FEW; + if (v == 0 && ((n != 1 && mod10 >= 0 && mod10 <= 1) || (mod10 >= 5 && mod10 <= 9) || (mod100 >= 12 && mod100 <= 14))) return PLURAL_MANY; + }, + + // Pashto + ps: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Portuguese + pt: function(n) { + if (n >= 0 && n < 2) return PLURAL_ONE; + }, + + // Romanian + ro: function(n) { + var v = this.getV(n); + var mod100 = n % 100; + + if (n == 1 && v === 0) return PLURAL_ONE; + if (v != 0 || n == 0 || (mod100 >= 2 && mod100 <= 19)) return PLURAL_FEW; + }, + + // Russian + ru: function(n) { + var mod10 = n % 10; + var mod100 = n % 100; + + if (this.getV(n) == 0) { + if (mod10 == 1 && mod100 != 11) return PLURAL_ONE; + if (mod10 >= 2 && mod10 <= 4 && !(mod100 >= 12 && mod100 <= 14)) return PLURAL_FEW; + if (mod10 == 0 || (mod10 >= 5 && mod10 <= 9) || (mod100 >= 11 && mod100 <= 14)) return PLURAL_MANY; + } + }, + + // Sindhi + sd: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Sinhala + si: function(n) { + if (n == 0 || n == 1 || (Math.floor(n) == 0 && this.getF(n) == 1)) return PLURAL_ONE; + }, + + // Slovak + sk: function(n) { + // same as Czech + return this.cs(n); + }, + + // Slovenian + sl: function(n) { + var v = this.getV(n); + var mod100 = n % 100; + + if (v == 0 && mod100 == 1) return PLURAL_ONE; + if (v == 0 && mod100 == 2) return PLURAL_TWO; + if ((v == 0 && (mod100 == 3 || mod100 == 4)) || v != 0) return PLURAL_FEW; + }, + + // Albanian + sq: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Serbian + sr: function(n) { + // same as Bosnian + return this.bs(n); + }, + + // Tamil + ta: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Telugu + te: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Tajik + tg: function(n) {}, + + // Thai + th: function(n) {}, + + // Turkmen + tk: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Turkish + tr: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Uyghur + ug: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Ukrainian + uk: function(n) { + // same as Russian + return this.ru(n); + }, + + // Uzbek + uz: function(n) { + if (n == 1) return PLURAL_ONE; + }, + + // Vietnamese + vi: function(n) {}, + + // Chinese + zh: function(n) {} + }; +}); + +/** + * WoltLabSuite/Core/Template provides a template scripting compiler similar + * to the PHP one of WoltLab Suite Core. It supports a limited + * set of useful commands and compiles templates down to a pure + * JavaScript Function. + * + * @author Tim Duesterhus + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module WoltLabSuite/Core/Template + */ +define('WoltLabSuite/Core/Template',['./Template.grammar', './StringUtil', 'Language', 'WoltLabSuite/Core/I18n/Plural'], function(parser, StringUtil, Language, I18nPlural) { + "use strict"; + + // work around bug in AMD module generation of Jison + function Parser() { + this.yy = {}; + } + Parser.prototype = parser; + parser.Parser = Parser; + parser = new Parser(); + + /** + * Compiles the given template. + * + * @param {string} template Template to compile. + * @constructor + */ + function Template(template) { + // Fetch Language/StringUtil, as it cannot be provided because of a circular dependency + if (Language === undefined) Language = require('Language'); + if (StringUtil === undefined) StringUtil = require('StringUtil'); + + try { + template = parser.parse(template); + template = "var tmp = {};\n" + + "for (var key in v) tmp[key] = v[key];\n" + + "v = tmp;\n" + + "v.__wcf = window.WCF; v.__window = window;\n" + + "return " + template; + + this.fetch = new Function("StringUtil", "Language", "I18nPlural", "v", template).bind(undefined, StringUtil, Language, I18nPlural); + } + catch (e) { + console.debug(e.message); + throw e; + } + } + + Object.defineProperty(Template, 'callbacks', { + enumerable: false, + configurable: false, + get: function() { + throw new Error('WCF.Template.callbacks is no longer supported'); + }, + set: function(value) { + throw new Error('WCF.Template.callbacks is no longer supported'); + } + }); + + Template.prototype = { + /** + * Evaluates the Template using the given parameters. + * + * @param {object} v Parameters to pass to the template. + */ + fetch: function(v) { + // this will be replaced in the init function + throw new Error('This Template is not initialized.'); + } + }; + + return Template; +}); + +/** + * Manages language items. + * + * @author Tim Duesterhus + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module Language (alias) + * @module WoltLabSuite/Core/Language + */ +define('WoltLabSuite/Core/Language',['Dictionary', './Template'], function(Dictionary, Template) { + "use strict"; + + var _languageItems = new Dictionary(); + + /** + * @exports WoltLabSuite/Core/Language + */ + var Language = { + /** + * Adds all the language items in the given object to the store. + * + * @param {Object.} object + */ + addObject: function(object) { + _languageItems.merge(Dictionary.fromObject(object)); + }, + + /** + * Adds a single language item to the store. + * + * @param {string} key + * @param {string} value + */ + add: function(key, value) { + _languageItems.set(key, value); + }, + + /** + * Fetches the language item specified by the given key. + * If the language item is a string it will be evaluated as + * WoltLabSuite/Core/Template with the given parameters. + * + * @param {string} key Language item to return. + * @param {Object=} parameters Parameters to provide to WoltLabSuite/Core/Template. + * @return {string} + */ + get: function(key, parameters) { + if (!parameters) parameters = { }; + + var value = _languageItems.get(key); + + if (value === undefined) { + return key; + } + + // fetch Template, as it cannot be provided because of a circular dependency + if (Template === undefined) Template = require('WoltLabSuite/Core/Template'); + + if (typeof value === 'string') { + // lazily convert to WCF.Template + try { + _languageItems.set(key, new Template(value)); + } + catch (e) { + _languageItems.set(key, new Template('{literal}' + value.replace(/\{\/literal\}/g, '{/literal}{ldelim}/literal}{literal}') + '{/literal}')); + } + value = _languageItems.get(key); + } + + if (value instanceof Template) { + value = value.fetch(parameters); + } + + return value; + } + }; + + return Language; +}); + +/** + * Simple API to store and invoke multiple callbacks per identifier. + * + * @author Alexander Ebert + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module CallbackList (alias) + * @module WoltLabSuite/Core/CallbackList + */ +define('WoltLabSuite/Core/CallbackList',['Dictionary'], function(Dictionary) { + "use strict"; + + /** + * @constructor + */ + function CallbackList() { + this._dictionary = new Dictionary(); + } + CallbackList.prototype = { + /** + * Adds a callback for given identifier. + * + * @param {string} identifier arbitrary string to group and identify callbacks + * @param {function} callback callback function + */ + add: function(identifier, callback) { + if (typeof callback !== 'function') { + throw new TypeError("Expected a valid callback as second argument for identifier '" + identifier + "'."); + } + + if (!this._dictionary.has(identifier)) { + this._dictionary.set(identifier, []); + } + + this._dictionary.get(identifier).push(callback); + }, + + /** + * Removes all callbacks registered for given identifier + * + * @param {string} identifier arbitrary string to group and identify callbacks + */ + remove: function(identifier) { + this._dictionary['delete'](identifier); + }, + + /** + * Invokes callback function on each registered callback. + * + * @param {string|null} identifier arbitrary string to group and identify callbacks. + * null is a wildcard to match every identifier + * @param {function(function)} callback function called with the individual callback as parameter + */ + forEach: function(identifier, callback) { + if (identifier === null) { + this._dictionary.forEach(function(callbacks, identifier) { + callbacks.forEach(callback); + }); + } + else { + var callbacks = this._dictionary.get(identifier); + if (callbacks !== undefined) { + callbacks.forEach(callback); + } + } + } + }; + + return CallbackList; +}); + +/** + * Allows to be informed when the DOM may have changed and + * new elements that are relevant to you may have been added. + * + * @author Tim Duesterhus + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module Dom/ChangeListener (alias) + * @module WoltLabSuite/Core/Dom/Change/Listener + */ +define('WoltLabSuite/Core/Dom/Change/Listener',['CallbackList'], function(CallbackList) { + "use strict"; + + var _callbackList = new CallbackList(); + var _hot = false; + + /** + * @exports WoltLabSuite/Core/Dom/Change/Listener + */ + return { + /** + * @see WoltLabSuite/Core/CallbackList#add + */ + add: _callbackList.add.bind(_callbackList), + + /** + * @see WoltLabSuite/Core/CallbackList#remove + */ + remove: _callbackList.remove.bind(_callbackList), + + /** + * Triggers the execution of all the listeners. + * Use this function when you added new elements to the DOM that might + * be relevant to others. + * While this function is in progress further calls to it will be ignored. + */ + trigger: function() { + if (_hot) return; + + try { + _hot = true; + _callbackList.forEach(null, function(callback) { + callback(); + }); + } + finally { + _hot = false; + } + } + }; +}); + +/** + * Provides basic details on the JavaScript environment. + * + * @author Alexander Ebert + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module Environment (alias) + * @module WoltLabSuite/Core/Environment + */ +define('WoltLabSuite/Core/Environment',[], function() { + "use strict"; + + var _browser = 'other'; + var _editor = 'none'; + var _platform = 'desktop'; + var _touch = false; + + /** + * @exports WoltLabSuite/Core/Environment + */ + return { + /** + * Determines environment variables. + */ + setup: function() { + if (typeof window.chrome === 'object') { + // this detects Opera as well, we could check for window.opr if we need to + _browser = 'chrome'; + } + else { + var styles = window.getComputedStyle(document.documentElement); + for (var i = 0, length = styles.length; i < length; i++) { + var property = styles[i]; + + if (property.indexOf('-ms-') === 0) { + // it is tempting to use 'msie', but it wouldn't really represent 'Edge' + _browser = 'microsoft'; + } + else if (property.indexOf('-moz-') === 0) { + _browser = 'firefox'; + } + else if (_browser !== 'firefox' && property.indexOf('-webkit-') === 0) { + _browser = 'safari'; + } + } + } + + var ua = window.navigator.userAgent.toLowerCase(); + if (ua.indexOf('crios') !== -1) { + _browser = 'chrome'; + _platform = 'ios'; + } + else if (/(?:iphone|ipad|ipod)/.test(ua)) { + _browser = 'safari'; + _platform = 'ios'; + } + else if (ua.indexOf('android') !== -1) { + _platform = 'android'; + } + else if (ua.indexOf('iemobile') !== -1) { + _browser = 'microsoft'; + _platform = 'windows'; + } + + if (_platform === 'desktop' && (ua.indexOf('mobile') !== -1 || ua.indexOf('tablet') !== -1)) { + _platform = 'mobile'; + } + + _editor = 'redactor'; + _touch = (!!('ontouchstart' in window) || (!!('msMaxTouchPoints' in window.navigator) && window.navigator.msMaxTouchPoints > 0) || window.DocumentTouch && document instanceof DocumentTouch); + + // The iPad Pro 12.9" masquerades as a desktop browser. + if (window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1) { + _browser = 'safari'; + _platform = 'ios'; + } + }, + + /** + * Returns the lower-case browser identifier. + * + * Possible values: + * - chrome: Chrome and Opera + * - firefox + * - microsoft: Internet Explorer and Microsoft Edge + * - safari + * + * @return {string} browser identifier + */ + browser: function() { + return _browser; + }, + + /** + * Returns the available editor's name or an empty string. + * + * @return {string} editor name + */ + editor: function() { + return _editor; + }, + + /** + * Returns the browser platform. + * + * Possible values: + * - desktop + * - android + * - ios: iPhone, iPad and iPod + * - windows: Windows on phones/tablets + * + * @return {string} browser platform + */ + platform: function() { + return _platform; + }, + + /** + * Returns true if browser is potentially used with a touchscreen. + * + * Warning: Detecting touch is unreliable and should be avoided at all cost. + * + * @deprecated 3.0 - exists for backward-compatibility only, will be removed in the future + * + * @return {boolean} true if a touchscreen is present + */ + touch: function() { + return _touch; + } + }; +}); + +/** + * Provides helper functions to work with DOM nodes. + * + * @author Alexander Ebert + * @copyright 2001-2019 WoltLab GmbH + * @license GNU Lesser General Public License + * @module Dom/Util (alias) + * @module WoltLabSuite/Core/Dom/Util + */ +define('WoltLabSuite/Core/Dom/Util',['Environment', 'StringUtil'], function(Environment, StringUtil) { + "use strict"; + + function _isBoundaryNode(element, ancestor, position) { + if (!ancestor.contains(element)) { + throw new Error("Ancestor element does not contain target element."); + } + + var node, whichSibling = position + 'Sibling'; + while (element !== null && element !== ancestor) { + if (element[position + 'ElementSibling'] !== null) { + return false; + } + else if (element[whichSibling]) { + node = element[whichSibling]; + while (node) { + if (node.textContent.trim() !== '') { + return false; + } + + node = node[whichSibling]; + } + } + + element = element.parentNode; + } + + return true; + } + + var _idCounter = 0; + + /** + * @exports WoltLabSuite/Core/Dom/Util + */ + var DomUtil = { + /** + * Returns a DocumentFragment containing the provided HTML string as DOM nodes. + * + * @param {string} html HTML string + * @return {DocumentFragment} fragment containing DOM nodes + */ + createFragmentFromHtml: function(html) { + var tmp = elCreate('div'); + this.setInnerHtml(tmp, html); + + var fragment = document.createDocumentFragment(); + while (tmp.childNodes.length) { + fragment.appendChild(tmp.childNodes[0]); + } + + return fragment; + }, + + /** + * Returns a unique element id. + * + * @return {string} unique id + */ + getUniqueId: function() { + var elementId; + + do { + elementId = 'wcf' + _idCounter++; + } + while (elById(elementId) !== null); + + return elementId; + }, + + /** + * Returns the element's id. If there is no id set, a unique id will be + * created and assigned. + * + * @param {Element} el element + * @return {string} element id + */ + identify: function(el) { + if (!(el instanceof Element)) { + throw new TypeError("Expected a valid DOM element as argument."); + } + + var id = elAttr(el, 'id'); + if (!id) { + id = this.getUniqueId(); + elAttr(el, 'id', id); + } + + return id; + }, + + /** + * Returns the outer height of an element including margins. + * + * @param {Element} el element + * @param {CSSStyleDeclaration=} styles result of window.getComputedStyle() + * @return {int} outer height in px + */ + outerHeight: function(el, styles) { + styles = styles || window.getComputedStyle(el); + + var height = el.offsetHeight; + height += ~~styles.marginTop + ~~styles.marginBottom; + + return height; + }, + + /** + * Returns the outer width of an element including margins. + * + * @param {Element} el element + * @param {CSSStyleDeclaration=} styles result of window.getComputedStyle() + * @return {int} outer width in px + */ + outerWidth: function(el, styles) { + styles = styles || window.getComputedStyle(el); + + var width = el.offsetWidth; + width += ~~styles.marginLeft + ~~styles.marginRight; + + return width; + }, + + /** + * Returns the outer dimensions of an element including margins. + * + * @param {Element} el element + * @return {{height: int, width: int}} dimensions in px + */ + outerDimensions: function(el) { + var styles = window.getComputedStyle(el); + + return { + height: this.outerHeight(el, styles), + width: this.outerWidth(el, styles) + }; + }, + + /** + * Returns the element's offset relative to the document's top left corner. + * + * @param {Element} el element + * @return {{left: int, top: int}} offset relative to top left corner + */ + offset: function(el) { + var rect = el.getBoundingClientRect(); + + return { + top: Math.round(rect.top + (window.scrollY || window.pageYOffset)), + left: Math.round(rect.left + (window.scrollX || window.pageXOffset)) + }; + }, + + /** + * Prepends an element to a parent element. + * + * @param {Element} el element to prepend + * @param {Element} parentEl future containing element + * @deprecated 5.3 Use `parentEl.insertBefore(el, parentEl.firstChild)` instead. + */ + prepend: function(el, parentEl) { + if (parentEl.childNodes.length === 0) { + parentEl.appendChild(el); + } + else { + parentEl.insertBefore(el, parentEl.childNodes[0]); + } + }, + + /** + * Inserts an element after an existing element. + * + * @param {Element} newEl element to insert + * @param {Element} el reference element + * @deprecated 5.3 Use `el.parentNode.insertBefore(newEl, el.nextSibling)` instead. + */ + insertAfter: function(newEl, el) { + if (el.nextSibling !== null) { + el.parentNode.insertBefore(newEl, el.nextSibling); + } + else { + el.parentNode.appendChild(newEl); + } + }, + + /** + * Applies a list of CSS properties to an element. + * + * @param {Element} el element + * @param {Object} styles list of CSS styles + */ + setStyles: function(el, styles) { + var important = false; + for (var property in styles) { + if (styles.hasOwnProperty(property)) { + if (/ !important$/.test(styles[property])) { + important = true; + + styles[property] = styles[property].replace(/ !important$/, ''); + } + else { + important = false; + } + + // for a set style property with priority = important, some browsers are + // not able to overwrite it with a property != important; removing the + // property first solves this issue + if (el.style.getPropertyPriority(property) === 'important' && !important) { + el.style.removeProperty(property); + } + + el.style.setProperty(property, styles[property], (important ? 'important' : '')); + } + } + }, + + /** + * Returns a style property value as integer. + * + * The behavior of this method is undefined for properties that are not considered + * to have a "numeric" value, e.g. "background-image". + * + * @param {CSSStyleDeclaration} styles result of window.getComputedStyle() + * @param {string} propertyName property name + * @return {int} property value as integer + */ + styleAsInt: function(styles, propertyName) { + var value = styles.getPropertyValue(propertyName); + if (value === null) { + return 0; + } + + return parseInt(value); + }, + + /** + * Sets the inner HTML of given element and reinjects