Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Sat, 18 Jun 2016 17:15:46 +0000 (19:15 +0200)
committerwoltlab.com <woltlab@woltlab.com>
Sat, 18 Jun 2016 17:15:46 +0000 (19:15 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js

index 6935ab3ba559073efe775fd877f7f2b606301acc..6a59d89aa4316d1652bd876732bd21d4174fbc9a 100644 (file)
@@ -12,7 +12,7 @@ if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wfontfamily=function(
 // wfontsize.js
 if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wfontsize=function(){"use strict";return{init:function(){var t=this.button.addDropdown(this.button.get("fontsize"));this.wfontsize._createDropdown(t)},_createDropdown:function(t){for(var n=[8,10,12,14,18,24,36],e=this,i=0;i<n.length;i++){var o=n[i],a=$('<li><a href="#">'+o+"</a></li>").appendTo(t),r=a.children("a").data("fontSize",o).css("font-size",o+"pt");o>18&&r.css("line-height","1em"),r.click(function(t){t.preventDefault(),e.inline.format("span","style","font-size: "+$(this).data("fontSize")+"pt;")})}$('<li class="dropdownDivider" />').appendTo(t);var a=$('<li><a href="#">'+this.opts.curLang.none+"</a></li>").appendTo(t);a.children("a").click(function(t){t.preventDefault(),e.inline.removeStyleRule("font-size")})}}};
 // wmonkeypatch.js
-if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wmonkeypatch=function(){"use strict";return{init:function(){this.wmonkeypatch.alignment(),this.wmonkeypatch.button(),this.wmonkeypatch.caret(),this.wmonkeypatch.clean(),this.wmonkeypatch.code(),this.wmonkeypatch.dropdown(),this.wmonkeypatch.image(),this.wmonkeypatch.indent(),this.wmonkeypatch.inline(),this.wmonkeypatch.insert(),this.wmonkeypatch.keydown(),this.wmonkeypatch.keyup(),this.wmonkeypatch.link(),this.wmonkeypatch.list(),this.wmonkeypatch.modal(),this.wmonkeypatch.paste(),this.wmonkeypatch.observe(),this.wmonkeypatch.selection(),this.wmonkeypatch.utils(),this.wmonkeypatch.rebuildTemplates(),this.wmonkeypatch.bindEvents(),this.wmonkeypatch.fixWebKit()},bindEvents:function(){var e=this.$textarea.wcfIdentify();this.wutil.setOption("keydownCallback",function(t){var i={cancel:!1,event:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keydown_"+e,i),i.cancel?!1:!0}),this.wutil.setOption("keyupCallback",function(t){this.wutil.saveSelection();var i={cancel:!1,event:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keyup_"+e,i),i.cancel?!1:!0}.bind(this)),this.opts.activeButtons&&(this.$editor.off("mouseup.redactor keyup.redactor focus.redactor"),this.$editor.on("mouseup.redactor keyup.redactor focus.redactor",$.proxy(this.observe.buttons,this)),this.$editor.on("keyup.redactor",$.proxy(this.keyup.init,this)));var t=!1;this.$editor.on("mousedown.wmonkeypatch",function(){t=!0}.bind(this)),$(document).on("mouseup.wmonkeypatch",function(){t&&(t=!1,this.wutil.saveSelection())}.bind(this));var i=function(e,t){t?!e.previousElementSibling||"P"!==e.previousElementSibling.tagName&&"DIV"!==e.previousElementSibling.tagName?this.wutil.setCaretBefore(e):this.caret.setEnd(e.previousElementSibling):!e.nextElementSibling||"P"!==e.nextElementSibling.tagName&&"DIV"!==e.nextElementSibling.tagName?this.wutil.setCaretAfter(e):this.caret.setEnd(e.nextElementSibling)}.bind(this),n=null;this.$editor.on("click.wmonkeypatch",function(e){if(e.target===this.$editor[0]){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null;if(t&&t.collapsed){var o=t.startContainer,a=this.$editor.offset();if(null===n&&(n={left:this.$editor.cssAsNumber("padding-left"),top:this.$editor.cssAsNumber("padding-top")}),e.pageY<=a.top+n.top){var s=this.$editor[0].children[0];if("BLOCKQUOTE"!==s.tagName&&("DIV"!==s.tagName||!/\bcodeBox\b/.test(s.className)))return}else{if(e.pageX<=a.left+n.left)return;if(e.pageX>a.left+this.$editor.width())return}for(;o&&o!==this.$editor[0];){if(o.nodeType===Node.ELEMENT_NODE&&("BLOCKQUOTE"===o.tagName||"DIV"===o.tagName&&/\bcodeBox\b/.test(o.className))){var r=$(o).offset();return e.pageY<=r.top?i(o,!0):i(o,!1),!1}o=o.parentElement}}var l=this.$editor.children("blockquote, div.codeBox");return l.each(function(t,n){var o=$(n),a=o.offset();if(e.pageY<=a.top)return i(n,!0),!1;var s=o.outerHeight()+(parseInt(o.css("margin-bottom"),10)||0);return e.pageY<=a.top+s?(i(n,!1),!1):void 0}),!1}if("LI"===e.target.tagName){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null,d=!1;if(null!==t){if(!t.collapsed)return;for(var o=t.startContainer;null!==o&&o!==this.$editor[0];){if("LI"===o.tagName){d=!0;break}o=o.parentElement}}if(!d||null===t){var c=document.createTextNode("​"),s=e.target.children[0];s.appendChild(c),this.caret.setEnd(s)}}else if("BLOCKQUOTE"===e.target.tagName){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null;if(null!==t&&t.collapsed){for(var h=null,o=t.startContainer.nodeType===Node.TEXT_NODE?t.startContainer.parentElement:t.startContainer;null!==o&&o!==this.$editor[0];){if("BLOCKQUOTE"===o.tagName){h=o;break}o=o.parentElement}null!==h&&h!==e.target&&(e.pageY<=$(h).offset().top?i(h,!0):i(h,!1))}}}.bind(this))},alignment:function(){var e=this.alignment.setBlocks;this.alignment.setBlocks=function(t){e.call(this,t),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","fixFormatting_"+this.$textarea.wcfIdentify())}.bind(this)},button:function(){var e=this.button.addDropdown;this.button.addDropdown=function(t,i){var n=e.call(this,t,i);return i||n.addClass("dropdownMenu"),n}.bind(this)},caret:function(){this.caret.set=function(e,t,i,n){if(this.utils.browser("msie")||(this.utils.isMobile()&&this.utils.browser("webkit")&&navigator.userAgent.match(/(iPad|iPhone|iPod)/i)?document.activeElement!==this.$editor[0]&&this.$editor.focus():this.$editor.focus()),e=e[0]||e,i=i[0]||i,this.utils.isBlockTag(e.tagName)&&""===e.innerHTML&&(e.innerHTML=this.opts.invisibleSpace),"BR"==e.tagName&&this.opts.linebreaks===!1){var o=$(this.opts.emptyHtml)[0];$(e).replaceWith(o),e=o,i=e}this.selection.get();try{this.range.setStart(e,t),this.range.setEnd(i,n)}catch(e){}this.selection.addRange()}.bind(this),this.caret.setOffset=function(e,t){"undefined"==typeof t&&(t=e),this.focus.isFocused()||this.focus.setStart();for(var i,n=document.createRange(),o=document.getSelection(),a=0,s=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);i=s.nextNode();)if(a+=i.nodeValue.length,(a>e||e===t&&a===e)&&(n.setStart(i,i.nodeValue.length+e-a),e=1/0),a>=t){n.setEnd(i,i.nodeValue.length+t-a);break}o.removeAllRanges(),o.addRange(n)}.bind(this)},clean:function(){var e=function(e){return e=e.replace(/\u201D/g,"__wcf_preserve_character_1__"),e=e.replace(/\u201C/g,"__wcf_preserve_character_2__"),e=e.replace(/\u2018/g,"__wcf_preserve_character_3__"),e=e.replace(/\u2019/g,"__wcf_preserve_character_4__")},t=function(e){return e=e.replace(/__wcf_preserve_character_1__/g,"”"),e=e.replace(/__wcf_preserve_character_2__/g,"“"),e=e.replace(/__wcf_preserve_character_3__/g,"‘"),e=e.replace(/__wcf_preserve_character_4__/g,"’")},i=this.clean.onPaste;this.clean.onPaste=function(n,o){return this.opts.replaceDivs=!0,n=e(n),n=i.call(this,n,o),this.opts.replaceDivs=!1,t(n)}.bind(this),this.clean.onPasteRemoveEmpty=function(e){return e.replace(/<br\s?\/?>$/i,"")};var n=this.clean.removeSpaces;this.clean.removeSpaces=function(e){return e=e.replace(/\u200C/g,"__wcf_zwnj__"),e=e.replace(/\u200D/g,"__wcf_zwj__"),e=n.call(this,e),e=e.replace(/__wcf_zwnj__/g,"‌"),e.replace(/__wcf_zwj__/g,"‍")};var o=this.clean.onSet;this.clean.onSet=function(i){return i=e(i),i=o.call(this,i),t(i)}.bind(this)},code:function(){var e=this.code.startSync;this.code.startSync=function(){this.code.syncCode=void 0,e.call(this)}.bind(this);var t=this.code.textareaIndenting;this.code.textareaIndenting=function(e){return 9!==e.keyCode||e.ctrlKey?!0:t.call(this,e)}.bind(this);var i=this.code.showCode;this.code.showCode=function(){var e=null;this.$textarea.is(":visible")||(e=this.$textarea.parentsUntil(":visible").last(),e.show()),i.call(this),null!==e&&e.hide()}.bind(this)},dropdown:function(){this.dropdown.build=function(e,t,i){t.addClass("dropdownMenu"),$.each(i,function(e,i){if("dropdownDivider"==e)$('<li class="dropdownDivider" />').appendTo(t);else{var n=$("<li />"),o=$('<a href="#" class="redactor-dropdown-'+e+'">'+i.title+"</a>");o.on("click",$.proxy(function(t){t.preventDefault();var n="func",o=i.func;i.command?(n="command",o=i.command):i.dropdown&&(n="dropdown",o=i.dropdown),this.button.onClick(t,e,n,o),this.dropdown.hideAll()},this)),o.appendTo(n),n.appendTo(t)}}.bind(this))}.bind(this);var e=this.dropdown.show;this.dropdown.show=$.proxy(function(i,n){var o=this.button.get(n).data("dropdown");t(o),$.browser.iOS&&this.wutil.saveSelection(),e.call(this,i,n),o.off("mouseover mouseout")},this);var t=function(e){if(!e.hasClass("dropdownMenu")){e.addClass("dropdownMenu");for(var t=e.children("a").detach(),i=0;i<t.length;i++){var n=$("<li />").appendTo(e);n.append(t[i])}}}},image:function(){var e=this.image.setEditable;this.image.setEditable=function(t){t.hasClass("smiley")||(t.off("click.redactor touchstart.redactor"),e.call(this,t))}.bind(this);var t=this.image.loadEditableControls;this.image.loadEditableControls=function(e){if("redactor-image-box"===e[0].parentNode.id)return $("#redactor-image-resizer",this.$editor[0]);var i=t.call(this,e);return e.hasClass("redactorDisableResize")&&i!==!1&&i.hide(),i}.bind(this),this.image.show=function(){this.modal.load("image",this.lang.get("image"),0);var e=this.modal.createActionButton(this.lang.get("insert"));e.click($.proxy(this.wbutton._insertImage,this)),$("#redactorImageLinkHrefContainer").hide(),this.selection.save(),this.modal.show()}.bind(this),this.image.showEdit=function(e){this.modal.load("imageEdit",this.lang.get("edit"),0),this.image.buttonSave=this.modal.createActionButton(this.lang.get("save")),this.image.buttonSave.click(function(){this.image.update(e)}.bind(this));var t=e.closest("a",this.$editor[0]);$("#redactor-image-link-source").val(e.attr("src")),$("#redactor-image-link-href").val(t.length?t.attr("href"):""),$("#redactor-image-align").val(e.css("float")),this.modal.show(),setTimeout(function(){$(".redactor-link-tooltip").remove()},1)}.bind(this);var i=function(e){var t=e.parent();e=e.detach(),e.prependTo(t),this.caret.setAfter(e)}.bind(this);this.image.update=function(e){this.image.hideResize(),this.buffer.set(),e.attr("src",$("#redactor-image-link-source").val()),this.image.setFloating(e),i(e);var t=$("#redactor-image-link-href").val().trim(),n=e.closest("a",this.$editor[0]);if(n.length)if(""===t){n=n[0];for(var o=n.children.length,a=n.parentNode;o--;)a.insertBefore(n.children[0],n);a.removeChild(n)}else n.attr("href",t);else""!==t&&(n=document.createElement("a"),n.href=t,e[0].parentNode.insertBefore(n,e[0]),n.appendChild(e[0]));this.modal.close(),this.observe.images()}.bind(this)},indent:function(){var e=this.indent.increase;this.indent.increase=function(){var t=this.selection.getBlock();t&&"LI"===t.tagName&&t.parentElement.firstChild!==t&&e.call(this)}.bind(this)},inline:function(){var e=(function(e,t){for(var i=e.parent();i[0]!==this.$editor[0]&&!(i.children(":not(.redactor-selection-marker)").length>1);){if("SPAN"===i[0].tagName&&i[0].style.getPropertyValue(t)){i.contents().unwrap();break}i=i.parent()}}.bind(this),this.inline.format);this.inline.format=function(t,i,n){$.browser.iOS&&this.wutil.restoreSelection(),e.call(this,t,i,n)}.bind(this);var t=this.inline.removeStyleRule;this.inline.removeStyleRule=function(e){$.browser.iOS&&this.wuil.restoreSelection(),t.call(this,e)}.bind(this)},insert:function(){var e=$.browser.webkit||document.documentElement.style.hasOwnProperty("WebkitAppearance")||window.hasOwnProperty("chrome"),t=function(e){var t=this.$editor.html();if(this.utils.isEmpty(t)){var i=!1;e.match(/^<(blockquote|div|p)/i)&&(this.$editor.empty(),i=!0),this.$editor.focus(),i||this.caret.setEnd(this.$editor.children("p:eq(0)"))}else if(document.activeElement!==this.$editor[0]&&this.wutil.restoreSelection(),e.match(/^<(blockquote|div|p)/i)&&getSelection().getRangeAt(0).collapsed){var n=getSelection().getRangeAt(0).startContainer;n.nodeType===Node.TEXT_NODE&&"​"===n.textContent&&this.caret.setEnd($(n.parentElement).html("<br />"))}}.bind(this),i=function(){var e=!1;this.$editor.find("span").each(function(){var t=$(this);if("redactor"!==t.data("verified")){var i=$("<b>helper</b>").insertBefore(t);i.after(t.contents()),i.remove(),t.remove(),e=!0}}),e&&this.wutil.saveSelection()}.bind(this),n=this.insert.html;if(this.insert.html=function(o,a){t(o),n.call(this,o,a),this.wutil.saveSelection(),e&&setTimeout(function(){i()},10)}.bind(this),navigator.userAgent.match(/safari/i)){var o=this.insert.execHtml;this.insert.execHtml=function(e){try{o.call(this,e)}catch(e){console.debug("[Redactor.wmonkeypatch] Suppressed error in Safari: "+e.message)}}.bind(this)}},keydown:function(){this.keydown.enterWithinBlockquote=!1;var e=this.keydown.onTab;this.keydown.onTab=function(t,i){var n=this.selection.getBlock();return n&&"LI"===n.tagName?e.call(this,t,i):!0}.bind(this);var t=this.keydown.replaceDivToParagraph;this.keydown.replaceDivToParagraph=function(){this.keydown.enterWithinBlockquote?this.keydown.enterWithinBlockquote=!1:t.call(this)}.bind(this);var i=this.keydown.setupBuffer;this.keydown.setupBuffer=function(e,t){return!this.keydown.ctrl||89!==t||e.shiftKey||e.altKey||0===this.opts.rebuffer.length?void i.call(this,e,t):(e.preventDefault(),void this.buffer.redo())}.bind(this)},keyup:function(){var e=this.keyup.replaceToParagraph;this.keyup.replaceToParagraph=function(t){("DIV"!==this.keyup.current.tagName||"BLOCKQUOTE"!==this.keyup.current.parentElement.tagName)&&e.call(this,t)}.bind(this)},link:function(){var e=this.link.insert;this.link.insert=function(){e.call(this),this.selection.get();var t=this.selection.getCurrent();t.nodeType===Node.TEXT_NODE&&(t=t.parentElement),"A"===t.tagName&&this.caret.setAfter(t)}.bind(this);var t=this.link.set;this.link.set=function(e,i,n){if(/\sEdge\//.test(window.navigator.userAgent)){e=$.trim(e.replace(/<|>/g,"")),this.selection.restore();{this.selection.getBlocks()}if(""===e&&""===i)return;if(""===e&&""!==i&&(e=i),this.link.$node)t.call(this,e,i,n);else{var o=$('<a href="'+i+'">').text(e);""!==n&&o.attr("target",n),o=$(this.insert.node(o)),this.selection.getText().match(/\s$/)&&o.after(" "),this.selection.selectElement(o),this.code.sync(),this.core.setCallback("insertedLink",o)}}else t.call(this,e,i,n);var a=window.getSelection();if(a.rangeCount){var s=a.getRangeAt(0);s.collapsed||(s.collapse(!1),this.wutil.saveSelection())}}.bind(this)},list:function(){var e=this.list.insert;this.list.insert=function(t){var i=window.getSelection();if(i.rangeCount){var n=i.getRangeAt(0);if(n.collapsed){var o=n.startContainer;if(o.nodeType===Node.TEXT_NODE&&(o=o.parentNode),"DIV"===o.nodeName&&"BLOCKQUOTE"===o.parentNode.nodeName){var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o)}}}e.call(this,t)}.bind(this)},modal:function(){this.modal.dialog=null;var e=this.modal.addTemplate;this.modal.addTemplate=function(t,i){"table"!==t&&e.call(this,t,i)}.bind(this),this.modal.build=function(){},this.modal.load=function(e,t){this.modal.templateName=e,this.modal.title=t,this.modal.dialog=$("<div />").hide().appendTo(document.body),this.modal.dialog.html(this.modal.getTemplate(this.modal.templateName)),this.$modalFooter=null}.bind(this),this.modal.show=function(){this.modal.dialog.wcfDialog({onClose:$.proxy(this.modal.close,this),title:this.modal.title}),this.modal.dialog.find("input:first").focus()}.bind(this);var t=this.modal.createButton;this.modal.createButton=function(e,i){return null===this.$modalFooter&&(this.$modalFooter=$('<div class="formSubmit" />').appendTo(this.modal.dialog),this.modal.dialog.addClass("dialogForm")),t.call(this,e,i)}.bind(this),this.modal.close=function(){if(null!==this.modal.dialog){try{this.modal.dialog.wcfDialog("close")}catch(e){}finally{if(this.modal.dialog){var e=this.modal.dialog.parents(".dialogContainer:eq(0)");e.length&&setTimeout(function(){e.remove()},500)}}this.modal.dialog=null}}.bind(this),this.modal.createCancelButton=function(){return $()},this.modal.createDeleteButton=function(){return $()}},observe:function(){var e=function(e,t,i,n,o,a){var s=this.$toolbar.find(i);if(e&&0!=e.closest(t,this.$editor[0]).length)s[n?"removeClass":"addClass"](o);else{if(a&&!this.opts.visual)return;s[n?"addClass":"removeClass"](o)}}.bind(this),t=this.observe.buttons;this.observe.buttons=function(i,n){t.call(this,i,n);var o=this.selection.getParent();o=o===!1?null:$(o),e(o,"ul, ol","a.re-indent, a.re-outdent",!0,"redactor-button-disabled"),e(o,"blockquote.quoteBox","a.re-__wcf_quote",!1,"redactor-button-disabled",!0),e(o,"sub","a.re-subscript",!1,"redactor-act"),e(o,"sup","a.re-superscript",!1,"redactor-act")}.bind(this);var i=this.observe.load;this.observe.load=function(){i.call(this),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","observe_load_"+this.$textarea.wcfIdentify())}.bind(this);var n=this.observe.showTooltip;this.observe.showTooltip=function(e){var t=$(e.target);t.hasClass("redactorQuoteEdit")||n.call(this,e),$(".redactor-link-tooltip").each(function(e,t){var i,n,o,a=[];for(i=0,n=t.childNodes.length;n>i;i++)o=t.childNodes[i],o.nodeType===Node.TEXT_NODE&&a.push(o);for(i=0,n=a.length;n>i;i++)o=a[i],"|"===o.textContent.trim()&&o.parentNode.removeChild(o)})}.bind(this)},paste:function(){var e=this.paste.createPasteBox;this.paste.createPasteBox=function(){if($.browser.iOS){var t=0;if(window.getSelection().rangeCount){var i=window.getSelection().getRangeAt(0).endContainer;i.nodeType!==Node.ELEMENT_NODE&&(i=i.parentElement),i=$(i),t=$(i).offset().top}else t=$(window).scrollTop();this.$pasteBox=$("<div>").html("").attr("contenteditable","true").css({position:"fixed",top:t+"px",fontSize:"16px"}),this.$box.parent().append(this.$pasteBox),this.$pasteBox.focus()}else e.call(this)}.bind(this);var t=function(){var e=window.getSelection();if(e.rangeCount){var t=e.getRangeAt(0);if(t.collapsed){var i=t.startContainer;if(i.nodeType===Node.ELEMENT_NODE&&"DIV"===i.tagName){var n=i.parentNode;if(null!==n&&"BLOCKQUOTE"===n.tagName&&n.classList.contains("quoteBox")){var o=t.startContainer.childNodes[t.startContainer.childNodes.length-1],a=document.createRange();a.setStart(t.startContainer.childNodes[0],0),a.setEnd(o,o.length),a.collapse(!1),e.removeAllRanges(),e.addRange(a)}}}}},i=this.paste.insert;this.paste.insert=function(e){t(),i.call(this,e),setTimeout(function(){if(this.wutil.fixDOM(),$.browser.msie)getSelection().getRangeAt(0).collapse(!1);else if($.browser.mozilla){var e=getSelection().getRangeAt(0);e.startContainer===this.$editor[0]&&e.endContainer===this.$editor[0]&&this.wutil.selectionEndOfEditor()}this.wutil.saveSelection()}.bind(this),20)}.bind(this)},selection:function(){this.selection.implicitRange=null;var e=function(e,t){var i=t.nextSibling;null!==i&&i.nodeType===Node.TEXT_NODE&&0===i.length&&$(i).remove();var n=null;("selection-marker-1"===t.id&&!this.$editor.find("#selection-marker-2").length||"nodes-marker-1"===t.id&&!this.$editor.find("#nodes-marker-2").length)&&(n=t.previousSibling);var o=!1;$.browser.iOS&&t.innerHTML.replace(/\u200b/g,"").length?(t.outerHTML=t.innerHTML,o=!0):t.parentNode.removeChild(t),null!==n?(this.selection.implicitRange=document.createRange(),this.selection.implicitRange.setStart(n,n.length),this.selection.implicitRange.setEnd(n,n.length),getSelection().removeAllRanges(),getSelection().addRange(this.selection.implicitRange)):this.selection.implicitRange=null,$.browser.iOS&&o&&window.setTimeout(function(){this.focus.setEnd()}.bind(this),10)}.bind(this);this.selection.removeMarkers=function(){this.$editor.find("span.redactor-selection-marker").each(e)}.bind(this),this.selection.removeNodesMarkers=function(){$(document).find("span.redactor-nodes-marker").each(e),this.$editor.find("span.redactor-nodes-marker").each(e)}.bind(this)},utils:function(){this.utils.removeEmpty=function(){}},rebuildTemplates:function(){this.opts.modal.image='<fieldset id="redactor-modal-image-edit"><dl><dt><label for="redactor-image-link-source">'+WCF.Language.get("wcf.bbcode.image.source")+'</label></dt><dd><input type="text" id="redactor-image-link-source" class="long"  /></dd></dl><dl id="redactorImageLinkHrefContainer"><dt><label for="redactor-image-link-href">'+this.lang.get("link")+'</label></dt><dd><input type="text" id="redactor-image-link-href" class="long"  /></dd></dl><dl><dt><label for="redactor-image-align">'+this.opts.curLang.image_position+'</label></dt><dd><select id="redactor-image-align"><option value="none">'+WCF.Language.get("wcf.global.noSelection")+'</option><option value="left">'+this.lang.get("left")+'</option><option value="right">'+this.lang.get("right")+"</option></select></dd></dl></fieldset>",this.opts.modal.imageEdit=this.opts.modal.image,this.opts.modal.link='<fieldset id="redactor-modal-link"><dl><dt><label for="redactor-link-url">URL</label></dt><dd><input type="url" id="redactor-link-url" class="long" /></dd></dl><dl><dt><label for="redactor-link-url-text">'+this.lang.get("text")+'</label></dt><dd><input type="text" id="redactor-link-url-text" class="long" /></dd></dl></fieldset>',this.opts.modal.quote='<fieldset><dl><dt><label for="redactorQuoteAuthor">'+WCF.Language.get("wcf.bbcode.quote.edit.author")+'</label></dt><dd><input type="text" id="redactorQuoteAuthor" class="long" /></dd></dl><dl><dt><label for="redactorQuoteLink">'+WCF.Language.get("wcf.bbcode.quote.edit.link")+'</label></dt><dd><input type="text" id="redactorQuoteLink" class="long" /></dd></dl></fieldset>';var e="";$.each(__REDACTOR_CODE_HIGHLIGHTERS,function(t,i){return"plain"===t?!0:void(e+='<option value="'+t+'">'+i+"</option>")}),this.opts.modal.code="<fieldset><legend>"+WCF.Language.get("wcf.bbcode.code.settings")+'</legend><dl><dt><label for="redactorCodeHighlighter">'+WCF.Language.get("wcf.bbcode.code.highlighter")+'</label></dt><dd><select id="redactorCodeHighlighter"><option value="plain">'+WCF.Language.get("wcf.bbcode.code.highlighter.none")+"</option>"+e+"</select><small>"+WCF.Language.get("wcf.bbcode.code.highlighter.description")+'</small></dd></dl><dl><dt><label for="redactorCodeLineNumber">'+WCF.Language.get("wcf.bbcode.code.lineNumber")+'</label></dt><dd><input type="number" id="redactorCodeLineNumber" min="1" max="99999" value="1" /><small>'+WCF.Language.get("wcf.bbcode.code.lineNumber.description")+'</small></dd></dl><dl><dt><label for="redactorCodeFilename">'+WCF.Language.get("wcf.bbcode.code.filename")+'</label></dt><dd><input type="text" id="redactorCodeFilename" value="" class="long" /><small>'+WCF.Language.get("wcf.bbcode.code.filename.description")+"</small></dd></dl></fieldset><fieldset><legend>"+WCF.Language.get("wcf.bbcode.code")+'</legend><dl class="wide"><dt></dt><dd><textarea id="redactorCodeBox" class="long monospace" rows="12" /></dd></dl></fieldset>',this.opts.modal.table='<fieldset id="redactor-modal-table-insert"><dl><dt><label for="redactor-table-rows">'+this.lang.get("rows")+'</label></dt><dd><input type="number" size="5" value="2" min="1" id="redactor-table-rows" class="tiny" /></dd></dl><dl><dt><label for="redactor-table-columns">'+this.lang.get("columns")+'</label></dt><dd><input type="number" size="5" value="3" min="1" id="redactor-table-columns" class="tiny" /></dd></dl></fieldset>'},fixWebKit:function(){return}}};
+if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wmonkeypatch=function(){"use strict";return{init:function(){this.wmonkeypatch.alignment(),this.wmonkeypatch.button(),this.wmonkeypatch.caret(),this.wmonkeypatch.clean(),this.wmonkeypatch.code(),this.wmonkeypatch.dropdown(),this.wmonkeypatch.image(),this.wmonkeypatch.indent(),this.wmonkeypatch.inline(),this.wmonkeypatch.insert(),this.wmonkeypatch.keydown(),this.wmonkeypatch.keyup(),this.wmonkeypatch.link(),this.wmonkeypatch.list(),this.wmonkeypatch.modal(),this.wmonkeypatch.paste(),this.wmonkeypatch.observe(),this.wmonkeypatch.selection(),this.wmonkeypatch.utils(),this.wmonkeypatch.rebuildTemplates(),this.wmonkeypatch.bindEvents(),this.wmonkeypatch.fixWebKit()},bindEvents:function(){var e=this.$textarea.wcfIdentify();this.wutil.setOption("keydownCallback",function(t){var i={cancel:!1,event:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keydown_"+e,i),i.cancel?!1:!0}),this.wutil.setOption("keyupCallback",function(t){this.wutil.saveSelection();var i={cancel:!1,event:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keyup_"+e,i),i.cancel?!1:!0}.bind(this)),this.opts.activeButtons&&(this.$editor.off("mouseup.redactor keyup.redactor focus.redactor"),this.$editor.on("mouseup.redactor keyup.redactor focus.redactor",$.proxy(this.observe.buttons,this)),this.$editor.on("keyup.redactor",$.proxy(this.keyup.init,this)));var t=!1;this.$editor.on("mousedown.wmonkeypatch",function(){t=!0}.bind(this)),$(document).on("mouseup.wmonkeypatch",function(){t&&(t=!1,this.wutil.saveSelection())}.bind(this));var i=function(e,t){t?!e.previousElementSibling||"P"!==e.previousElementSibling.tagName&&"DIV"!==e.previousElementSibling.tagName?this.wutil.setCaretBefore(e):this.caret.setEnd(e.previousElementSibling):!e.nextElementSibling||"P"!==e.nextElementSibling.tagName&&"DIV"!==e.nextElementSibling.tagName?this.wutil.setCaretAfter(e):this.caret.setEnd(e.nextElementSibling)}.bind(this),n=null;this.$editor.on("click.wmonkeypatch",function(e){if(e.target===this.$editor[0]){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null;if(t&&t.collapsed){var o=t.startContainer,a=this.$editor.offset();if(null===n&&(n={left:this.$editor.cssAsNumber("padding-left"),top:this.$editor.cssAsNumber("padding-top")}),e.pageY<=a.top+n.top){var s=this.$editor[0].children[0];if("BLOCKQUOTE"!==s.tagName&&("DIV"!==s.tagName||!/\bcodeBox\b/.test(s.className)))return}else{if(e.pageX<=a.left+n.left)return;if(e.pageX>a.left+this.$editor.width())return}for(;o&&o!==this.$editor[0];){if(o.nodeType===Node.ELEMENT_NODE&&("BLOCKQUOTE"===o.tagName||"DIV"===o.tagName&&/\bcodeBox\b/.test(o.className))){var r=$(o).offset();return e.pageY<=r.top?i(o,!0):i(o,!1),!1}o=o.parentElement}}var l=this.$editor.children("blockquote, div.codeBox");return l.each(function(t,n){var o=$(n),a=o.offset();if(e.pageY<=a.top)return i(n,!0),!1;var s=o.outerHeight()+(parseInt(o.css("margin-bottom"),10)||0);return e.pageY<=a.top+s?(i(n,!1),!1):void 0}),!1}if("LI"===e.target.tagName){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null,d=!1;if(null!==t){if(!t.collapsed)return;for(var o=t.startContainer;null!==o&&o!==this.$editor[0];){if("LI"===o.tagName){d=!0;break}o=o.parentElement}}if(!d||null===t){var c=document.createTextNode("​"),s=e.target.children[0];s.appendChild(c),this.caret.setEnd(s)}}else if("BLOCKQUOTE"===e.target.tagName){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null;if(null!==t&&t.collapsed){for(var h=null,o=t.startContainer.nodeType===Node.TEXT_NODE?t.startContainer.parentElement:t.startContainer;null!==o&&o!==this.$editor[0];){if("BLOCKQUOTE"===o.tagName){h=o;break}o=o.parentElement}null!==h&&h!==e.target&&(e.pageY<=$(h).offset().top?i(h,!0):i(h,!1))}}}.bind(this))},alignment:function(){var e=this.alignment.setBlocks;this.alignment.setBlocks=function(t){e.call(this,t),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","fixFormatting_"+this.$textarea.wcfIdentify())}.bind(this)},button:function(){var e=this.button.addDropdown;this.button.addDropdown=function(t,i){var n=e.call(this,t,i);return i||n.addClass("dropdownMenu"),n}.bind(this)},caret:function(){this.caret.set=function(e,t,i,n){if(this.utils.browser("msie")||(this.utils.isMobile()&&this.utils.browser("webkit")&&navigator.userAgent.match(/(iPad|iPhone|iPod)/i)?document.activeElement!==this.$editor[0]&&this.$editor.focus():this.$editor.focus()),e=e[0]||e,i=i[0]||i,this.utils.isBlockTag(e.tagName)&&""===e.innerHTML&&(e.innerHTML=this.opts.invisibleSpace),"BR"==e.tagName&&this.opts.linebreaks===!1){var o=$(this.opts.emptyHtml)[0];$(e).replaceWith(o),e=o,i=e}this.selection.get();try{this.range.setStart(e,t),this.range.setEnd(i,n)}catch(e){}this.selection.addRange()}.bind(this),this.caret.setOffset=function(e,t){"undefined"==typeof t&&(t=e),this.focus.isFocused()||this.focus.setStart();for(var i,n=document.createRange(),o=document.getSelection(),a=0,s=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);i=s.nextNode();)if(a+=i.nodeValue.length,(a>e||e===t&&a===e)&&(n.setStart(i,i.nodeValue.length+e-a),e=1/0),a>=t){n.setEnd(i,i.nodeValue.length+t-a);break}o.removeAllRanges(),o.addRange(n)}.bind(this)},clean:function(){var e=function(e){return e=e.replace(/\u201D/g,"__wcf_preserve_character_1__"),e=e.replace(/\u201C/g,"__wcf_preserve_character_2__"),e=e.replace(/\u2018/g,"__wcf_preserve_character_3__"),e=e.replace(/\u2019/g,"__wcf_preserve_character_4__")},t=function(e){return e=e.replace(/__wcf_preserve_character_1__/g,"”"),e=e.replace(/__wcf_preserve_character_2__/g,"“"),e=e.replace(/__wcf_preserve_character_3__/g,"‘"),e=e.replace(/__wcf_preserve_character_4__/g,"’")},i=this.clean.onPaste;this.clean.onPaste=function(n,o){return this.opts.replaceDivs=!0,n=e(n),n=i.call(this,n,o),this.opts.replaceDivs=!1,t(n)}.bind(this),this.clean.onPasteRemoveEmpty=function(e){return e.replace(/<br\s?\/?>$/i,"")};var n=this.clean.removeSpaces;this.clean.removeSpaces=function(e){return e=e.replace(/\u200C/g,"__wcf_zwnj__"),e=e.replace(/\u200D/g,"__wcf_zwj__"),e=n.call(this,e),e=e.replace(/__wcf_zwnj__/g,"‌"),e.replace(/__wcf_zwj__/g,"‍")};var o=this.clean.onSet;this.clean.onSet=function(i){return i=e(i),i=o.call(this,i),t(i)}.bind(this)},code:function(){var e=this.code.startSync;this.code.startSync=function(){this.code.syncCode=void 0,e.call(this)}.bind(this);var t=this.code.textareaIndenting;this.code.textareaIndenting=function(e){return 9!==e.keyCode||e.ctrlKey?!0:t.call(this,e)}.bind(this);var i=this.code.showCode;this.code.showCode=function(){var e=null;this.$textarea.is(":visible")||(e=this.$textarea.parentsUntil(":visible").last(),e.show()),i.call(this),null!==e&&e.hide()}.bind(this)},dropdown:function(){this.dropdown.build=function(e,t,i){t.addClass("dropdownMenu"),$.each(i,function(e,i){if("dropdownDivider"==e)$('<li class="dropdownDivider" />').appendTo(t);else{var n=$("<li />"),o=$('<a href="#" class="redactor-dropdown-'+e+'">'+i.title+"</a>");o.on("click",$.proxy(function(t){t.preventDefault();var n="func",o=i.func;i.command?(n="command",o=i.command):i.dropdown&&(n="dropdown",o=i.dropdown),this.button.onClick(t,e,n,o),this.dropdown.hideAll()},this)),o.appendTo(n),n.appendTo(t)}}.bind(this))}.bind(this);var e=this.dropdown.show;this.dropdown.show=$.proxy(function(i,n){var o=this.button.get(n).data("dropdown");t(o),$.browser.iOS&&this.wutil.saveSelection(),e.call(this,i,n),o.off("mouseover mouseout")},this);var t=function(e){if(!e.hasClass("dropdownMenu")){e.addClass("dropdownMenu");for(var t=e.children("a").detach(),i=0;i<t.length;i++){var n=$("<li />").appendTo(e);n.append(t[i])}}}},image:function(){var e=this.image.setEditable;this.image.setEditable=function(t){t.hasClass("smiley")||(t.off("click.redactor touchstart.redactor"),e.call(this,t))}.bind(this);var t=this.image.loadEditableControls;this.image.loadEditableControls=function(e){if("redactor-image-box"===e[0].parentNode.id)return $("#redactor-image-resizer",this.$editor[0]);var i=t.call(this,e);return e.hasClass("redactorDisableResize")&&i!==!1&&i.hide(),i}.bind(this),this.image.show=function(){this.modal.load("image",this.lang.get("image"),0);var e=this.modal.createActionButton(this.lang.get("insert"));e.click($.proxy(this.wbutton._insertImage,this)),$("#redactorImageLinkHrefContainer").hide(),this.selection.save(),this.modal.show()}.bind(this),this.image.showEdit=function(e){this.modal.load("imageEdit",this.lang.get("edit"),0),this.image.buttonSave=this.modal.createActionButton(this.lang.get("save")),this.image.buttonSave.click(function(){this.image.update(e)}.bind(this));var t=e.closest("a",this.$editor[0]);$("#redactor-image-link-source").val(e.attr("src")),$("#redactor-image-link-href").val(t.length?t.attr("href"):""),$("#redactor-image-align").val(e.css("float")),this.modal.show(),setTimeout(function(){$(".redactor-link-tooltip").remove()},1)}.bind(this);var i=function(e){var t=e.parent();e=e.detach(),e.prependTo(t)}.bind(this);this.image.update=function(e){this.image.hideResize(),this.buffer.set(),e.attr("src",$("#redactor-image-link-source").val()),this.image.setFloating(e);var t=e.css("float");("left"===t||"right"===t)&&i(e),this.caret.setAfter(e);var n=$("#redactor-image-link-href").val().trim(),o=e.closest("a",this.$editor[0]);if(o.length)if(""===n){o=o[0];for(var a=o.children.length,s=o.parentNode;a--;)s.insertBefore(o.children[0],o);s.removeChild(o)}else o.attr("href",n);else""!==n&&(o=document.createElement("a"),o.href=n,e[0].parentNode.insertBefore(o,e[0]),o.appendChild(e[0]));this.modal.close(),this.observe.images()}.bind(this)},indent:function(){var e=this.indent.increase;this.indent.increase=function(){var t=this.selection.getBlock();t&&"LI"===t.tagName&&t.parentElement.firstChild!==t&&e.call(this)}.bind(this)},inline:function(){var e=(function(e,t){for(var i=e.parent();i[0]!==this.$editor[0]&&!(i.children(":not(.redactor-selection-marker)").length>1);){if("SPAN"===i[0].tagName&&i[0].style.getPropertyValue(t)){i.contents().unwrap();break}i=i.parent()}}.bind(this),this.inline.format);this.inline.format=function(t,i,n){$.browser.iOS&&this.wutil.restoreSelection(),e.call(this,t,i,n)}.bind(this);var t=this.inline.removeStyleRule;this.inline.removeStyleRule=function(e){$.browser.iOS&&this.wuil.restoreSelection(),t.call(this,e)}.bind(this)},insert:function(){var e=$.browser.webkit||document.documentElement.style.hasOwnProperty("WebkitAppearance")||window.hasOwnProperty("chrome"),t=function(e){var t=this.$editor.html();if(this.utils.isEmpty(t)){var i=!1;e.match(/^<(blockquote|div|p)/i)&&(this.$editor.empty(),i=!0),this.$editor.focus(),i||this.caret.setEnd(this.$editor.children("p:eq(0)"))}else if(document.activeElement!==this.$editor[0]&&this.wutil.restoreSelection(),e.match(/^<(blockquote|div|p)/i)&&getSelection().getRangeAt(0).collapsed){var n=getSelection().getRangeAt(0).startContainer;n.nodeType===Node.TEXT_NODE&&"​"===n.textContent&&this.caret.setEnd($(n.parentElement).html("<br />"))}}.bind(this),i=function(){var e=!1;this.$editor.find("span").each(function(){var t=$(this);if("redactor"!==t.data("verified")){var i=$("<b>helper</b>").insertBefore(t);i.after(t.contents()),i.remove(),t.remove(),e=!0}}),e&&this.wutil.saveSelection()}.bind(this),n=this.insert.html;if(this.insert.html=function(o,a){t(o),n.call(this,o,a),this.wutil.saveSelection(),e&&setTimeout(function(){i()},10)}.bind(this),navigator.userAgent.match(/safari/i)){var o=this.insert.execHtml;this.insert.execHtml=function(e){try{o.call(this,e)}catch(e){console.debug("[Redactor.wmonkeypatch] Suppressed error in Safari: "+e.message)}}.bind(this)}},keydown:function(){this.keydown.enterWithinBlockquote=!1;var e=this.keydown.onTab;this.keydown.onTab=function(t,i){var n=this.selection.getBlock();return n&&"LI"===n.tagName?e.call(this,t,i):!0}.bind(this);var t=this.keydown.replaceDivToParagraph;this.keydown.replaceDivToParagraph=function(){this.keydown.enterWithinBlockquote?this.keydown.enterWithinBlockquote=!1:t.call(this)}.bind(this);var i=this.keydown.setupBuffer;this.keydown.setupBuffer=function(e,t){return!this.keydown.ctrl||89!==t||e.shiftKey||e.altKey||0===this.opts.rebuffer.length?void i.call(this,e,t):(e.preventDefault(),void this.buffer.redo())}.bind(this)},keyup:function(){var e=this.keyup.replaceToParagraph;this.keyup.replaceToParagraph=function(t){("DIV"!==this.keyup.current.tagName||"BLOCKQUOTE"!==this.keyup.current.parentElement.tagName)&&e.call(this,t)}.bind(this)},link:function(){var e=this.link.insert;this.link.insert=function(){e.call(this),this.selection.get();var t=this.selection.getCurrent();t.nodeType===Node.TEXT_NODE&&(t=t.parentElement),"A"===t.tagName&&this.caret.setAfter(t)}.bind(this);var t=this.link.set;this.link.set=function(e,i,n){if(/\sEdge\//.test(window.navigator.userAgent)){e=$.trim(e.replace(/<|>/g,"")),this.selection.restore();{this.selection.getBlocks()}if(""===e&&""===i)return;if(""===e&&""!==i&&(e=i),this.link.$node)t.call(this,e,i,n);else{var o=$('<a href="'+i+'">').text(e);""!==n&&o.attr("target",n),o=$(this.insert.node(o)),this.selection.getText().match(/\s$/)&&o.after(" "),this.selection.selectElement(o),this.code.sync(),this.core.setCallback("insertedLink",o)}}else t.call(this,e,i,n);var a=window.getSelection();if(a.rangeCount){var s=a.getRangeAt(0);s.collapsed||(s.collapse(!1),this.wutil.saveSelection())}}.bind(this)},list:function(){var e=this.list.insert;this.list.insert=function(t){var i=window.getSelection();if(i.rangeCount){var n=i.getRangeAt(0);if(n.collapsed){var o=n.startContainer;if(o.nodeType===Node.TEXT_NODE&&(o=o.parentNode),"DIV"===o.nodeName&&"BLOCKQUOTE"===o.parentNode.nodeName){var a=document.createElement("div");o.parentNode.insertBefore(a,o),a.appendChild(o)}}}e.call(this,t)}.bind(this)},modal:function(){this.modal.dialog=null;var e=this.modal.addTemplate;this.modal.addTemplate=function(t,i){"table"!==t&&e.call(this,t,i)}.bind(this),this.modal.build=function(){},this.modal.load=function(e,t){this.modal.templateName=e,this.modal.title=t,this.modal.dialog=$("<div />").hide().appendTo(document.body),this.modal.dialog.html(this.modal.getTemplate(this.modal.templateName)),this.$modalFooter=null}.bind(this),this.modal.show=function(){this.modal.dialog.wcfDialog({onClose:$.proxy(this.modal.close,this),title:this.modal.title}),this.modal.dialog.find("input:first").focus()}.bind(this);var t=this.modal.createButton;this.modal.createButton=function(e,i){return null===this.$modalFooter&&(this.$modalFooter=$('<div class="formSubmit" />').appendTo(this.modal.dialog),this.modal.dialog.addClass("dialogForm")),t.call(this,e,i)}.bind(this),this.modal.close=function(){if(null!==this.modal.dialog){try{this.modal.dialog.wcfDialog("close")}catch(e){}finally{if(this.modal.dialog){var e=this.modal.dialog.parents(".dialogContainer:eq(0)");e.length&&setTimeout(function(){e.remove()},500)}}this.modal.dialog=null}}.bind(this),this.modal.createCancelButton=function(){return $()},this.modal.createDeleteButton=function(){return $()}},observe:function(){var e=function(e,t,i,n,o,a){var s=this.$toolbar.find(i);if(e&&0!=e.closest(t,this.$editor[0]).length)s[n?"removeClass":"addClass"](o);else{if(a&&!this.opts.visual)return;s[n?"addClass":"removeClass"](o)}}.bind(this),t=this.observe.buttons;this.observe.buttons=function(i,n){t.call(this,i,n);var o=this.selection.getParent();o=o===!1?null:$(o),e(o,"ul, ol","a.re-indent, a.re-outdent",!0,"redactor-button-disabled"),e(o,"blockquote.quoteBox","a.re-__wcf_quote",!1,"redactor-button-disabled",!0),e(o,"sub","a.re-subscript",!1,"redactor-act"),e(o,"sup","a.re-superscript",!1,"redactor-act")}.bind(this);var i=this.observe.load;this.observe.load=function(){i.call(this),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","observe_load_"+this.$textarea.wcfIdentify())}.bind(this);var n=this.observe.showTooltip;this.observe.showTooltip=function(e){var t=$(e.target);t.hasClass("redactorQuoteEdit")||n.call(this,e),$(".redactor-link-tooltip").each(function(e,t){var i,n,o,a=[];for(i=0,n=t.childNodes.length;n>i;i++)o=t.childNodes[i],o.nodeType===Node.TEXT_NODE&&a.push(o);for(i=0,n=a.length;n>i;i++)o=a[i],"|"===o.textContent.trim()&&o.parentNode.removeChild(o)})}.bind(this)},paste:function(){var e=this.paste.createPasteBox;this.paste.createPasteBox=function(){if($.browser.iOS){var t=0;if(window.getSelection().rangeCount){var i=window.getSelection().getRangeAt(0).endContainer;i.nodeType!==Node.ELEMENT_NODE&&(i=i.parentElement),i=$(i),t=$(i).offset().top}else t=$(window).scrollTop();this.$pasteBox=$("<div>").html("").attr("contenteditable","true").css({position:"fixed",top:t+"px",fontSize:"16px"}),this.$box.parent().append(this.$pasteBox),this.$pasteBox.focus()}else e.call(this)}.bind(this);var t=function(){var e=window.getSelection();if(e.rangeCount){var t=e.getRangeAt(0);if(t.collapsed){var i=t.startContainer;if(i.nodeType===Node.ELEMENT_NODE&&"DIV"===i.tagName){var n=i.parentNode;if(null!==n&&"BLOCKQUOTE"===n.tagName&&n.classList.contains("quoteBox")){var o=t.startContainer.childNodes[t.startContainer.childNodes.length-1],a=document.createRange();a.setStart(t.startContainer.childNodes[0],0),a.setEnd(o,o.length),a.collapse(!1),e.removeAllRanges(),e.addRange(a)}}}}},i=this.paste.insert;this.paste.insert=function(e){t(),i.call(this,e),setTimeout(function(){if(this.wutil.fixDOM(),$.browser.msie)getSelection().getRangeAt(0).collapse(!1);else if($.browser.mozilla){var e=getSelection().getRangeAt(0);e.startContainer===this.$editor[0]&&e.endContainer===this.$editor[0]&&this.wutil.selectionEndOfEditor()}this.wutil.saveSelection()}.bind(this),20)}.bind(this)},selection:function(){this.selection.implicitRange=null;var e=function(e,t){var i=t.nextSibling;null!==i&&i.nodeType===Node.TEXT_NODE&&0===i.length&&$(i).remove();var n=null;("selection-marker-1"===t.id&&!this.$editor.find("#selection-marker-2").length||"nodes-marker-1"===t.id&&!this.$editor.find("#nodes-marker-2").length)&&(n=t.previousSibling);var o=!1;$.browser.iOS&&t.innerHTML.replace(/\u200b/g,"").length?(t.outerHTML=t.innerHTML,o=!0):t.parentNode.removeChild(t),null!==n?(this.selection.implicitRange=document.createRange(),this.selection.implicitRange.setStart(n,n.length),this.selection.implicitRange.setEnd(n,n.length),getSelection().removeAllRanges(),getSelection().addRange(this.selection.implicitRange)):this.selection.implicitRange=null,$.browser.iOS&&o&&window.setTimeout(function(){this.focus.setEnd()}.bind(this),10)}.bind(this);this.selection.removeMarkers=function(){this.$editor.find("span.redactor-selection-marker").each(e)}.bind(this),this.selection.removeNodesMarkers=function(){$(document).find("span.redactor-nodes-marker").each(e),this.$editor.find("span.redactor-nodes-marker").each(e)}.bind(this)},utils:function(){this.utils.removeEmpty=function(){}},rebuildTemplates:function(){this.opts.modal.image='<fieldset id="redactor-modal-image-edit"><dl><dt><label for="redactor-image-link-source">'+WCF.Language.get("wcf.bbcode.image.source")+'</label></dt><dd><input type="text" id="redactor-image-link-source" class="long"  /></dd></dl><dl id="redactorImageLinkHrefContainer"><dt><label for="redactor-image-link-href">'+this.lang.get("link")+'</label></dt><dd><input type="text" id="redactor-image-link-href" class="long"  /></dd></dl><dl><dt><label for="redactor-image-align">'+this.opts.curLang.image_position+'</label></dt><dd><select id="redactor-image-align"><option value="none">'+WCF.Language.get("wcf.global.noSelection")+'</option><option value="left">'+this.lang.get("left")+'</option><option value="right">'+this.lang.get("right")+"</option></select></dd></dl></fieldset>",this.opts.modal.imageEdit=this.opts.modal.image,this.opts.modal.link='<fieldset id="redactor-modal-link"><dl><dt><label for="redactor-link-url">URL</label></dt><dd><input type="url" id="redactor-link-url" class="long" /></dd></dl><dl><dt><label for="redactor-link-url-text">'+this.lang.get("text")+'</label></dt><dd><input type="text" id="redactor-link-url-text" class="long" /></dd></dl></fieldset>',this.opts.modal.quote='<fieldset><dl><dt><label for="redactorQuoteAuthor">'+WCF.Language.get("wcf.bbcode.quote.edit.author")+'</label></dt><dd><input type="text" id="redactorQuoteAuthor" class="long" /></dd></dl><dl><dt><label for="redactorQuoteLink">'+WCF.Language.get("wcf.bbcode.quote.edit.link")+'</label></dt><dd><input type="text" id="redactorQuoteLink" class="long" /></dd></dl></fieldset>';var e="";$.each(__REDACTOR_CODE_HIGHLIGHTERS,function(t,i){return"plain"===t?!0:void(e+='<option value="'+t+'">'+i+"</option>")}),this.opts.modal.code="<fieldset><legend>"+WCF.Language.get("wcf.bbcode.code.settings")+'</legend><dl><dt><label for="redactorCodeHighlighter">'+WCF.Language.get("wcf.bbcode.code.highlighter")+'</label></dt><dd><select id="redactorCodeHighlighter"><option value="plain">'+WCF.Language.get("wcf.bbcode.code.highlighter.none")+"</option>"+e+"</select><small>"+WCF.Language.get("wcf.bbcode.code.highlighter.description")+'</small></dd></dl><dl><dt><label for="redactorCodeLineNumber">'+WCF.Language.get("wcf.bbcode.code.lineNumber")+'</label></dt><dd><input type="number" id="redactorCodeLineNumber" min="1" max="99999" value="1" /><small>'+WCF.Language.get("wcf.bbcode.code.lineNumber.description")+'</small></dd></dl><dl><dt><label for="redactorCodeFilename">'+WCF.Language.get("wcf.bbcode.code.filename")+'</label></dt><dd><input type="text" id="redactorCodeFilename" value="" class="long" /><small>'+WCF.Language.get("wcf.bbcode.code.filename.description")+"</small></dd></dl></fieldset><fieldset><legend>"+WCF.Language.get("wcf.bbcode.code")+'</legend><dl class="wide"><dt></dt><dd><textarea id="redactorCodeBox" class="long monospace" rows="12" /></dd></dl></fieldset>',this.opts.modal.table='<fieldset id="redactor-modal-table-insert"><dl><dt><label for="redactor-table-rows">'+this.lang.get("rows")+'</label></dt><dd><input type="number" size="5" value="2" min="1" id="redactor-table-rows" class="tiny" /></dd></dl><dl><dt><label for="redactor-table-columns">'+this.lang.get("columns")+'</label></dt><dd><input type="number" size="5" value="3" min="1" id="redactor-table-columns" class="tiny" /></dd></dl></fieldset>'},fixWebKit:function(){return}}};
 // wupload.js
 if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wupload=function(){"use strict";return{_boundGlobalUploadEvents:!1,_dropArea:{},_timer:null,_isDragging:!1,_isFile:!1,init:function(){var t=".redactor_"+this.$textarea.wcfIdentify();$(document).on("dragover"+t,$.proxy(this.wupload._dragOver,this)),$(document).on("dragleave"+t,$.proxy(this.wupload._dragLeave,this)),$(document).on("drop"+t,function(t){t.preventDefault(),this.wupload._revertDropArea(void 0,this.$textarea.wcfIdentify())}.bind(this)),this.wupload._boundGlobalUploadEvents||(this.wupload._boundGlobalUploadEvents=!0,$(document).on("dragend",function(t){t.preventDefault()})),WCF.System.Event.addListener("com.woltlab.wcf.attachment","autoInsert_"+this.$textarea.wcfIdentify(),$.proxy(this.wupload.insertPastedImageAttachment,this))},_dragOver:function(t){if(t=t.originalEvent,this.$editor.is(":visible")&&t.dataTransfer&&t.dataTransfer.types){var e=!1;for(var a in t.dataTransfer)if(/^moz/.test(a)){e=!0;break}if(this.wupload._isFile=!1,e)"application/x-moz-file"===t.dataTransfer.types[0]&&(this.wupload._isFile=!0);else for(var i=0;i<t.dataTransfer.types.length;i++)if("Files"===t.dataTransfer.types[i]){this.wupload._isFile=!0;break}if(this.wupload._isFile){if(this.wupload._isFile=!0,t.preventDefault(),!this.wupload._isDragging){var r=this.$textarea.wcfIdentify();void 0===this.wupload._dropArea[r]&&(this.wupload._dropArea[r]=$('<div class="redactorDropArea">'+WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")+"</div>").hide().appendTo(document.body),this.wupload._dropArea[r].on("dragover",$.proxy(this.wupload._hoverDropArea,this)).on("dragleave",$.proxy(this.wupload._revertDropArea,this)).on("drop",$.proxy(this.wupload._drop,this)));var o=this.wutil.inWysiwygMode()?this.$editor.getDimensions("outer"):this.$textarea.getDimensions("outer"),s=this.wutil.inWysiwygMode()?this.$editor.getOffsets("offset"):this.$textarea.getOffsets("offset");this.wupload._dropArea[r].css({height:o.height+"px",left:s.left+"px",lineHeight:o.height+"px",top:s.top+"px",width:o.width+"px"}).show(),this.wupload._isDragging=!0}t.preventDefault()}}},_hoverDropArea:function(){this.wupload._dropArea[this.$textarea.wcfIdentify()].addClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropNow"))},_revertDropArea:function(t,e){if(this.wupload._isFile){var a=e||this.$textarea.wcfIdentify();this.wupload._dropArea[a].removeClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")),e&&this.wupload._dropArea[a].hide()}},_dragLeave:function(){this.wupload._isDragging&&this.wupload._isFile&&(null===this.wupload._timer?this.wupload._timer=new WCF.PeriodicalExecuter(function(t){t.stop(),this.wupload._isDragging||this.wupload._dropArea[this.$textarea.wcfIdentify()].hide()}.bind(this),100):this.wupload._timer.resume(),this.wupload._isDragging=!1)},_drop:function(t){if(this.wupload._isFile&&(t=t.originalEvent||t,t.dataTransfer&&t.dataTransfer.files.length)){t.preventDefault();var e=this.$textarea.wcfIdentify();this.wupload._revertDropArea(void 0,e);for(var a=0;a<t.dataTransfer.files.length;a++)WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+e,{file:t.dataTransfer.files[a]})}},pasteClipboardUploadMozilla:function(){this.$editor.find("img[data-mozilla-paste-image]").each($.proxy(function(t,e){var a=$(e),i=a.prop("src").split(","),r=i[0].split(";")[0].split(":")[1],o=i[1],s={blob:WCF.base64toBlob(o,r),uploadID:null};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+this.$textarea.wcfIdentify(),s),a.replaceWith('<span class="redactor-pastedImageFromClipboard-'+s.uploadID+'" />')},this))},insertPastedImageAttachment:function(t){var e=this.$editor.find("span.redactor-pastedImageFromClipboard-"+t.uploadID);e.before(t.attachment),e.remove()}}};
 // wutil.js