From 6e8c1531cb711fbaedd0dbeb600c185d4b04e966 Mon Sep 17 00:00:00 2001 From: "woltlab.com" Date: Sun, 12 Nov 2017 12:23:09 +0100 Subject: [PATCH] Updating minified JavaScript files --- .../files/js/3rdParty/redactor2/redactor.combined.min.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 baa59fd7c4..7c9e96892d 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.combined.min.js @@ -24,7 +24,7 @@ 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"P"===e.nodeName&&1===e.childNodes.length&&"BR"===e.childNodes[0].nodeName?this.caret.before(e.childNodes[0]):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.$editor[0].addEventListener("mouseup",this.WoltLabCaret._handleEditorMouseUp.bind(this)),this.WoltLabCaret._initInternalRange();var r=this.selection.saveInstant;this.selection.saveInstant=function(){r.call(this),this.saved.isAtNodeStart=!1;var e=window.getSelection();if(e.rangeCount&&!e.isCollapsed){var t=e.getRangeAt(0);t.startContainer.nodeType===Node.TEXT_NODE&&0===t.startOffset&&(this.saved.isAtNodeStart=!0)}}.bind(this);var o=this.selection.restoreInstant;this.selection.restoreInstant=function(e){if(void 0!==e||this.saved){var t=void 0!==e?e:this.saved;if(o.call(this,e),!0===t.isAtNodeStart){var n=window.getSelection();if(n.rangeCount&&!n.isCollapsed){var i=n.getRangeAt(0),r=i.startContainer;if(t.node===r)return;for(;null!==r&&"P"!==r.nodeName;)r=r.parentNode;if(null!==r&&null!==(r=r.nextElementSibling)&&"P"===r.nodeName&&0===r.textContent.replace(/\u200B/g,"").length){r=r.nextElementSibling;for(var a=t.node;null!==a&&a!==r;)a=a.parentNode;a===r&&(i=i.cloneRange(),i.setStart(t.node,0),n.removeAllRanges(),n.addRange(i))}}}}}.bind(this)},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 d=this.insert.html;this.insert.html=function(e,t){var n=elBySel(".redactor-selection-marker",this.$editor[0]);d.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}if(void 0!==r){var s=t[(r?"previous":"next")+"ElementSibling"];if(s&&"P"===s.nodeName)return void this.caret.end(s);this.buffer.set();var d=elCreate("p");d.textContent="​",t.parentNode.insertBefore(d,r?t:t.nextSibling),this.caret.end(d)}}}}},_handleEditorMouseUp:function(e){var t,n,i=window.getSelection();if(i.isCollapsed)if(e.target===this.$editor[0])t=i.anchorNode,t.nodeType===Node.TEXT_NODE&&(t=t.parentNode),"KBD"===t.nodeName&&(n=t.previousSibling,null!==n&&"​"===n.textContent||(n=document.createTextNode("​"),t.parentNode.insertBefore(n,t)),this.caret.before(n));else if("KBD"===e.target.nodeName){var r=e.target;if(t=i.anchorNode,t.nodeType===Node.TEXT_NODE){for(n=t;(n=n.nextSibling)&&n.nodeType===Node.TEXT_NODE&&(""===n.textContent||"​"===n.textContent););if(n===r){if(0===r.childNodes.length||"​"!==r.childNodes[0].textContent){var o=document.createTextNode("​");r.insertBefore(o,r.firstChild)}var a=document.createRange();a.setStartAfter(r.childNodes[0]),a.setEndAfter(r.childNodes[0]),i.removeAllRanges(),i.addRange(a)}}}},_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 f,p,u,m,g=null!==elBySel(".MsoNormal",i),v=elBySelAll("[style]",i);for(o=0,s=v.length;o500&&(u=elCreate("strong"),a.parentNode.insertBefore(u,a),u.appendChild(a));else if(g&&"margin-bottom"===f&&"P"===a.nodeName&&(m=a.style.getPropertyValue(f),m.match(/^12(?:\.0)?pt$/))){var C=elCreate("p");C.innerHTML="
",a.parentNode.insertBefore(C,a.nextSibling)}p.push(f)}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(/\n*@@@WOLTLAB-BR-MARKER@@@\n*/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(null!==t){if("P"===t.nodeName){var n=elCreate("p");n.innerHTML="
";var r=!1,l=e.nextSibling;l&&"WOLTLAB-BR-MARKER"===l.nodeName&&(r=!0);for(var i=!r;e.nextSibling;)i&&0!==e.nextSibling.textContent.replace(/\u200B/g,"").trim().length&&(i=!1),n.appendChild(e.nextSibling);i||elRemove(n.firstElementChild);var a=e.previousSibling;a&&"BR"===a.nodeName&&elRemove(a),t.parentNode.insertBefore(n,t.nextSibling),r&&(n=elCreate("p"),n.innerHTML="
",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)})):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)}),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(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); @@ -63,7 +63,10 @@ i.append(t(this).attr("name"),t(this).val())}),i},appendForms:function(e,i){if(! (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=window.getSelection(),t=this.keydown.init;this.keydown.init=function(i){var n;if(this.detect.isFirefox()&&e.isCollapsed&&i.which===this.keyCode.BACKSPACE&&(n=e.anchorNode,n.nodeType===Node.ELEMENT_NODE&&e.anchorOffset>0&&(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((i.which===this.keyCode.BACKSPACE||i.which===this.keyCode.DELETE)&&e.isCollapsed){var l=e.getRangeAt(0),a=l.startContainer;if(a.nodeType===Node.TEXT_NODE&&(a=a.parentNode),"P"===a.nodeName&&1===a.childNodes.length&&"​"===a.childNodes[0].textContent&&a.previousElementSibling!==a.nextElementSibling){var d=null,h=null;return i.which===this.keyCode.BACKSPACE?null===a.previousElementSibling?h=a.nextElementSibling:d=a.previousElementSibling:null===a.nextElementSibling?d=a.previousElementSibling:h=a.nextElementSibling,elRemove(a),null===h?this.caret.end(d):this.caret.start(h),void i.preventDefault()}}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 c=e.anchorNode;if(c.nodeType!==Node.TEXT_NODE||e.getRangeAt(0).startOffset!==c.textContent.length)return;var f=c.parentNode;if("KBD"!==f.nodeName)return;var u=!0;for(n=f;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){u=!1;break}}n=n.parentNode}u&&f.parentNode.insertBefore(document.createTextNode("​"),f.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,t,i=this.WoltLabKeydown._getBlocks(),n=0;n/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;n0&&(n=n.childNodes[e.anchorOffset-1]),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((i.originalEvent.which===this.keyCode.BACKSPACE||i.originalEvent.which===this.keyCode.DELETE)&&e.isCollapsed){var l=this.selection.block();if("P"===l.nodeName){if(this.list.combineAfterAndBefore(l))return void i.originalEvent.preventDefault();if(this.utils.isEmpty(l.innerHTML)&&l.previousElementSibling!==l.nextElementSibling){var a=null,d=null;return i.originalEvent.which===this.keyCode.BACKSPACE?null===l.previousElementSibling?d=l.nextElementSibling:a=l.previousElementSibling:null===l.nextElementSibling?a=l.previousElementSibling:d=l.nextElementSibling,elRemove(l),null===d?("OL"!==a.nodeName&&"UL"!==a.nodeName||(a=a.lastElementChild),this.caret.end(a)):("OL"!==d.nodeName&&"UL"!==d.nodeName||(d=d.firstElementChild),this.caret.start(d)),void i.originalEvent.preventDefault()}}}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 h=e.anchorNode;if(h.nodeType!==Node.TEXT_NODE||e.getRangeAt(0).startOffset!==h.textContent.length)return;var c=h.parentNode;if("KBD"!==c.nodeName)return;var f=!0;for(n=c;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){f=!1;break}}n=n.parentNode}f&&c.parentNode.insertBefore(document.createTextNode("​"),c.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,t,i=this.WoltLabKeydown._getBlocks(),n=0;n/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;n0)){for(var n=e;n.nodeType===Node.ELEMENT_NODE&&0!==n.childNodes.length;){if(n.children.length>1)return;n=1===n.children.length?n.children[0]:n.childNodes[0]}if(n.nodeType===Node.TEXT_NODE){var r=elCreate("br");n.parentNode.appendChild(r),t&&elRemove(n)}}}}}; })(this); // plugins/WoltLabLine.js (function (window, undefined) { $.Redactor.prototype.WoltLabLine=function(){"use strict";return{init:function(){this.line.removeOnBackspace=function(){if(this.utils.isCollapsed()){var t=$(this.selection.block());if(0!==t.length&&this.utils.isStartOfElement(t)){var i=t.prev();i.length&&"HR"===i[0].tagName&&(e.preventDefault(),i.remove())}}}.bind(this)}}}; })(this); @@ -72,7 +75,7 @@ i.append(t(this).attr("name"),t(this).val())}),i},appendForms:function(e,i){if(! (function (window, undefined) { $.Redactor.prototype.WoltLabLink=function(){"use strict";var t=null;return{init:function(){this.link.isUrl=function(t){var i="((xn--)?[\\W\\w\\D\\d]+(-(?!-[\\W\\w\\D\\d])+)*\\.)+[\\W\\w]{2,}",e=new RegExp("^(http|ftp|https|ts3server)://"+i,"i"),s=new RegExp("^"+i,"i"),n=new RegExp(".(html|php)$","i"),r=new RegExp("^/","i"),l=new RegExp("^tel:(.*?)","i");return-1===t.search(e)&&-1!==t.search(s)&&-1===t.search(n)&&"/"!==t.substring(0,1)&&(t="http://"+t),(-1!==t.search(e)||-1!==t.search(n)||-1!==t.search(r)||-1!==t.search(l))&&t}.bind(this),this.link.show=this.WoltLabLink.show.bind(this),require(["WoltLabSuite/Core/Ui/Redactor/Link"],function(i){t=i})},show:function(i){void 0!==i&&i.preventDefault&&i.preventDefault();var e=this.selection.is();this.selection.save(),this.observe.closeAllTooltip();var s=this.link.is();t.showDialog({insert:!1===s,submitCallback:function(){var t=this.link.buildLinkFromModal();return!1!==t&&(this.selection.restore(),this.link.insert(t,!0),!0)}.bind(this)}),e&&this.selection.restore();var n=this.link.buildLinkFromElement(s);e&&this.selection.save(),n.url=this.link.removeSelfHostFromUrl(n.url),this.link.setModalValues(n),this.detect.isDesktop()&&$("#redactor-link-url").focus()}}}; })(this); // plugins/WoltLabList.js -(function (window, undefined) { $.Redactor.prototype.WoltLabList=function(){"use strict";return{init:function(){this.list.toggle=function(t){if(!this.utils.inBlocks(["table","td","th","tr"])){var e="orderedlist"===t||"ol"===t?"OL":"UL";t="OL"===e?"orderedlist":"unorderedlist";var i=$(this.selection.current()).parentsUntil(".redactor-in","ul, ol").first();if(this.placeholder.hide(),this.buffer.set(),0!==i.length&&i[0].tagName===e&&this.utils.isRedactorParent(i))return this.selection.save(),i.find("ul, ol").each(function(){var t=$(this).closest("li");$(this).find("li").each(function(){$(t).after(this)})}),i.find("ul, ol").remove(),i.find("li").each(function(){return $(this).replaceWith(function(){return $("

").append($(this).contents())})}),i.replaceWith(function(){return $(this).contents()}),void this.selection.restore();this.selection.save(),0!==i.length&&i[0].tagName!==e?i.each($.proxy(function(t,i){this.utils.replaceToTag(i,e)},this)):document.execCommand("insert"+t),this.selection.restore();var n=this.list.get();if(!n)return void(this.selection.block()||document.execCommand("formatblock",!1,"p"));n.find(this.opts.inlineTags.join(",")).each(function(){"SPAN"!==this.nodeName&&$(this).removeAttr("style")});var s=n.parent();this.utils.isRedactorParent(s)&&"LI"!==s[0].tagName&&this.utils.isBlock(s)&&(this.selection.save(),s.replaceWith(s.contents()),this.selection.restore())}}.bind(this);var t=this.list.combineAfterAndBefore;this.list.combineAfterAndBefore=function(e){var i=t.call(this,e);if(i){var n=e.nextElementSibling;"OL"!==n.nodeName&&"UL"!==n.nodeName||0!==n.childElementCount||elRemove(n)}return i}.bind(this)}}}; })(this); +(function (window, undefined) { $.Redactor.prototype.WoltLabList=function(){"use strict";return{init:function(){this.list.toggle=function(e){if(!this.utils.inBlocks(["table","td","th","tr"])){var t="orderedlist"===e||"ol"===e?"OL":"UL";e="OL"===t?"orderedlist":"unorderedlist";var i=$(this.selection.current()).parentsUntil(".redactor-in","ul, ol").first();if(this.placeholder.hide(),this.buffer.set(),0!==i.length&&i[0].tagName===t&&this.utils.isRedactorParent(i))return this.selection.save(),i.find("ul, ol").each(function(){var e=$(this).closest("li");$(this).find("li").each(function(){$(e).after(this)})}),i.find("ul, ol").remove(),i.find("li").each(function(){return $(this).replaceWith(function(){return $("

").append($(this).contents())})}),i.replaceWith(function(){return $(this).contents()}),void this.selection.restore();this.selection.save(),0!==i.length&&i[0].tagName!==t?i.each($.proxy(function(e,i){this.utils.replaceToTag(i,t)},this)):document.execCommand("insert"+e),this.selection.restore();var n=this.list.get();if(!n)return void(this.selection.block()||document.execCommand("formatblock",!1,"p"));n.find(this.opts.inlineTags.join(",")).each(function(){"SPAN"!==this.nodeName&&$(this).removeAttr("style")});var s=n.parent();this.utils.isRedactorParent(s)&&"LI"!==s[0].tagName&&this.utils.isBlock(s)&&(this.selection.save(),s.replaceWith(s.contents()),this.selection.restore())}}.bind(this),this.list.combineAfterAndBefore=function(e){var t=$(e).prev(),i=$(e).next(),n=e&&"P"===e.tagName&&("
"===e.innerHTML||""===e.innerHTML),s=1===t.closest("ol, ul",this.core.editor()[0]).length&&1===i.closest("ol, ul",this.core.editor()[0]).length,r=!1;if(s&&!n&&0===e.textContent.replace(/\u200b/g,"").trim().length){var o=["A","B","BR","EM","I","STRONG","U"],l=!0;elBySelAll("*",e,function(e){-1===o.indexOf(e.nodeName)&&("SPAN"===e.nodeName&&""===e.className.trim()||(l=!1))}),l&&(r=!0,n=!0)}if(n&&s){if("LI"===e.nodeName&&r)return t.append(this.marker.get()),elRemove(e),this.selection.restore(),!0;t.children("li").last().append(this.marker.get()),t.append(i.contents());var a=e.nextElementSibling;return"OL"!==a.nodeName&&"UL"!==a.nodeName||0!==a.childElementCount||elRemove(a),r&&elRemove(e),this.selection.restore(),!0}return!1}.bind(this)}}}; })(this); // plugins/WoltLabMedia.js (function (window, undefined) { $.Redactor.prototype.WoltLabMedia=function(){"use strict";return{init:function(){var t=this.button.add("woltlabMedia","");$(t).addClass("jsMediaEditorButton");var e=WCF.System.Event.addListener("com.woltlab.wcf.redactor2","metacode_wsm_"+this.$element[0].id,function(t){if(1!==t.attributes.length){var e="";3===t.attributes.length&&("left"===t.attributes[2]?e=" messageFloatObjectLeft":"right"===t.attributes[2]&&(e=" messageFloatObjectRight"));var a=elCreate("img");a.className="woltlabSuiteMedia"+e,a.src=this.opts.woltlab.mediaUrl.replace(/&/,"&").replace("-123456789",t.attributes[0]).replace("thumbnail=void",function(){return t.attributes[1]?"thumbnail="+t.attributes[1]:""}),elData(a,"media-id",t.attributes[0]),elData(a,"media-size",t.attributes[1]);var i=t.metacode;i.parentNode.insertBefore(a,i),elRemove(i),t.cancel=!0}}.bind(this));WCF.System.Event.addListener("com.woltlab.wcf.redactor2","destroy_"+this.$element[0].id,function(){WCF.System.Event.removeListener("com.woltlab.wcf.redactor2","metacode_wsm_"+this.$element[0].id,e)}.bind(this)),require(["WoltLabSuite/Core/Media/Manager/Editor"],function(t){new t({editor:this})}.bind(this))}}}; })(this); -- 2.20.1