Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Sun, 17 Jul 2016 03:10:07 +0000 (05:10 +0200)
committerwoltlab.com <woltlab@woltlab.com>
Sun, 17 Jul 2016 03:10:07 +0000 (05:10 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js

index 463d0546f88afe9a27be6343e8b0cd25b11c9616..b7f63a36fcaf2f1958fa94d7c9d025729d277954 100644 (file)
@@ -17,3 +17,18 @@ if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wmonkeypatch=function
 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
 if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wutil=function(){"use strict";var t="",e=null,i=!1,a=!1,n=null;return{_autosaveWorker:null,_range:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this)),this.wutil.getOption("woltlab.autosave").active&&(this.wutil.autosaveEnable(),this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")?this.wutil.setOption("woltlab.autosaveOnce",!0):this.wutil.autosaveRestore()),this.wutil.setOption("autosave",!1);var t=this.core.destroy;this.core.destroy=function(){this.wutil.autosaveDisable(),t.call(this)}.bind(this)},saveSelection:function(t){var e=getSelection();e.rangeCount?this.wutil._range=e.getRangeAt(0):t&&(this.wutil._range=null)},restoreSelection:function(){if(document.activeElement!==this.$editor[0]&&this.$editor.focus(),null!==this.wutil._range){var t=window.getSelection();t.removeAllRanges(),t.addRange(this.wutil._range),this.wutil._range=null}},clearSelection:function(){this.wutil._range=null},getSelection:function(){return this.wutil._range},insertAtCaret:function(t){if(this.opts.visual)return console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode."),!1;this.$textarea.focus();var e=this.$textarea.getCaret();-1==e&&console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.");var i=this.$textarea.val();return i=i.substr(0,e)+t+i.substr(e),this.$textarea.val(i),!0},insertDynamic:function(t,e){this.wutil.inWysiwygMode()?this.insert.html(t,!1):((void 0===e||null===e)&&(e=t),this.wutil.insertAtCaret(e))},setOption:function(t,e){-1!==t.indexOf(".")?(t=t.split(".",2),this.opts[t[0]][t[1]]=e):this.opts[t]=e},getOption:function(t){if(-1!==t.indexOf(".")){if(t=t.split(".",2),this.opts[t[0]][t[1]])return this.opts[t[0]][t[1]]}else if(this.opts[t])return this.opts[t];return null},inPlainMode:function(){return!this.opts.visual},inWysiwygMode:function(){return this.opts.visual},replaceRangesWith:function(t){getSelection().removeAllRanges(),getSelection().addRange(t)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var t=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(t)))}var e=$.trim(this.$textarea.val());return e=this.wutil._removeSuperfluousNewlines(e)},isEmptyEditor:function(){return this.opts.visual?this.utils.isEmpty(this.$editor.html()):!$.trim(this.$textarea.val())},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var t=$.trim(this.wbbcode.convertFromHtml(this.$textarea.val()));t=this.wutil._removeSuperfluousNewlines(t),this.$textarea.val(t)}this.wutil.autosavePurge()},_removeSuperfluousNewlines:function(t){t=t.replace(/(\[\/(?:align|code|quote)\])\n/g,"$1");var e={text:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_removeSuperfluousNewlines",e),e.text},addNewlines:function(t){t=t.replace(/(\[\/(?:align|code|quote)\])/g,"$1\n");var e={text:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_addNewlines",e),e.text},reset:function(){this.opts.visual&&(this.$editor.html("<p>"+this.opts.invisibleSpace+"</p>"),this.wutil.saveSelection()),this.$textarea.val(""),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(t){return this.wutil.getOption("woltlab.autosave").active||this.wutil.setOption("woltlab.autosave",{active:!0,key:t}),null===this.wutil._autosaveWorker&&(this.wutil.autosavePurgeOutdated(),this.wutil._autosaveWorker=new WCF.PeriodicalExecuter(function(){this.wutil.saveTextToStorage(!1)}.bind(this),15e3)),!0},saveTextToStorage:function(e){var s=this.wutil.getText();if(t!=s||e)try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:s,timestamp:Date.now()})),t=s,i=!0,null===n&&(n=new WCF.PeriodicalExecuter(function(t){if(a!==!0){if(i===!1)return t.stop(),void(n=null);this.wutil.autosaveShowNotice("saved"),i=!1}}.bind(this),12e4))}catch(t){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+t.message)}},autosaveDisable:function(){return this.wutil.getOption("woltlab.autosave").active?(this.wutil._autosaveWorker.stop(),this.wutil._autosaveWorker=null,this.wutil.setOption("woltlab.autosave",{active:!1,key:""}),!0):!1},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(t){console.debug("[wutil.autosavePurge] Unable to access local storage: "+t.message)}},autosaveRestore:function(){var t=this.wutil.getOption("woltlab.autosave"),e=null;try{e=localStorage.getItem(t.key)}catch(t){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+t.message)}try{e=null===e?null:JSON.parse(e)}catch(t){e=null}return null!==e&&e.content?t.lastEditTime&&1e3*t.lastEditTime>e.timestamp?(this.wutil.autosavePurge(),!1):t.prompt?(this.wutil.autosaveShowNotice("prompt",e),!1):(this.wutil.inWysiwygMode()?this.wutil.setOption("woltlab.originalValue",e.content):this.$textarea.val(e.content),this.wutil.autosaveShowNotice("restored",{timestamp:e.timestamp}),!0):!1},autosaveShowNotice:function(t,i){if(null===e){e=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>'),e.appendTo(this.$box);var a=function(t){(null===t||"opacity"===t.originalEvent.propertyName)&&(e.hasClass("open")&&null!==t?e.data("callbackOpen")&&e.data("callbackOpen")():(e.data("callbackClose")&&e.data("callbackClose")(),e.removeData("callbackClose"),e.removeData("callbackOpen"),e.removeClass("redactorAutosaveNoticeIcons"),e.empty(),$('<span class="redactorAutosaveMessage" />').appendTo(e)))}.bind(this);e.on("transitionend webkitTransitionEnd",a)}var n="";switch(t){case"prompt":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(i.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.discard")+'"></span>').appendTo(e);s.click(function(){this.wutil.replaceText(i.content),a(null),this.wutil.autosaveShowNotice("restored",i)}.bind(this)),o.click(function(){this.wutil.autosavePurge(),e.removeClass("open")}.bind(this)),n=WCF.Language.get("wcf.message.autosave.prompt"),e.addClass("redactorAutosaveNoticeIcons");var r="";r=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),function(){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),r),setTimeout(function(){e.removeClass("open")},3e3)}.bind(this));break;case"restored":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(i.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').appendTo(e);s.click(function(){e.removeClass("open")}),o.click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),function(t){"confirm"===t&&(this.wutil.reset(),this.wutil.autosavePurge(),e.removeClass("open"))}.bind(this))}.bind(this)),n=WCF.Language.get("wcf.message.autosave.restored"),e.addClass("redactorAutosaveNoticeIcons");var r="";r=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),function(){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),r),setTimeout(function(){s.trigger("click")},3e3)}.bind(this));break;case"saved":if(e.hasClass("open"))return;setTimeout(function(){e.removeClass("open")},2e3),n=WCF.Language.get("wcf.message.autosave.saved")}e.children("span.redactorAutosaveMessage").text(n),e.addClass("open"),"saved"!==t&&WCF.DOMNodeInsertedHandler.execute()},autosavePurgeOutdated:function(){var t=0,e=this.wutil.getOption("woltlab.autosave").prefix,i=e+"_wcf_master";try{t=localStorage.getItem(i)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}if(0!==t){var a=Date.now()-6048e5;if(null===t||a>t){var n=new RegExp("^"+e+"_");for(var s in localStorage)if(s.match(n)&&s!==i){var o=localStorage.getItem(s);try{o=JSON.parse(o)}catch(t){o={timestamp:0}}if(null===o||!o.timestamp||o.timestamp<a)try{localStorage.removeItem(s)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}try{localStorage.setItem(i,Date.now())}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}}},autosavePause:function(){a=!0},autosaveResume:function(){a=!1},buttonReplace:function(t,e,i,a,n){var s=this.buttonGet(t),o=this.buttonAddAfter(t,e,i,a,n);return s.parent().hasClass("separator")&&o.parent().addClass("separator"),s.parent().remove(),o},removeZeroWidthSpace:function(t){for(var e="",i=0,a=t.length;a>i;i++){var n=t.charCodeAt(i).toString(16);"200b"!=n&&(e+=t[i])}return e},getSource:function(){return this.$textarea},getName:function(){return this.$textarea.wcfIdentify()},selectionEndOfEditor:function(){this.focus.setEnd();var t=this.$editor.children(":last")[0];"P"===t.tagName?(""===t.innerHTML&&(t.remove(),t=$(this.opts.emptyHtml).appendTo(this.$editor)[0]),t.lastChild.nodeType===Element.TEXT_NODE?this.caret.set(t.lastChild,t.lastChild.length,t.lastChild,t.lastChild.length):this.caret.setEnd(t)):this.wutil.setCaretAfter(t),this.wutil.saveSelection()},adjustSelectionForBlockElement:function(){document.activeElement!==this.$editor[0]&&this.wutil.restoreSelection();var t=getSelection().getRangeAt(0).startContainer;if(t===this.$editor[0]||this.utils.isRedactorParent(t)||this.wutil.selectionEndOfEditor(),getSelection().getRangeAt(0).collapsed){if(t=getSelection().getRangeAt(0).startContainer,t.nodeType===Node.TEXT_NODE&&"​"===t.textContent&&t.parentElement&&"P"===t.parentElement.tagName&&t.parentElement.parentElement===this.$editor[0])return;var e=t;e!==this.$editor[0]&&(e=$(t).parentsUntil(this.$editor[0]).last()),e[0]===document.body.parentElement?this.wutil.selectionEndOfEditor():this.caret.setAfter(e)}},isCaret:function(){return this.selection.get(),this.range.collapsed},isEndOfElement:function(t){var e=this.selection.implicitRange;if(null===e&&(this.selection.get(),e=this.range),!this.wutil.isCaret())return!1;if(e.endContainer.nodeType===Element.TEXT_NODE&&e.endOffset<e.endContainer.length)return!1;if(!this.wutil.isNodeWithin(e.endContainer,t))return!1;for(var i=e.endContainer;i!==t;){if(i.nextSibling)return!1;i=i.parentNode}return!0},isNodeWithin:function(t,e){for(;t&&t!==this.$editor[0];){if(t===e)return!0;t=t.parentNode}return!1},containsTag:function(t,e){switch(t.nodeType){case Element.ELEMENT_NODE:if(t.tagName===e)return!0;case Element.DOCUMENT_FRAGMENT_NODE:for(var i=0;i<t.childNodes.length;i++)if(this.wutil.containsTag(t.childNodes[i],e))return!0;return!1;default:return!1}},replaceText:function(t){var e=$(document),i=e.scrollTop(),a=!1;this.wutil.inWysiwygMode()&&(this.code.toggle(),a=!0),t=this.wutil.addNewlines(t),this.$textarea.val(t),a&&(this.code.toggle(),e.scrollTop(i)),e.trigger("resize")},setCaretBefore:function(t){this.wutil._setCaret(t,!0)},setCaretAfter:function(t){this.wutil._setCaret(t,!1)},_setCaret:function(t,e){var i;i=$((t[0]||t).parentElement&&"BLOCKQUOTE"===(t[0]||t).parentElement.tagName?"<div>"+this.opts.invisibleSpace+"</div>":"<p>"+this.opts.invisibleSpace+"</p>"),i[e?"insertBefore":"insertAfter"](t),this.caret.setEnd(i[0])},fixDOM:function(){for(var t=this.$editor[0].childNodes[0],e=t,i=null;e;)if(t=e,e=t.nextSibling,t.nodeType===Element.ELEMENT_NODE)this.reIsBlock.test(t.tagName)?i=null:(null===i&&(i=$("<p />").insertBefore(t)),i.append(t));else if(t.nodeType===Element.TEXT_NODE){if(null===i){if(e&&e.nodeType===Element.ELEMENT_NODE&&"P"===e.tagName&&"​"===e.innerHTML){var a=e.nextSibling;this.$editor[0].removeChild(e),e=a}i=$("<p />").insertBefore(t)}i.append(t)}for(var n=this.$editor[0].getElementsByTagName("li"),s=0,o=n.length;o>s;s++){var r=n[s];if(!r.innerHTML.length){var l=r.parentElement;l.children.length>1&&(r.parentElement.removeChild(r),s--,o--)}}for(var s=0,o=this.$editor[0].children.length;o>s;s++){var u=this.$editor[0].children[s];if(u.nodeType===Node.ELEMENT_NODE&&"P"===u.tagName)if("\n"!==u.innerHTML){if(!(u.textContent.length>0||u.children.length>1||1===u.children.length&&"BR"===u.children[0].tagName)){for(;1===u.children.length;)u=u.children[0];if(0===u.childNodes.length&&"BR"!==u.tagName){var c=document.createTextNode("​");u.appendChild(c)}}}else u.parentElement.removeChild(u),s--,o--}for(var d=this.$editor[0].getElementsByTagName("INPUT");d.length;)d[0].parentNode.removeChild(d[0])}}};
+
+// wbutton.js
+if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wbutton=function(){"use strict";return{_bbcodes:{},init:function(){this._bbcodes={};for(var t=0,e=__REDACTOR_BUTTONS.length;e>t;t++)this.wbutton._addBBCodeButton(__REDACTOR_BUTTONS[t]);for(var n={html:"fa-square-o",bold:"fa-bold",italic:"fa-italic",underline:"fa-underline",deleted:"fa-strikethrough",subscript:"fa-subscript",superscript:"fa-superscript",orderedlist:"fa-list-ol",unorderedlist:"fa-list-ul",outdent:"fa-outdent",indent:"fa-indent",link:"fa-link",alignment:"fa-align-left",table:"fa-table"},i={fontcolor:WCF.Language.get("wcf.bbcode.button.fontColor"),fontfamily:WCF.Language.get("wcf.bbcode.button.fontFamily"),fontsize:WCF.Language.get("wcf.bbcode.button.fontSize"),image:WCF.Language.get("wcf.bbcode.button.image"),subscript:WCF.Language.get("wcf.bbcode.button.subscript"),superscript:WCF.Language.get("wcf.bbcode.button.superscript")},a=this.wutil.getOption("buttons"),o="",t=0,e=a.length;e>t;t++){var s=a[t];if("separator"!=s){var r=this.button.get(s);r.length?(n[s]&&this.button.setAwesome(s,n[s]),"table"===s&&o&&r.parent().insertAfter(this.button.get(o).parent())):this.wbutton._addCoreButton(s,i[s]?i[s]:null,n[s]?n[s]:null,o),o=s}else this.button.get(o).parent().addClass("separator")}if(this.button.addCallback(this.button.get("image"),$.proxy(this.wbutton.insertImage,this)),this.utils.isDesktop()){var l=this.button.addAfter("html","undo",WCF.Language.get("wcf.bbcode.button.undo")),u=this.button.addAfter("undo","redo",WCF.Language.get("wcf.bbcode.button.redo"));this.button.addCallback(l,this.buffer.undo),this.button.addCallback(u,this.buffer.redo),u.parent().addClass("separator")}},_addCoreButton:function(t,e,n,i){var a={title:null===e?t:e};("subscript"===t||"superscript"===t)&&(a.command=t);var o=this.button.build(t,a);$("<li />").append(o).insertAfter(this.button.get(i).parent()),null!==n&&this.button.setAwesome(t,n)},_addBBCodeButton:function(t){var e="__wcf_"+t.name,n=this.button.add(e,t.label);this.button.addCallback(n,this.wbutton._insertBBCode),this._bbcodes[e]={name:t.name,voidElement:t.voidElement===!0},t.icon.match(/^fa\-[a-z\-]+$/)?this.button.setAwesome(e,t.icon):n.css("background-image","url("+__REDACTOR_ICON_PATH+t.icon+")")},_insertBBCode:function(t){var e=this._bbcodes[t].name,n={buttonName:t,cancel:!1,redactor:this};if(WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","insertBBCode_"+e+"_"+this.$textarea.wcfIdentify(),n),n.cancel===!1){var i=this.selection.getHtml();i=i.replace(/<p>@@@wcf_empty_line@@@<\/p>/g,"<p><br></p>");if(this.buffer.set(),this.utils.browser("mozilla")&&!i.length){var a=getSelection().getRangeAt(0).startContainer;a.nodeType===Node.ELEMENT_NODE&&"P"===a.tagName&&"<br>"===a.innerHTML&&a.removeChild(a.children[0])}this._bbcodes[t].voidElement?this.insert.html(i+this.selection.getMarkerAsHtml()+"["+e+"]",!1):this.insert.html("["+e+"]"+i+this.selection.getMarkerAsHtml()+"[/"+e+"]",!1),this.selection.restore()}},insertImage:function(){this.image.show()},_insertImage:function(){var t=$("#redactor-image-link-source"),e=t.val().trim();if(e.length){this.buffer.set();var n=$("#redactor-image-align").val(),i="";("left"===n||"right"===n)&&(i=' style="float: '+n+'"'),this.insert.html('<img src="'+e+'"'+i+">",!1),this.modal.close(),this.observe.images()}else t.next("small.innerError")||$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(t)}}};
+// wfontcolor.js
+if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wfontcolor=function(){"use strict";return{init:function(){var o=this.button.addDropdown(this.button.get("fontcolor"));this.wfontcolor._createDropdown(o)},_createDropdown:function(o){for(var F=["#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"],t=$('<li class="redactorColorPallet" />'),r=0,n=F.length;n>r;r++){var e=F[r],l=$('<a href="#" title="'+e+'" />').data("color",e).css("background-color",e);t.append(l),l.click($.proxy(this.wfontcolor._onColorPick,this))}var i=$('<a href="#" />').html(this.lang.get("none")).data("color","none");i.click($.proxy(this.wfontcolor._onColorPick,this)),t.appendTo(o),$('<li class="dropdownDivider" />').appendTo(o),i.appendTo(o),i.wrap("<li />")},_onColorPick:function(o){o.preventDefault();var F=$(o.currentTarget).data("color");"none"===F?this.inline.removeStyleRule("color"):this.inline.format("span","style","color: "+F+";")}}};
+// wfontfamily.js
+if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wfontfamily=function(){"use strict";return{init:function(){var a=this.button.addDropdown(this.button.get("fontfamily"));this.wfontfamily._createDropdown(a)},_createDropdown:function(a){var e={Arial:"Arial, Helvetica, sans-serif","Comic Sans MS":"Comic Sans MS, cursive","Courier New":"Consolas, Courier New, Courier, monospace",Georgia:"Georgia, serif","Lucida Sans Unicode":"Lucida Sans Unicode, Lucida Grande, sans-serif",Tahoma:"Tahoma, Geneva, sans-serif","Times New Roman":"Times New Roman, Times, serif","Trebuchet MS":"Trebuchet MS, Helvetica, sans-serif",Verdana:"Verdana, Geneva, sans-serif"},i=this;$.each(e,function(e,n){var o=$('<li><a href="#">'+e+"</a></li>").appendTo(a),r=o.children("a").data("fontFamily",n).css("font-family",n);r.click(function(a){a.preventDefault(),i.inline.format("span","style","font-family: "+$(this).data("fontFamily")+";")})}),$('<li class="dropdownDivider" />').appendTo(a);var n=$('<li><a href="#">'+this.lang.get("none")+"</a></li>").appendTo(a);n.children("a").click(function(a){a.preventDefault(),i.inline.removeStyleRule("font-family")})}}};
+// 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)}.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?t.previousSibling:null);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.setStartAfter(n),this.selection.implicitRange.setEndAfter(n),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.selectElement=function(e){this.caret.set(e,0,e,1)}.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
+if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wutil=function(){"use strict";var t="",e=null,i=!1,a=!1,n=null;return{_autosaveWorker:null,_range:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this)),this.wutil.getOption("woltlab.autosave").active&&(this.wutil.autosaveEnable(),this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")?this.wutil.setOption("woltlab.autosaveOnce",!0):this.wutil.autosaveRestore()),this.wutil.setOption("autosave",!1);var t=this.core.destroy;this.core.destroy=function(){this.wutil.autosaveDisable(),t.call(this)}.bind(this)},saveSelection:function(t){var e=getSelection();e.rangeCount?this.wutil._range=e.getRangeAt(0):t&&(this.wutil._range=null)},restoreSelection:function(){if(document.activeElement!==this.$editor[0]&&this.$editor.focus(),null!==this.wutil._range){var t=window.getSelection();t.removeAllRanges(),t.addRange(this.wutil._range),this.wutil._range=null}},clearSelection:function(){this.wutil._range=null},getSelection:function(){return this.wutil._range},insertAtCaret:function(t){if(this.opts.visual)return console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode."),!1;this.$textarea.focus();var e=this.$textarea.getCaret();-1==e&&console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.");var i=this.$textarea.val();return i=i.substr(0,e)+t+i.substr(e),this.$textarea.val(i),!0},insertDynamic:function(t,e){this.wutil.inWysiwygMode()?this.insert.html(t,!1):((void 0===e||null===e)&&(e=t),this.wutil.insertAtCaret(e))},setOption:function(t,e){-1!==t.indexOf(".")?(t=t.split(".",2),this.opts[t[0]][t[1]]=e):this.opts[t]=e},getOption:function(t){if(-1!==t.indexOf(".")){if(t=t.split(".",2),this.opts[t[0]][t[1]])return this.opts[t[0]][t[1]]}else if(this.opts[t])return this.opts[t];return null},inPlainMode:function(){return!this.opts.visual},inWysiwygMode:function(){return this.opts.visual},replaceRangesWith:function(t){getSelection().removeAllRanges(),getSelection().addRange(t)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var t=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(t)))}var e=$.trim(this.$textarea.val());return e=this.wutil._removeSuperfluousNewlines(e)},isEmptyEditor:function(){return this.opts.visual?this.utils.isEmpty(this.$editor.html()):!$.trim(this.$textarea.val())},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var t=$.trim(this.wbbcode.convertFromHtml(this.$textarea.val()));t=this.wutil._removeSuperfluousNewlines(t),this.$textarea.val(t)}this.wutil.autosavePurge()},_removeSuperfluousNewlines:function(t){t=t.replace(/(\[\/(?:align|code|quote)\])\n/g,"$1");var e={text:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_removeSuperfluousNewlines",e),e.text},addNewlines:function(t){t=t.replace(/(\[\/(?:align|code|quote)\])/g,"$1\n");var e={text:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_addNewlines",e),e.text},reset:function(){this.opts.visual&&(this.$editor.html("<p>"+this.opts.invisibleSpace+"</p>"),this.wutil.saveSelection()),this.$textarea.val(""),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(t){return this.wutil.getOption("woltlab.autosave").active||this.wutil.setOption("woltlab.autosave",{active:!0,key:t}),null===this.wutil._autosaveWorker&&(this.wutil.autosavePurgeOutdated(),this.wutil._autosaveWorker=new WCF.PeriodicalExecuter(function(){this.wutil.saveTextToStorage(!1)}.bind(this),15e3)),!0},saveTextToStorage:function(e){var s=this.wutil.getText();if(t!=s||e)try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:s,timestamp:Date.now()})),t=s,i=!0,null===n&&(n=new WCF.PeriodicalExecuter(function(t){if(a!==!0){if(i===!1)return t.stop(),void(n=null);this.wutil.autosaveShowNotice("saved"),i=!1}}.bind(this),12e4))}catch(t){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+t.message)}},autosaveDisable:function(){return this.wutil.getOption("woltlab.autosave").active?(this.wutil._autosaveWorker.stop(),this.wutil._autosaveWorker=null,this.wutil.setOption("woltlab.autosave",{active:!1,key:""}),!0):!1},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(t){console.debug("[wutil.autosavePurge] Unable to access local storage: "+t.message)}},autosaveRestore:function(){var t=this.wutil.getOption("woltlab.autosave"),e=null;try{e=localStorage.getItem(t.key)}catch(t){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+t.message)}try{e=null===e?null:JSON.parse(e)}catch(t){e=null}return null!==e&&e.content?t.lastEditTime&&1e3*t.lastEditTime>e.timestamp?(this.wutil.autosavePurge(),!1):t.prompt?(this.wutil.autosaveShowNotice("prompt",e),!1):(this.wutil.inWysiwygMode()?this.wutil.setOption("woltlab.originalValue",e.content):this.$textarea.val(e.content),this.wutil.autosaveShowNotice("restored",{timestamp:e.timestamp}),!0):!1},autosaveShowNotice:function(t,i){if(null===e){e=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>'),e.appendTo(this.$box);var a=function(t){(null===t||"opacity"===t.originalEvent.propertyName)&&(e.hasClass("open")&&null!==t?e.data("callbackOpen")&&e.data("callbackOpen")():(e.data("callbackClose")&&e.data("callbackClose")(),e.removeData("callbackClose"),e.removeData("callbackOpen"),e.removeClass("redactorAutosaveNoticeIcons"),e.empty(),$('<span class="redactorAutosaveMessage" />').appendTo(e)))}.bind(this);e.on("transitionend webkitTransitionEnd",a)}var n="";switch(t){case"prompt":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(i.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.discard")+'"></span>').appendTo(e);s.click(function(){this.wutil.replaceText(i.content),a(null),this.wutil.autosaveShowNotice("restored",i)}.bind(this)),o.click(function(){this.wutil.autosavePurge(),e.removeClass("open")}.bind(this)),n=WCF.Language.get("wcf.message.autosave.prompt"),e.addClass("redactorAutosaveNoticeIcons");var r="";r=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),function(){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),r),setTimeout(function(){e.removeClass("open")},3e3)}.bind(this));break;case"restored":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(i.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').appendTo(e);s.click(function(){e.removeClass("open")}),o.click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),function(t){"confirm"===t&&(this.wutil.reset(),this.wutil.autosavePurge(),e.removeClass("open"))}.bind(this))}.bind(this)),n=WCF.Language.get("wcf.message.autosave.restored"),e.addClass("redactorAutosaveNoticeIcons");var r="";r=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),function(){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),r),setTimeout(function(){s.trigger("click")},3e3)}.bind(this));break;case"saved":if(e.hasClass("open"))return;setTimeout(function(){e.removeClass("open")},2e3),n=WCF.Language.get("wcf.message.autosave.saved")}e.children("span.redactorAutosaveMessage").text(n),e.addClass("open"),"saved"!==t&&WCF.DOMNodeInsertedHandler.execute()},autosavePurgeOutdated:function(){var t=0,e=this.wutil.getOption("woltlab.autosave").prefix,i=e+"_wcf_master";try{t=localStorage.getItem(i)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}if(0!==t){var a=Date.now()-6048e5;if(null===t||a>t){var n=new RegExp("^"+e+"_");for(var s in localStorage)if(s.match(n)&&s!==i){var o=localStorage.getItem(s);try{o=JSON.parse(o)}catch(t){o={timestamp:0}}if(null===o||!o.timestamp||o.timestamp<a)try{localStorage.removeItem(s)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}try{localStorage.setItem(i,Date.now())}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}}},autosavePause:function(){a=!0},autosaveResume:function(){a=!1},buttonReplace:function(t,e,i,a,n){var s=this.buttonGet(t),o=this.buttonAddAfter(t,e,i,a,n);return s.parent().hasClass("separator")&&o.parent().addClass("separator"),s.parent().remove(),o},removeZeroWidthSpace:function(t){for(var e="",i=0,a=t.length;a>i;i++){var n=t.charCodeAt(i).toString(16);"200b"!=n&&(e+=t[i])}return e},getSource:function(){return this.$textarea},getName:function(){return this.$textarea.wcfIdentify()},selectionEndOfEditor:function(){this.focus.setEnd();var t=this.$editor.children(":last")[0];"P"===t.tagName?(""===t.innerHTML&&(t.remove(),t=$(this.opts.emptyHtml).appendTo(this.$editor)[0]),t.lastChild.nodeType===Element.TEXT_NODE?this.caret.set(t.lastChild,t.lastChild.length,t.lastChild,t.lastChild.length):this.caret.setEnd(t)):this.wutil.setCaretAfter(t),this.wutil.saveSelection()},adjustSelectionForBlockElement:function(){document.activeElement!==this.$editor[0]&&this.wutil.restoreSelection();var t=getSelection().getRangeAt(0).startContainer;if(t===this.$editor[0]||this.utils.isRedactorParent(t)||this.wutil.selectionEndOfEditor(),getSelection().getRangeAt(0).collapsed){if(t=getSelection().getRangeAt(0).startContainer,t.nodeType===Node.TEXT_NODE&&"​"===t.textContent&&t.parentElement&&"P"===t.parentElement.tagName&&t.parentElement.parentElement===this.$editor[0])return;var e=t;e!==this.$editor[0]&&(e=$(t).parentsUntil(this.$editor[0]).last()),e[0]===document.body.parentElement?this.wutil.selectionEndOfEditor():this.caret.setAfter(e)}},isCaret:function(){return this.selection.get(),this.range.collapsed},isEndOfElement:function(t){var e=this.selection.implicitRange;if(null===e&&(this.selection.get(),e=this.range),!this.wutil.isCaret())return!1;if(e.endContainer.nodeType===Element.TEXT_NODE&&e.endOffset<e.endContainer.length)return!1;if(!this.wutil.isNodeWithin(e.endContainer,t))return!1;for(var i=e.endContainer;i!==t;){if(i.nextSibling)return!1;i=i.parentNode}return!0},isNodeWithin:function(t,e){for(;t&&t!==this.$editor[0];){if(t===e)return!0;t=t.parentNode}return!1},containsTag:function(t,e){switch(t.nodeType){case Element.ELEMENT_NODE:if(t.tagName===e)return!0;case Element.DOCUMENT_FRAGMENT_NODE:for(var i=0;i<t.childNodes.length;i++)if(this.wutil.containsTag(t.childNodes[i],e))return!0;return!1;default:return!1}},replaceText:function(t){var e=$(document),i=e.scrollTop(),a=!1;this.wutil.inWysiwygMode()&&(this.code.toggle(),a=!0),t=this.wutil.addNewlines(t),this.$textarea.val(t),a&&(this.code.toggle(),e.scrollTop(i)),e.trigger("resize")},setCaretBefore:function(t){this.wutil._setCaret(t,!0)},setCaretAfter:function(t){this.wutil._setCaret(t,!1)},_setCaret:function(t,e){var i;i=$((t[0]||t).parentElement&&"BLOCKQUOTE"===(t[0]||t).parentElement.tagName?"<div>"+this.opts.invisibleSpace+"</div>":"<p>"+this.opts.invisibleSpace+"</p>"),i[e?"insertBefore":"insertAfter"](t),this.caret.setEnd(i[0])},fixDOM:function(){for(var t=this.$editor[0].childNodes[0],e=t,i=null;e;)if(t=e,e=t.nextSibling,t.nodeType===Element.ELEMENT_NODE)this.reIsBlock.test(t.tagName)?i=null:(null===i&&(i=$("<p />").insertBefore(t)),i.append(t));else if(t.nodeType===Element.TEXT_NODE){if(null===i){if(e&&e.nodeType===Element.ELEMENT_NODE&&"P"===e.tagName&&"​"===e.innerHTML){var a=e.nextSibling;this.$editor[0].removeChild(e),e=a}i=$("<p />").insertBefore(t)}i.append(t)}for(var n=this.$editor[0].getElementsByTagName("li"),s=0,o=n.length;o>s;s++){var r=n[s];if(!r.innerHTML.length){var l=r.parentElement;l.children.length>1&&(r.parentElement.removeChild(r),s--,o--)}}for(var s=0,o=this.$editor[0].children.length;o>s;s++){var u=this.$editor[0].children[s];if(u.nodeType===Node.ELEMENT_NODE&&"P"===u.tagName)if("\n"!==u.innerHTML){if(!(u.textContent.length>0||u.children.length>1||1===u.children.length&&"BR"===u.children[0].tagName)){for(;1===u.children.length;)u=u.children[0];if(0===u.childNodes.length&&"BR"!==u.tagName){var c=document.createTextNode("​");u.appendChild(c)}}}else u.parentElement.removeChild(u),s--,o--}for(var d=this.$editor[0].getElementsByTagName("INPUT");d.length;)d[0].parentNode.removeChild(d[0])}}};