From b08ec8e2de263624c1c636966da41ad21f668a89 Mon Sep 17 00:00:00 2001 From: "woltlab.com" Date: Tue, 19 Sep 2017 11:30:05 +0200 Subject: [PATCH] Updating minified JavaScript files --- .../redactor2/redactor.combined.min.js | 12 ++++++------ wcfsetup/install/files/js/WCF.Combined.min.js | 2 +- .../install/files/js/WoltLabSuite.Core.min.js | 18 +++++++++--------- .../files/js/WoltLabSuite.Core.tiny.min.js | 10 +++++----- 4 files changed, 21 insertions(+), 21 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 880f2c9578..b81c13c84b 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js @@ -24,10 +24,10 @@ i.append(t(this).attr("name"),t(this).val())}),i},appendForms:function(e,i){if(! (function (window, undefined) { $.Redactor.prototype.WoltLabCaret=function(){"use strict";return{init:function(){var e=this.caret.after;this.caret.after=function(t){t=this.caret.prepare(t),this.utils.isBlockTag(t.tagName)&&this.WoltLabCaret._addParagraphAfterBlock(t),e.call(this,t)}.bind(this);var t=!1;require(["Environment"],function(e){t="ios"===e.platform()});var n=this.caret.end;this.caret.end=function(e){e=this.caret.prepare(e);var i=!1;if(e.nodeType===Node.ELEMENT_NODE&&e.lastChild&&"P"===e.lastChild.nodeName)i=!0;else if(t){var r=this.core.editor()[0];e.parentNode===r&&"


"===r.innerHTML&&(i=!0)}if(i){var o=window.getSelection(),a=document.createRange();return a.selectNodeContents(e.lastChild),a.collapse(!1),o.removeAllRanges(),void o.addRange(a)}return n.call(this,e)}.bind(this);var i=this.selection.nodes;this.selection.nodes=function(e){var t=i.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.$editor[0].addEventListener(WCF_CLICK_EVENT,this.WoltLabCaret._handleEditorClick.bind(this)),this.WoltLabCaret._initInternalRange()},paragraphAfterBlock:function(e){var t=e.nextElementSibling;t&&"P"!==t.nodeName&&(t=elCreate("p"),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(){var e=this.core.editor()[0],t=null,n=window.getSelection(),i=function(){t=n.rangeCount?n.getRangeAt(0).cloneRange():null},r=function(){if(null!==t){if(document.activeElement===e){var i=n.getRangeAt(0);if(0!==i.startOffset)return;for(var r=i.startContainer;r;){if(r.parentNode===e){if(r.previousSibling)return;break}if(r.previousSibling)return;r=r.parentNode}if(!r)return}e.focus(),n.removeAllRanges(),n.addRange(t),t=null}};e.addEventListener("keyup",i),e.addEventListener("mouseup",function(){n.rangeCount&&i()});var o=this.selection.save;this.selection.save=function(){t=null,o.call(this)}.bind(this);var a=this.selection.restore;this.selection.restore=function(){t&&null===elBySel(".redactor-selection-marker",this.$editor[0])&&(r(),n.rangeCount&&this.utils.isRedactorParent(n.getRangeAt(0).commonAncestorContainer))||a.call(this)}.bind(this);var s=this.buffer.set;this.buffer.set=function(t){if(document.activeElement!==e){var n=window.getSelection();n.rangeCount&&!1!==this.utils.isRedactorParent(n.anchorNode)?e.focus():r()}s.call(this,t),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(t){"ios"===t.platform()&&(e.addEventListener("focus",function(){document.addEventListener("selectionchange",i)}),e.addEventListener("blur",function(){document.removeEventListener("selectionchange",i)}))}.bind(this))},_handleEditorClick:function(e){if(this.selection.get().isCollapsed){var t=this.selection.block();if(!1===t){if(this.selection.current()===this.$editor[0]){var n=this.$editor[0].childNodes[this.selection.get().anchorOffset];n.nodeType===Node.ELEMENT_NODE&&"TABLE"===n.nodeName&&(t=n)}if(!1===t)return}for(var i=e.target;i&&!this.utils.isBlockTag(i.nodeName);)i=i.parentNode;if(i&&i!==t&&("P"!==t.nodeName||(t=t.parentNode)!==this.$editor[0]&&this.utils.isBlockTag(t.nodeName))){if("TD"===t.nodeName)for(;"TABLE"!==t.nodeName;)t=t.parentNode;if(!t.nodeName.match(/^H\d$/)&&!$(t).closest("ol, ul",this.$editor[0]).length){for(var r,o,a=t;a;){if(o=a.getBoundingClientRect(),e.clientYo.bottom))break;r=!1,t=a}if(!a.parentNode||a.parentNode===this.$editor[0])break;a=a.parentNode}var s=t[(r?"previous":"next")+"ElementSibling"];if(s&&"P"===s.nodeName)return void this.caret.end(s);this.buffer.set();var l=elCreate("p");l.textContent="​",t.parentNode.insertBefore(l,r?t:t.nextSibling),this.caret.end(l)}}}},_addParagraphAfterBlock:function(e){var t=e.nextElementSibling;t&&("P"===t.nodeName||this.utils.isBlockTag(t.nodeName))||(t=elCreate("p"),t.textContent="​",e.parentNode.insertBefore(t,e.nextSibling))}}}; })(this); // plugins/WoltLabClean.js -(function (window, undefined) { $.Redactor.prototype.WoltLabClean=function(){"use strict";return{init:function(){var e=this.clean.onSet;this.clean.onSet=function(t){t=t.replace(/\u200B/g,""),t=t.replace(/&/g,"@@@WCF_LITERAL_AMP@@@"),t=t.replace(/&/g,"&WCF_AMPERSAND&"),t=e.call(this,t),t=t.replace(/&WCF_AMPERSAND&(amp;)?/g,"&"),t=t.replace(/@@@WCF_LITERAL_AMP@@@/,"&");var n=elCreate("div");return n.innerHTML=t,elBySelAll("iframe",n,elRemove),elBySelAll("pre",n,function(e){e.classList.contains("redactor-script-tag")&&elRemove(e)}),elBySelAll("td",n,function(e){0===e.childNodes.length&&(e.innerHTML="​")}),t=n.innerHTML}.bind(this);var t=this.clean.onSync;this.clean.onSync=function(e){var n=elCreate("div");n.innerHTML=e;var r={};return elBySelAll("pre",n,function(e){var t=WCF.getUUID();r[t]=e.textContent,e.textContent=t}),elBySelAll("p",n,function(e){var t=e.lastElementChild;if(t&&"BR"===t.nodeName&&t.nextSibling&&t.nextSibling.textContent.replace(/[\r\n\t]/g,"").match(/^\u200B+$/)){var n=elCreate("p");n.innerHTML="
",e.parentNode.insertBefore(n,e.nextSibling),e.removeChild(t.nextSibling),e.removeChild(t)}}),e=n.innerHTML,e=e.replace(/

\u200B<\/p>/g,"


"),e=e.replace(/&/g,"&WCF_AMPERSAND&"),e=t.call(this,e),e=e.replace(/&WCF_AMPERSAND&/g,"&"),n.innerHTML=e,elBySelAll("pre",n,function(e){r.hasOwnProperty(e.textContent)&&(e.textContent=r[e.textContent])}),e=n.innerHTML}.bind(this);var n=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=n.call(this,e),this.clean.encodeEntities=t,e}.bind(this);var r=this.clean.onPaste;this.clean.onPaste=function(e,t,n){if(t.pre||this.utils.isCurrentOrParent("kbd")){var l=this.clean.removeEmptyInlineTags;return this.clean.removeEmptyInlineTags=function(e){return e},e=r.call(this,e,t,n),this.clean.removeEmptyInlineTags=l,e}var i=elCreate("div");i.innerHTML=e.replace(/@@@WOLTLAB-P-ALIGN-(?:left|right|center|justify)@@@/g,"");var a,o,s,c=!0;for(o=0,s=i.childElementCount;o0;)t.appendChild(e.childNodes[0]);i.removeChild(e)})}var u,p,f,m,g=elBySelAll("[style]",i);for(o=0,s=g.length;o500&&(f=elCreate("strong"),a.parentNode.insertBefore(f,a),f.appendChild(a))),p.push(u));p.forEach(function(e){a.style.removeProperty(e)})}return elBySelAll("span",i,function(e){if(!e.hasAttribute("style")||!e.style.length){for(;e.childNodes.length;)e.parentNode.insertBefore(e.childNodes[0],e);elRemove(e)}}),elBySelAll("p",i,function(e){e.classList.contains("MsoNormal")?1===e.childElementCount&&"O:P"===e.children[0].nodeName&&" "===e.textContent&&(e.innerHTML="
"):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",i,function(e){e.removeAttribute("style")}),elBySelAll("br",i,function(e){e.parentNode.insertBefore(document.createTextNode("@@@WOLTLAB-BR-MARKER@@@"),e.nextSibling)}),e=r.call(this,i.innerHTML,t,n),e=e.replace(/@@@WOLTLAB-BR-MARKER@@@/g,""),e=e.replace(/(

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

':""}),i.innerHTML=e.replace(/&quot;/g,"""),elBySelAll("woltlab-br-marker",i,function(e){var t=e.parentNode;if("P"===t.nodeName){var n=elCreate("p");for(n.innerHTML="
";e.nextSibling;)n.appendChild(e.nextSibling);var r=e.previousSibling;r&&"BR"===r.nodeName&&elRemove(r),t.parentNode.insertBefore(n,t.nextSibling)}else t.insertBefore(elCreate("br"),e);elRemove(e)}),elBySelAll("p",i,function(e){var t=!1;0===e.childNodes.length?t=!0:""===e.textContent&&(t=!0,elBySelAll("*",e,function(e){"SPAN"!==e.nodeName&&(t=!1)})),t&&elRemove(e)}),i.innerHTML}.bind(this);var l=[],i=function(e,t){for(var n,r,i={},a=0,o=t.length;a');var n=elCreate("div");n.innerHTML=e,elBySelAll("woltlab-custom-tag",n,function(e){var t=~~elData(e,"index");if(l[t]){var n=l[t],r=elCreate(n.element.nodeName);for(var i in n.attributes)n.attributes.hasOwnProperty(i)&&elAttr(r,i,n.attributes[i]);for(e.parentNode.insertBefore(r,e);e.childNodes.length;)r.appendChild(e.childNodes[0])}elRemove(e)}),e=n.innerHTML}return o.call(this,e,t)}.bind(this),this.clean.removeSpans=function(e){return e};var s=this.clean.getCurrentType;this.clean.getCurrentType=function(e,t){var n=s.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); +(function (window, undefined) { $.Redactor.prototype.WoltLabClean=function(){"use strict";return{init:function(){var e=this.clean.onSet;this.clean.onSet=function(t){t=t.replace(/\u200B/g,""),t=t.replace(/&amp;/g,"@@@WCF_LITERAL_AMP@@@"),t=t.replace(/&/g,"&WCF_AMPERSAND&"),t=e.call(this,t),t=t.replace(/&WCF_AMPERSAND&(amp;)?/g,"&"),t=t.replace(/@@@WCF_LITERAL_AMP@@@/,"&amp;");var n=elCreate("div");return n.innerHTML=t,elBySelAll("iframe",n,elRemove),elBySelAll("pre",n,function(e){e.classList.contains("redactor-script-tag")&&elRemove(e)}),elBySelAll("td",n,function(e){0===e.childNodes.length&&(e.innerHTML="​")}),t=n.innerHTML}.bind(this);var t=this.clean.onSync;this.clean.onSync=function(e){var n=elCreate("div");n.innerHTML=e;var r={};return elBySelAll("pre",n,function(e){var t=WCF.getUUID();r[t]=e.textContent,e.textContent=t}),elBySelAll("p",n,function(e){var t=e.lastElementChild;if(t&&"BR"===t.nodeName&&t.nextSibling&&t.nextSibling.textContent.replace(/[\r\n\t]/g,"").match(/^\u200B+$/)){var n=elCreate("p");n.innerHTML="
",e.parentNode.insertBefore(n,e.nextSibling),e.removeChild(t.nextSibling),e.removeChild(t)}}),e=n.innerHTML,e=e.replace(/

\u200B<\/p>/g,"


"),e=e.replace(/&/g,"&WCF_AMPERSAND&"),e=t.call(this,e),e=e.replace(/&WCF_AMPERSAND&/g,"&"),n.innerHTML=e,elBySelAll("pre",n,function(e){r.hasOwnProperty(e.textContent)&&(e.textContent=r[e.textContent])}),e=n.innerHTML}.bind(this);var n=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=n.call(this,e),this.clean.encodeEntities=t,e}.bind(this);var r=this.clean.onPaste;this.clean.onPaste=function(e,t,n){if(t.pre||this.utils.isCurrentOrParent("kbd")){var l=this.clean.removeEmptyInlineTags;return this.clean.removeEmptyInlineTags=function(e){return e},e=r.call(this,e,t,n),this.clean.removeEmptyInlineTags=l,e}var i=elCreate("div");i.innerHTML=e.replace(/@@@WOLTLAB-P-ALIGN-(?:left|right|center|justify)@@@/g,"");var a,o,s,c=!0;for(o=0,s=i.childElementCount;o0;)t.appendChild(e.childNodes[0]);i.removeChild(e)})}var u,p,f,m,g=elBySelAll("[style]",i);for(o=0,s=g.length;o500&&(f=elCreate("strong"),a.parentNode.insertBefore(f,a),f.appendChild(a))),p.push(u));p.forEach(function(e){a.style.removeProperty(e)})}return elBySelAll("span",i,function(e){if(!e.hasAttribute("style")||!e.style.length){for(;e.childNodes.length;)e.parentNode.insertBefore(e.childNodes[0],e);elRemove(e)}}),elBySelAll("p",i,function(e){e.classList.contains("MsoNormal")?1===e.childElementCount&&"O:P"===e.children[0].nodeName&&" "===e.textContent&&(e.innerHTML="
"):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",i,function(e){e.removeAttribute("style")}),elBySelAll("br",i,function(e){e.parentNode.insertBefore(document.createTextNode("@@@WOLTLAB-BR-MARKER@@@"),e.nextSibling)}),e=r.call(this,i.innerHTML,t,n),e=e.replace(/@@@WOLTLAB-BR-MARKER@@@/g,""),e=e.replace(/(

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

':""}),i.innerHTML=e.replace(/&quot;/g,"""),elBySelAll("woltlab-br-marker",i,function(e){var t=e.parentNode;if("P"===t.nodeName){var n=elCreate("p");for(n.innerHTML="
";e.nextSibling;)n.appendChild(e.nextSibling);var r=e.previousSibling;r&&"BR"===r.nodeName&&elRemove(r),t.parentNode.insertBefore(n,t.nextSibling)}else t.insertBefore(elCreate("br"),e);elRemove(e)}),elBySelAll("p",i,function(e){var t=!1;0===e.childNodes.length?t=!0:""===e.textContent&&(t=!0,elBySelAll("*",e,function(e){"SPAN"!==e.nodeName&&(t=!1)})),t&&elRemove(e)}),i.innerHTML}.bind(this);var l=[],i=function(e,t){for(var n,r,i={},a=0,o=t.length;a');var n=elCreate("div");n.innerHTML=e,elBySelAll("woltlab-custom-tag",n,function(e){var t=~~elData(e,"index");if(l[t]){var n=l[t],r=elCreate(n.element.nodeName);for(var i in n.attributes)n.attributes.hasOwnProperty(i)&&elAttr(r,i,n.attributes[i]);for(e.parentNode.insertBefore(r,e);e.childNodes.length;)r.appendChild(e.childNodes[0])}elRemove(e)}),e=n.innerHTML}return o.call(this,e,t)}.bind(this),this.clean.removeSpans=function(e){return e};var s=this.clean.getCurrentType;this.clean.getCurrentType=function(e,t){var n=s.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); // 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 t=this.code.start;this.code.start=function(i){t.call(this,i),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","codeStart_"+this.$element[0].id)}.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 e=this.code.get;this.code.get=function(){return this.code.html=!1,this.code.startSync(this.core.editor().html()),e.call(this)}.bind(this)}}}; })(this); +(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 t=this.code.start;this.code.start=function(e){t.call(this,e),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","codeStart_"+this.$element[0].id),elBySelAll("kbd",this.$editor[0],function(t){var e=t.nextSibling;if(!e||e.nodeType!==Node.TEXT_NODE||"​"!==e.textContent.substr(0,1)){var i=document.createTextNode("​");t.parentNode.insertBefore(i,e)}})}.bind(this);var e=this.code.set;this.code.set=function(t,i){e.call(this,t,i),this.utils.isEmpty()&&this.observe.toolbar()}.bind(this);var i=this.code.get;this.code.get=function(){return this.code.html=!1,this.code.startSync(this.core.editor().html()),i.call(this)}.bind(this)}}}; })(this); // plugins/WoltLabColor.js (function (window, undefined) { $.Redactor.prototype.WoltLabColor=function(){"use strict";var o=["000000","800000","8B4513","2F4F4F","008080","000080","4B0082","696969","B22222","A52A2A","DAA520","006400","40E0D0","0000CD","800080","808080","FF0000","FF8C00","FFD700","008000","00FFFF","0000FF","EE82EE","A9A9A9","FFA07A","FFA500","FFFF00","00FF00","AFEEEE","ADD8E6","DDA0DD","D3D3D3","FFF0F5","FAEBD7","FFFFE0","F0FFF0","F0FFFF","F0F8FF","E6E6FA","FFFFFF"];return{init:function(){for(var t,e=this.WoltLabColor.setColor.bind(this),r={},F=0,i=o.length;F').insertBefore(l.children("li").last())},setColor:function(o){o=o.replace(/^color_/,""),this.selection.save(),require(["WoltLabSuite/Core/Ui/Redactor/Format"],function(t){this.buffer.set(),t.format(this.$editor[0],"color","#"+o),this.buffer.set()}.bind(this)),this.selection.restore()},removeColor:function(){this.selection.save(),require(["WoltLabSuite/Core/Ui/Redactor/Format"],function(o){this.buffer.set(),o.removeFormat(this.$editor[0],"color"),this.buffer.set()}.bind(this)),this.selection.restore()}}}; })(this); @@ -57,13 +57,13 @@ i.append(t(this).attr("name"),t(this).val())}),i},appendForms:function(e,i){if(! (function (window, undefined) { $.Redactor.prototype.WoltLabIndent=function(){"use strict";return{init:function(){this.indent.normalize=function(){this.core.editor().find("li").each($.proxy(function(t,n){var e=$(n),i="";0!==this.opts.keepStyleAttr.length&&(i=","+this.opts.keepStyleAttr.join(",")),e.find(this.opts.inlineTags.join(",")).not("img"+i).not("span").removeAttr("style");var o=e.parent();if(0!==o.length&&"LI"===o[0].tagName)return void o.after(e);var r=e.next();0===r.length||"UL"!==r[0].tagName&&"OL"!==r[0].tagName||e.append(r)},this))}.bind(this)}}}; })(this); // plugins/WoltLabInlineCode.js -(function (window, undefined) { $.Redactor.prototype.WoltLabInlineCode=function(){"use strict";var e;return{init:function(){this.opts.activeButtonsStates.kbd="tt",require(["Environment","EventHandler"],function(t,n){e=t,n.add("com.woltlab.wcf.redactor2","bbcode_tt_"+this.$element[0].id,this.WoltLabInlineCode._toggle.bind(this))}.bind(this))},_toggle:function(t){t.cancel=!0,this.button.toggle({},"kbd","func","inline.format");var n=window.getSelection(),o=n.anchorNode;if(o.nodeType===Node.TEXT_NODE&&(o=o.parentNode),"KBD"===o.nodeName){var i=o.nextSibling;if("ios"===e.platform()&&"safari"===e.browser()){if(i&&"BR"===i.nodeName&&o.parentNode.insertBefore(document.createTextNode("​"),i),"​"===o.innerHTML){var r=n.getRangeAt(0);r.collapsed&&1===r.startOffset&&(o.innerHTML=this.marker.html()+"​",this.selection.restore())}return}for(;i;){if(i.nodeType!==Node.TEXT_NODE||i.textContent.length)return;i=i.nextSibling}i?i.textContent="​":o.parentNode.appendChild(document.createTextNode("​"))}}}}; })(this); +(function (window, undefined) { $.Redactor.prototype.WoltLabInlineCode=function(){"use strict";var e;return{init:function(){this.opts.activeButtonsStates.kbd="tt",require(["Environment","EventHandler"],function(t,n){e=t,n.add("com.woltlab.wcf.redactor2","bbcode_tt_"+this.$element[0].id,this.WoltLabInlineCode._toggle.bind(this))}.bind(this))},_toggle:function(t){t.cancel=!0,this.button.toggle({},"kbd","func","inline.format");var n=window.getSelection(),o=n.anchorNode;if(o.nodeType===Node.TEXT_NODE&&(o=o.parentNode),"KBD"===o.nodeName){var i=o.nextSibling;if("ios"===e.platform()&&"safari"===e.browser())return void(i&&"BR"===i.nodeName&&o.parentNode.insertBefore(document.createTextNode("​"),i));for(;i;){if(i.nodeType!==Node.TEXT_NODE||i.textContent.length)return;i=i.nextSibling}i?i.textContent="​":o.parentNode.appendChild(document.createTextNode("​"))}}}}; })(this); // plugins/WoltLabInsert.js (function (window, undefined) { $.Redactor.prototype.WoltLabInsert=function(){"use strict";return{init:function(){var e=this.opts.woltlab.placeholderCallback,t=this.insert.html;this.insert.html=function(o,r){e&&(e=e());var n=window.getSelection();if(n.rangeCount&&"IMG"===n.anchorNode.nodeName&&this.caret.after(n.anchorNode),this.placeholder.hide(),this.core.editor().focus(),this.detect.isFirefox()){var i=n.anchorNode.nodeType===Node.TEXT_NODE?n.anchorNode.parentNode:n.anchorNode;null===i.closest(".redactor-layer")&&(this.selection.restore(),i=n.anchorNode.nodeType===Node.TEXT_NODE?n.anchorNode.parentNode:n.anchorNode,null===i.closest(".redactor-layer")&&(this.WoltLabCaret.endOfEditor(),this.selection.save()))}var a=this.selection.block(),l=""===this.$editor[0].innerHTML.replace(/<\/?p>/g,"").replace(/
/g,"").replace(/\u200B/g,"").trim();if(t.call(this,o,r),l&&(a=this.$editor[0].firstElementChild),a&&"P"===a.nodeName&&a.nextElementSibling){var c=!1;0===a.childElementCount&&""===a.textContent.replace(/\u200B/g,"").trim()?c=!0:1===a.childElementCount&&"
"===a.innerHTML&&(c=!0),c&&elRemove(a)}n.rangeCount&&"IMG"===n.anchorNode.nodeName&&this.caret.after(n.anchorNode)}.bind(this);var o=this.insert.text;this.insert.text=function(t){e&&(e=e()),o.call(this,t)}.bind(this)}}}; })(this); // plugins/WoltLabKeydown.js -(function (window, undefined) { $.Redactor.prototype.WoltLabKeydown=function(){"use strict";var e=[];return{init:function(){var e=this.keydown.init;this.keydown.init=function(t){if(!(!1===e.call(this,t)||t.originalEvent.defaultPrevented||(t=t.originalEvent,39!==t.which||t.ctrlKey||t.shiftKey||t.metaKey||t.altKey))){var i=window.getSelection();if(!i.isCollapsed)return;var n=i.anchorNode;if(n.nodeType!==Node.TEXT_NODE||i.getRangeAt(0).startOffset!==n.textContent.length)return;var o=n.parentNode;if("KBD"!==o.nodeName)return;for(var r=!0,s=o;s&&s!==this.core.editor()[0];){if(null!==s.nextSibling){for(;s.nextSibling&&s.nextSibling.nodeType===Node.TEXT_NODE&&0===s.nextSibling.textContent.length;)s.parentNode.removeChild(s.nextSibling);if(s.nextSibling&&"BR"!==s.nextSibling.nodeName||null!==s.nextSibling.nextSibling){r=!1;break}}s=s.parentNode}r&&o.parentNode.insertBefore(document.createTextNode("​"),o.nextSibling)}}.bind(this);var t=window.navigator.userAgent.toLowerCase();-1!==t.indexOf("linux")&&-1!==t.indexOf("android")&&-1!==t.indexOf("chrome")&&(this.keydown.checkEvents=function(){this.core.addEvent(!1)}.bind(this)),this.core.editor().off("keydown.redactor"),this.core.editor().on("keydown.redactor",this.keydown.init.bind(this)),this.keydown.onArrowDown=function(){for(var e=this.WoltLabKeydown._getBlocks(),t=0;t/gi,"");if(t.tagName===e&&this.utils.isEmpty(i)&&!$(t).hasClass("redactor-in")){var n=document.createElement("p");$(t).replaceWith(n);var o=document.createRange();o.setStart(n,0);var r=document.createTextNode("​");o.insertNode(r),o.setStartAfter(r),o.collapse(!0);var s=window.getSelection();return s.removeAllRanges(),s.addRange(o),!1}"P"===t.tagName&&$(t).removeAttr("style")}.bind(this),this.keydown.onShiftEnter=function(e){return this.buffer.set(),this.keydown.pre?this.keydown.insertNewLine(e):this.insert.raw("
​")}.bind(this);var n=this.keydown.onTab;this.keydown.onTab=function(e,t){return!this.keydown.pre&&0===$(this.selection.current()).closest("ul, ol",this.core.editor()[0]).length||n.call(this,e,t)}.bind(this);var o=this.keydown.formatEmpty;this.keydown.formatEmpty=function(e){for(var t,i=this.$editor[0],n=0,r=i.childElementCount;n0&&(n=n.childNodes[e.anchorOffset]),n.nodeType===Node.TEXT_NODE&&"​"===n.textContent)){for(var o=[],r=n;r=r.previousSibling;){if(r.nodeType===Node.ELEMENT_NODE){"IMG"!==r.nodeName&&(o=[]);break}if(r.nodeType===Node.TEXT_NODE){var s=r.textContent;if(""!==s&&"​"!==s){o=[];break}o.push(r)}}o.length&&o.forEach(elRemove)}if(!(!1===t.call(this,i)||i.originalEvent.defaultPrevented||(i=i.originalEvent,39!==i.which||i.ctrlKey||i.shiftKey||i.metaKey||i.altKey))){if(!e.isCollapsed)return;var l=e.anchorNode;if(l.nodeType!==Node.TEXT_NODE||e.getRangeAt(0).startOffset!==l.textContent.length)return;var a=l.parentNode;if("KBD"!==a.nodeName)return;var d=!0;for(n=a;n&&n!==this.core.editor()[0];){if(null!==n.nextSibling){for(;n.nextSibling&&n.nextSibling.nodeType===Node.TEXT_NODE&&0===n.nextSibling.textContent.length;)n.parentNode.removeChild(n.nextSibling);if(n.nextSibling&&"BR"!==n.nextSibling.nodeName||null!==n.nextSibling.nextSibling){d=!1;break}}n=n.parentNode}d&&a.parentNode.insertBefore(document.createTextNode("​"),a.nextSibling)}}.bind(this);var i=window.navigator.userAgent.toLowerCase();-1!==i.indexOf("linux")&&-1!==i.indexOf("android")&&-1!==i.indexOf("chrome")&&(this.keydown.checkEvents=function(){this.core.addEvent(!1)}.bind(this)),this.core.editor().off("keydown.redactor"),this.core.editor().on("keydown.redactor",this.keydown.init.bind(this)),this.keydown.onArrowDown=function(){for(var e=this.WoltLabKeydown._getBlocks(),t=0;t/gi,"");if(t.tagName===e&&this.utils.isEmpty(i)&&!$(t).hasClass("redactor-in")){var n=document.createElement("p");$(t).replaceWith(n);var o=document.createRange();o.setStart(n,0);var r=document.createTextNode("​");o.insertNode(r),o.setStartAfter(r),o.collapse(!0);var s=window.getSelection();return s.removeAllRanges(),s.addRange(o),!1}"P"===t.tagName&&$(t).removeAttr("style")}.bind(this),this.keydown.onShiftEnter=function(e){return this.buffer.set(),this.keydown.pre?this.keydown.insertNewLine(e):this.insert.raw("
​")}.bind(this);var o=this.keydown.onTab;this.keydown.onTab=function(e,t){return!this.keydown.pre&&0===$(this.selection.current()).closest("ul, ol",this.core.editor()[0]).length||o.call(this,e,t)}.bind(this);var r=this.keydown.formatEmpty;this.keydown.formatEmpty=function(e){for(var t,i=this.$editor[0],n=0,o=i.childElementCount;n"),r+="

"+t+"

"})}}a.call(this,n)}.bind(this);var n=this.paste.getPasteBoxCode;this.paste.getPasteBoxCode=function(a){var s=n.call(this,a);return e?t:!a||s&&!i?null!==r?r:s:t}.bind(this),this.core.editor().off("paste.redactor").on("paste.redactor",this.paste.init.bind(this)),this.paste.detectClipboardUpload=function(t){t=t.originalEvent||t;var e;if(i){if(!window.clipboardData.files.length)return!1;e=window.clipboardData.files.item(0)}else{if(this.detect.isFirefox())return!1;var r=t.clipboardData,a=r.types;if(Array.isArray(a)&&-1!==a.indexOf("public.tiff"))return t.preventDefault(),!1;if(!r.items||!r.items.length)return;var n=!1;if(null===(e=r.items[0].getAsFile())&&(this.detect.isWebkit()&&r.items.length>1&&(e=r.items[1].getAsFile(),n=!0,null!==e&&t.preventDefault()),null===e))return!1}var s=new FileReader;return s.readAsDataURL(e),s.onload=this.paste.insertFromClipboard.bind(this),!1===n}.bind(this),this.paste.insertFromClipboard=function(t){window.FormData&&(this.buffer.set(),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this.$element[0].id,{blob:this.utils.dataURItoBlob(t.target.result)}),this.rtePaste=!1)}.bind(this);var s="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",l=this.paste.insert;this.paste.insert=function(t,r){if(e&&(r.pre=!0),this.utils.isCurrentOrParent("kbd")){l.call(this,t,r);var a=this.selection.current();a.nodeType===Node.TEXT_NODE&&(a=a.parentNode);for(var n=a.closest("kbd"),o=elByTag("p",n);o.length;)o[0].outerHTML=o[0].innerHTML;var d=n.innerHTML.split(//);if(d.length>1){for(var c=this.selection.block(),h=1,p=d.length;h"+d[h]+(h===p-1?this.marker.html():"")+"",c.parentNode.insertBefore(u,c.nextSibling),c=u}n.innerHTML=d[0],this.selection.restore()}}else{if(r.pre)return l.call(this,t,r);var f=elCreate("div");f.innerHTML=t;var b=[];r.pre||r.text||elBySelAll("img",f,function(t){var e=t.src;if(0===e.indexOf("data:image")&&e!==s){t.src=s;var i=WCF.getUUID();elData(t,"uuid",i),b.push({src:e,uuid:i}),elHide(t)}}.bind(this)),l.call(this,f.innerHTML,r),b.length&&window.setTimeout(function(){for(var t,e,r=0,a=b.length;r"),r+="

"+t+"

"})}}a.call(this,n)}.bind(this);var n=this.paste.getPasteBoxCode;this.paste.getPasteBoxCode=function(a){var s=n.call(this,a);return e?t:!a||s&&!i?null!==r?r:s:t}.bind(this),this.core.editor().off("paste.redactor").on("paste.redactor",this.paste.init.bind(this)),this.paste.detectClipboardUpload=function(t){t=t.originalEvent||t;var e;if(i){if(!window.clipboardData.files.length)return!1;e=window.clipboardData.files.item(0)}else{if(this.detect.isFirefox())return!1;var r=t.clipboardData,a=r.types;if(Array.isArray(a)&&-1!==a.indexOf("public.tiff"))return t.preventDefault(),!1;if(!r.items||!r.items.length)return;var n=!1;if(null===(e=r.items[0].getAsFile())&&(this.detect.isWebkit()&&r.items.length>1&&(e=r.items[1].getAsFile(),n=!0,null!==e&&t.preventDefault()),null===e))return!1}var s=new FileReader;return s.readAsDataURL(e),s.onload=this.paste.insertFromClipboard.bind(this),!1===n}.bind(this),this.paste.insertFromClipboard=function(t){window.FormData&&(this.buffer.set(),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this.$element[0].id,{blob:this.utils.dataURItoBlob(t.target.result)}),this.rtePaste=!1)}.bind(this);var s="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",l=this.paste.insert;this.paste.insert=function(t,r){if(e&&(r.pre=!0),this.utils.isCurrentOrParent("kbd")){l.call(this,t,r);var a=this.selection.current();a.nodeType===Node.TEXT_NODE&&(a=a.parentNode);for(var n=a.closest("kbd"),o=elByTag("p",n);o.length;)o[0].outerHTML=o[0].innerHTML;var d=n.innerHTML.split(//);if(d.length>1){for(var c=this.selection.block(),h=1,p=d.length;h"+d[h]+(h===p-1?this.marker.html():"")+"",c.parentNode.insertBefore(u,c.nextSibling),c=u}n.innerHTML=d[0],this.selection.restore()}}else{if(r.pre)return l.call(this,t,r);var f=elCreate("div");f.innerHTML=t;var b=[];r.pre||r.text||elBySelAll("img",f,function(t){var e=t.src;if(0===e.indexOf("data:image")&&e!==s){t.src=s;var i=WCF.getUUID();elData(t,"uuid",i),b.push({src:e,uuid:i}),elHide(t)}}.bind(this)),l.call(this,f.innerHTML,r);var A=window.getSelection();A.rangeCount&&"A"===A.anchorNode.nodeName&&A.anchorOffset===A.anchorNode.childNodes.length&&this.caret.after(A.anchorNode),b.length&&window.setTimeout(function(){for(var t,e,r=0,a=b.length;r0&&n.push(t);n.forEach(elRemove);var r=elBySel("td",e);r&&this.caret.end(r)}}.bind(this),10)}.bind(this))}}}; })(this); +(function (window, undefined) { $.Redactor.prototype.WoltLabTable=function(){"use strict";return{init:function(){this.WoltLabEvent.register("insertedTable",function(){window.setTimeout(function(){var e=this.selection.block()||this.selection.current();if(e===this.$editor[0]){var t=window.getSelection();t.isCollapsed&&t.anchorNode===this.$editor[0]&&t.anchorOffset>0&&(e=t.anchorNode.childNodes[t.anchorOffset-1])}if("TBODY"===e.nodeName&&(e=e.parentNode),"TABLE"===e.nodeName){for(var o,i=[],n=0,d=e.childNodes.length;n0&&i.push(o);i.forEach(elRemove);var r=elBySel("td",e);r&&this.caret.end(r)}}.bind(this),10)}.bind(this))}}}; })(this); // plugins/WoltLabUtils.js (function (window, undefined) { $.Redactor.prototype.WoltLabUtils=function(){"use strict";return{init:function(){var t=this.utils.replaceToTag;this.utils.replaceToTag=function(i,r){return"figure"===r?i:t.call(this,i,r)}.bind(this)}}}; })(this); diff --git a/wcfsetup/install/files/js/WCF.Combined.min.js b/wcfsetup/install/files/js/WCF.Combined.min.js index 24fb81215d..fb77ce6140 100755 --- a/wcfsetup/install/files/js/WCF.Combined.min.js +++ b/wcfsetup/install/files/js/WCF.Combined.min.js @@ -35,7 +35,7 @@ if(s?o.sortable(this._options):o.nestedSortable(this._options),this._className){ (function (window, undefined) { "use strict";WCF.Attachment={},WCF.Attachment.Upload=WCF.Upload.extend({_autoInsert:[],_insertAllButton:null,_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_editorId:"",_replaceOnLoad:{},init:function(t,e,a,i,s,n,r,l){if(this._super(t,e,"wcf\\data\\attachment\\AttachmentAction",{multiple:!0,maxUploads:r}),this._autoInsert=[],this._objectType=a,this._objectID=parseInt(i),this._tmpHash=s,this._parentObjectID=parseInt(n),this._editorId=l,this._buttonSelector.children("p.button").click($.proxy(this._validateLimit,this)),this._fileListSelector.find(".jsButtonInsertAttachment").click($.proxy(this._insert,this)),this._fileListSelector.find(".jsButtonAttachmentInsertThumbnail").click($.proxy(this._insert,this)),this._fileListSelector.find(".jsButtonAttachmentInsertFull").click($.proxy(this._insert,this)),WCF.DOMNodeRemovedHandler.addCallback("WCF.Attachment.Upload",$.proxy(this._removeLimitError,this)),WCF.System.Event.addListener("com.woltlab.wcf.action.delete","attachment_"+this._editorId,$.proxy(this._removeLimitError,this)),this._makeSortable(),this._insertAllButton=$('

'+WCF.Language.get("wcf.attachment.insertAll")+"

").hide().appendTo(this._buttonSelector),this._insertAllButton.click($.proxy(this._insertAll,this)),this._fileListSelector.children("li:not(.uploadFailed)").length&&this._insertAllButton.show(),this._editorId){WCF.System.Event.addListener("com.woltlab.wcf.redactor2","submit_"+this._editorId,this._submitInline.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+this._editorId,this._reset.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId,this._editorUpload.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId,this._editorUpload.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","autosaveMetaData_"+this._editorId,function(t){t.tmpHashes&&Array.isArray(t.tmpHashes)||(t.tmpHashes=[]);var e=t.tmpHashes.indexOf(s);this._fileListSelector.children("li:not(.uploadFailed)").length>0?-1===e&&t.tmpHashes.push(s):-1!==e&&t.tmpHashes.splice(e)}.bind(this));var o=WCF.System.Event.addListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,function(t){var e=this._getImageAttachments(),a=t.attributes[0]||0;if(e.hasOwnProperty(a)){var i=t.attributes[2];i=!0===i||"true"===i;var s=elCreate("img");s.className="woltlabAttachment",s.src=e[a][i?"thumbnailUrl":"url"],elData(s,"attachment-id",a);var n=t.attributes[1]||"none";"left"===n?s.classList.add("messageFloatObjectLeft"):"right"===n&&s.classList.add("messageFloatObjectRight");var r=t.metacode;r.parentNode.insertBefore(s,r),elRemove(r),t.cancel=!0}}.bind(this));WCF.System.Event.addListener("com.woltlab.wcf.redactor2","destroy_"+this._editorId,function(){WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","submit_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","reset_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","autosaveMetaData_"+this._editorId),WCF.System.Event.removeListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,o)}.bind(this))}},_editorUpload:function(t){var e,a=null;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",!0),t.file?e=this._upload(void 0,t.file):(e=this._upload(void 0,void 0,t.blob),a=t.replace||null),null===a?this._autoInsert.push(e):this._replaceOnLoad[e]=a,t.uploadID=e},_getImageAttachments:function(){var t={};return this._fileListSelector.children("li").each(function(e,a){var i=$(a);i.data("isImage")&&(t[~~i.data("objectID")]={thumbnailUrl:i.find(".jsButtonAttachmentInsertThumbnail").data("url"),url:i.find(".jsButtonAttachmentInsertFull").data("url")})}),t},_submitInline:function(t){if(this._tmpHash){t.tmpHash=this._tmpHash;var e={};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","getMetaData_"+this._editorId,e),e.tmpHashes&&Array.isArray(e.tmpHashes)&&e.tmpHashes.length>0&&(t.tmpHash+=","+e.tmpHashes.join(","))}},_reset:function(){this._fileListSelector.hide().empty(),this._insertAllButton.hide(),this._validateLimit()},_validateLimit:function(){var t=this._buttonSelector.next("small.innerError"),e=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length,a=this._fileUpload?this._fileUpload.prop("files").length:0;if(e<=0||e').insertAfter(this._buttonSelector)),t.html(i),!1}return t.remove(),!0},_removeLimitError:function(t){var e=this._fileListSelector.children("li");e.filter(":not(.uploadFailed)").length||this._insertAllButton.hide(),e.length||this._fileListSelector.hide(),this._editorId&&t.button&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","deleteAttachment_"+this._editorId,{attachmentId:t.button.data("objectID")})},_upload:function(t,e,a){var i=void 0;return this._validateLimit()&&(i=this._super(t,e,a)),this._fileUpload&&(this._removeButton(),this._createButton()),i},_createUploadMatrix:function(t){return this._fileListSelector.children("li.uploadFailed").remove(),this._super(t)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(t){var e=$('
  • '+t.name+'

    • ').data("filename",t.name);return this._fileListSelector.append(e),this._fileListSelector.show(),this._buttonSelector.data("maxSize") div").append($(''+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"")),e.addClass("uploadFailed")),e},_useThumbnail:function(){return elDataBool(this._fileListSelector[0],"enable-thumbnails")},_success:function(t,e){var a;for(var i in this._uploadMatrix[t])if(this._uploadMatrix[t].hasOwnProperty(i)){var s=this._uploadMatrix[t][i];s.find("progress").remove();var n=s.data("filename"),r=s.data("internalFileID");if(e.returnValues&&e.returnValues.attachments[r]){a=e.returnValues.attachments[r],a.tinyURL?(s.children(".fa-spinner").replaceWith($('')),s.data("height",a.height),s.data("width",a.width),elData(s[0],"is-image",a.isImage)):s.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-"+a.iconName);var l=$('');l.text(n).attr("href",a.url),0!=a.isImage&&l.addClass("jsImageViewer").attr("title",n),s.find("p").empty().append(l),s.find("small").append(a.formattedFilesize);var o=s.find("ul").addClass("buttonGroup"),d=$('
    • '+WCF.Language.get("wcf.global.button.delete")+"
    • ");if(o.append(d),s.data("objectID",a.attachmentID),this._editorId)if(a.tinyURL||!this._useThumbnail()&&a.isImage){if(a.thumbnailURL){var c=$('
    • '+WCF.Language.get("wcf.attachment.insertThumbnail")+"
    • ").appendTo(o);c.children("span.button").click($.proxy(this._insert,this))}var h=$('
    • '+WCF.Language.get("wcf.attachment.insertFull")+"
    • ").appendTo(o);h.children("span.button").click($.proxy(this._insert,this))}else{var m=$('
    • '+WCF.Language.get("wcf.attachment.insert")+"
    • ");m.appendTo(o).children("span.button").click($.proxy(this._insert,this))}if(this._replaceOnLoad.hasOwnProperty(t)){if(!s.hasClass("uploadFailed")){var u=this._replaceOnLoad[t];u&&u.parentNode&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","replaceAttachment_"+this._editorId,{attachmentId:a.attachmentID,img:u,src:a.thumbnailURL?a.thumbnailURL:a.url})}this._replaceOnLoad[t]=null}}else{s.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban");var p="";if(e.returnValues&&e.returnValues.errors[r]){var _=e.returnValues.errors[r];p=_.errorType,"uploadFailed"===p&&_.additionalData.phpLimitExceeded&&(p="uploadPhpLimit")}else p="uploadFailed";s.find("div > div").append($(''+WCF.Language.get("wcf.attachment.upload.error."+p)+"")),s.addClass("uploadFailed")}if(WCF.inArray(t,this._autoInsert)&&(this._autoInsert.splice(this._autoInsert.indexOf(t),1),!s.hasClass("uploadFailed"))){var f=s.find(".jsButtonAttachmentInsertThumbnail");f.length||(f=s.find(".jsButtonAttachmentInsertFull")),f.trigger("click")}}this._makeSortable(),this._fileListSelector.children("li:not(.uploadFailed)").length?this._insertAllButton.show():this._insertAllButton.hide(),WCF.DOMNodeInsertedHandler.execute()},_insert:function(t){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId,{attachmentId:elData(t.currentTarget,"object-id"),url:elData(t.currentTarget,"url")})},_insertAll:function(){var t=this._useThumbnail()?".jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain":".jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain";this._fileListSelector.children("li:not(.uploadFailed)").find(t).trigger("click")},_error:function(t){this._fileListSelector.find("li").each(function(e,a){var i=$(a);i.children(".fa-spinner").length&&(i.addClass("uploadFailed").children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),i.find("div > div").append($(''+(t.responseJSON&&t.responseJSON.message?t.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+"")))})},_makeSortable:function(){var t=this._fileListSelector.children("li:not(.uploadFailed)");t.length&&(t.addClass("sortableAttachment").children("img").addClass("sortableNode"),this._fileListSelector.hasClass("sortableList")||(this._fileListSelector.addClass("sortableList"),require(["Environment"],function(t){"desktop"===t.platform()&&new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:!1,items:"li.sortableAttachment",toleranceElement:null,start:function(t,e){e.placeholder[0].style.setProperty("height",e.helper[0].offsetHeight+"px","")},update:function(){var t=[];this._fileListSelector.children("li:not(.uploadFailed)").each(function(e,a){t.push($(a).data("objectID"))}),t.length&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:t,objectID:this._objectID,objectType:this._objectType,tmpHash:this._tmpHash}}})}.bind(this)},!0)}.bind(this))))}}); })(this); // WCF.ColorPicker.js -(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 i=$(t);if(!i.length)return void console.debug("[WCF.ColorPicker] Selector does not match any element, aborting.");i.click($.proxy(this._open,this))},setCallbackSubmit:function(t){this._callbackSubmit=t},_open:function(t){this._didInit||(this._initColorPicker(),this._didInit=!0);var i=$(t.currentTarget);this._elementID=i.wcfIdentify(),this._parseColor(i);var a=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);this._oldColor.css({backgroundColor:"rgba("+a.r+", "+a.g+", "+a.b+", "+this._rgba.a.val()/100+")"}),this._dialog.wcfDialog({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 i=t.data("hsv");for(var a in i)this._hsv[a]=i[a];this._updateValues(t.data("rgb"),!0,!0),this._rgba.a.val(parseInt(t.data("alpha")))}else{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 t=this;$(document).mouseup(function(i){t._barActive?(t._barActive=!1,t._mouseBar(i)):t._gradientActive&&(t._gradientActive=!1,t._mouseGradient(i))}).mousemove(function(i){t._barActive?t._mouseBar(i):t._gradientActive&&t._mouseGradient(i)}),this._initColorPickerForm()},_initColorPickerForm:function(){var t=$('
      ').appendTo(this._dialog);$(""+WCF.Language.get("wcf.style.colorPicker.new")+"").appendTo(t);var i=$('