From: woltlab.com Date: Wed, 8 Jul 2015 15:27:16 +0000 (+0200) Subject: Updating minified JavaScript files X-Git-Tag: 3.0.0_Beta_1~2203^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea68cc7993510c88379a87b0912c6d9768836275;p=GitHub%2FWoltLab%2FWCF.git Updating minified JavaScript files --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js index eba48b626a..82da12c6ce 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js @@ -1,6 +1,9 @@ // table.js if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.table=function(){return{getTemplate:function(){return String()+'
'},init:function(){var t={};t.insert_table={title:this.lang.get("insert_table"),func:this.table.show},t.insert_row_above={title:this.lang.get("insert_row_above"),func:this.table.addRowAbove},t.insert_row_below={title:this.lang.get("insert_row_below"),func:this.table.addRowBelow},t.insert_column_left={title:this.lang.get("insert_column_left"),func:this.table.addColumnLeft},t.insert_column_right={title:this.lang.get("insert_column_right"),func:this.table.addColumnRight},t.add_head={title:this.lang.get("add_head"),func:this.table.addHead},t.delete_head={title:this.lang.get("delete_head"),func:this.table.deleteHead},t.delete_column={title:this.lang.get("delete_column"),func:this.table.deleteColumn},t.delete_row={title:this.lang.get("delete_row"),func:this.table.deleteRow},t.delete_table={title:this.lang.get("delete_table"),func:this.table.deleteTable},this.observe.addButton("td","table"),this.observe.addButton("th","table");var e=this.button.addBefore("link","table",this.lang.get("table"));this.button.addDropdown(e,t)},show:function(){this.modal.addTemplate("table",this.table.getTemplate()),this.modal.load("table",this.lang.get("insert_table"),300),this.modal.createCancelButton();var t=this.modal.createActionButton(this.lang.get("insert"));t.on("click",this.table.insert),this.selection.save(),this.modal.show(),$("#redactor-table-rows").focus()},insert:function(){var t,e,i,a,s=$("#redactor-table-rows").val(),l=$("#redactor-table-columns").val(),n=$("
"),r=Math.floor(99999*Math.random()),o=$('
');for(t=0;s>t;t++){for(e=$(""),i=0;l>i;i++)a=$(""+this.opts.invisibleSpace+""),0===t&&0===i&&a.append(this.selection.getMarker()),$(e).append(a);o.append(e)}n.append(o);var d=n.html();if(this.modal.close(),this.selection.restore(),!this.table.getTable()){this.buffer.set();var h=this.selection.getBlock()||this.selection.getCurrent();h&&"BODY"!=h.tagName?("LI"==h.tagName&&(h=$(h).closest("ul, ol")),$(h).after(d)):this.insert.html(d),this.selection.restore();var c=this.$editor.find("#table"+r);if(!this.opts.linebreaks&&(this.utils.browser("mozilla")||this.utils.browser("msie"))){var b=c.next();0===b.length&&c.after(this.opts.emptyHtml)}this.observe.buttons(),c.find("span.redactor-selection-marker").remove(),c.removeAttr("id"),this.code.sync(),this.core.setCallback("insertedTable",c)}},getTable:function(){var t=$(this.selection.getParent()).closest("table");return this.utils.isRedactorParent(t)?0===t.size()?!1:t:!1},restoreAfterDelete:function(t){this.selection.restore(),t.find("span.redactor-selection-marker").remove(),this.code.sync()},deleteTable:function(){var t=this.table.getTable();if(t){this.buffer.set();var e=t.next();this.opts.linebreaks||0===e.length?this.caret.setAfter(t):this.caret.setStart(e),t.remove(),this.code.sync()}},deleteRow:function(){var t=this.table.getTable();if(t){var e=$(this.selection.getCurrent());this.buffer.set();var i=e.closest("tr"),a=i.prev().length?i.prev():i.next();if(a.length){var s=a.children("td, th").first();s.length&&s.prepend(this.selection.getMarker())}i.remove(),this.table.restoreAfterDelete(t)}},deleteColumn:function(){var t=this.table.getTable();if(t){this.buffer.set();var e=$(this.selection.getCurrent()),i=e.closest("td, th"),a=i[0].cellIndex;t.find("tr").each($.proxy(function(t,e){var i=$(e),s=0>a-1?a+1:a-1;0===t&&i.find("td, th").eq(s).prepend(this.selection.getMarker()),i.find("td, th").eq(a).remove()},this)),this.table.restoreAfterDelete(t)}},addHead:function(){var t=this.table.getTable();if(t){if(this.buffer.set(),0!==t.find("thead").size())return void this.table.deleteHead();var e=t.find("tr").first().clone();e.find("td").html(this.opts.invisibleSpace),$thead=$("").append(e),t.prepend($thead),this.code.sync()}},deleteHead:function(){var t=this.table.getTable();if(t){var e=t.find("thead");0!==e.size()&&(this.buffer.set(),e.remove(),this.code.sync())}},addRowAbove:function(){this.table.addRow("before")},addRowBelow:function(){this.table.addRow("after")},addColumnLeft:function(){this.table.addColumn("before")},addColumnRight:function(){this.table.addColumn("after")},addRow:function(t){var e=this.table.getTable();if(e){this.buffer.set();var i=$(this.selection.getCurrent()),a=i.closest("tr"),s=a.clone();s.find("th").replaceWith(function(){var t=$("");return t[0].attributes=this.attributes,t.append($(this).contents())}),s.find("td").html(this.opts.invisibleSpace),"after"==t?a.after(s):a.before(s),this.code.sync()}},addColumn:function(t){var e=this.table.getTable();if(e){var i=0,a=$(this.selection.getCurrent());this.buffer.set();var s=a.closest("tr"),l=a.closest("td, th");s.find("td, th").each($.proxy(function(t,e){$(e)[0]===l[0]&&(i=t)},this)),e.find("tr").each($.proxy(function(e,a){var s=$(a).find("td, th").eq(i),l=s.clone();l.html(this.opts.invisibleSpace),"after"==t?s.after(l):s.before(l)},this)),this.code.sync()}}}}; +// wautosave.js +if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wautosave=function(){"use strict";var e=!1,t="",a=null,s=null,o=!1,i=null,n=null;return{init:function(){i=this.$textarea[0],this.wutil.getOption("woltlab.autosave").active&&(this.wautosave.enable(),this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")?this.wutil.setOption("woltlab.autosaveOnce",!0):this.wautosave.restore()),this.wutil.setOption("autosave",!1);var e=this.core.destroy;this.core.destroy=function(){this.wautosave.disable(),e.call(this)}.bind(this)},enable:function(e){this.wutil.getOption("woltlab.autosave").active||this.wutil.setOption("woltlab.autosave",{active:!0,key:e}),null===n&&(this.wautosave.purgeOutdated(),n=new WCF.PeriodicalExecuter(this.wautosave.save.bind(this),15e3))},save:function(a){a!==!0&&(a=!1);var i=this.wutil.getText();if(t!==i||a)try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:i,timestamp:Date.now()})),t=i,e=!0,null===s&&(s=new WCF.PeriodicalExecuter(function(t){if(o!==!0){if(e===!1)return t.stop(),void(s=null);this.wautosave.showNotice("saved"),e=!1}}.bind(this),12e4))}catch(e){console.debug("[wautosave.save] Unable to access local storage: "+e.message)}},disable:function(){this.wutil.getOption("woltlab.autosave").active&&(n.stop(),n=null,this.wutil.setOption("woltlab.autosave",{active:!1,key:""}))},purge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(e){console.debug("[wautosave.purge] Unable to access local storage: "+e.message)}},restore:function(){var e=this.wutil.getOption("woltlab.autosave"),t=null;try{t=localStorage.getItem(e.key)}catch(e){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+e.message)}try{null!==t&&(t=JSON.parse(t))}catch(e){t=null}return null!==t&&t.content?e.lastEditTime&&1e3*e.lastEditTime>t.timestamp?(this.wautosave.purge(),!1):e.prompt?(this.autosave.showNotice("prompt",t),!1):(this.wutil.inWysiwygMode()?this.wutil.setOption("woltlab.originalValue",t.content):i.value=t.content,this.wautosave.showNotice("restored",{timestamp:t.timestamp}),!0):!1},showNotice:function(e,t){if(null===a){a=$('
'),a.appendTo(this.$box);var s=function(e){(null===e||"opacity"===e.originalEvent.propertyName)&&(a.hasClass("open")&&null!==e?a.data("callbackOpen")&&a.data("callbackOpen")():(a.data("callbackClose")&&a.data("callbackClose")(),a.removeData("callbackClose"),a.removeData("callbackOpen"),a.removeClass("redactorAutosaveNoticeIcons"),a.empty(),$('').appendTo(a)))}.bind(this);a.on("transitionend webkitTransitionEnd",s)}var o="",n="";switch(e){case"prompt":$('').prependTo(a);var l=$('').appendTo(a),c=$('').appendTo(a);l.click(function(){this.wutil.replaceText(t.content),s(null),this.wautosave.showNotice("restored",t)}.bind(this)),c.click(function(){this.wautosave.purge(),a.removeClass("open")}.bind(this)),o=WCF.Language.get("wcf.message.autosave.prompt"),a.addClass("redactorAutosaveNoticeIcons"),n=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+i.id,function(e){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+i.id,n),setTimeout(function(){a.removeClass("open")},3e3)}.bind(this));break;case"restored":$('').prependTo(a);var l=$('').appendTo(a),c=$('').appendTo(a);l.click(function(){a.removeClass("open")}),c.click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),function(e){"confirm"===e&&(this.wutil.reset(),this.wautosave.purge(),a.removeClass("open"))}.bind(this))}.bind(this)),o=WCF.Language.get("wcf.message.autosave.restored"),a.addClass("redactorAutosaveNoticeIcons"),n=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+i.id,function(e){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+i.id,n),setTimeout(function(){l.trigger("click")},3e3)}.bind(this));break;case"saved":if(a.hasClass("open"))return;setTimeout(function(){a.removeClass("open")},2e3),o=WCF.Language.get("wcf.message.autosave.saved")}a.children("span.redactorAutosaveMessage").text(o),a.addClass("open"),"saved"!==e&&WCF.DOMNodeInsertedHandler.execute()},purgeOutdated:function(){var e=0,t=this.wutil.getOption("woltlab.autosave").prefix,a=t+"_wcf_master";try{e=localStorage.getItem(a)}catch(e){console.debug("[wautosave.purgeOutdated] Unable to access local storage: "+e.message)}if(0!==e){var s,o=Date.now()-6048e5;if(null===e||o>e){var i=new RegExp("^"+t+"_");for(var n in localStorage)if(n.match(i)&&n!==a){s=localStorage.getItem(n);try{s=JSON.parse(s)}catch(e){s={timestamp:0}}if(null===s||!s.timestamp||s.timestamp]+)?><\/p>/g,"

@@@wcf_empty_line@@@

"),t=i.call(this,t),t=t.replace(/__wcf_zwnj__/g,"‌"),t.replace(/__wcf_zwj__/g,"‍")}.bind(this),this.wutil.getOption("woltlab.autosaveOnce")&&(this.wutil.saveTextToStorage(),delete this.opts.woltlab.autosaveOnce);var a=this.button.get("table");if(a.length){var o=a.data("dropdown");o.find(".redactor-dropdown-add_head").parent().remove(),o.find(".redactor-dropdown-delete_head").parent().remove(),$('";c.append($(h)),this.modal.close()},this))}},fixBlockLevelElements:function(){return},fixFormatting:function(e){for(var t=function(e){e.style.removeProperty("text-align");for(var i=0;i'+WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")+"
").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(t){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')},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 e="",t=null,a=!1,i=!1,o=null,n=null,s=null,r=null;return{_autosaveWorker:null,init:function(){n=this.$editor[0],r=this.$textarea[0],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 e=this.core.destroy;this.core.destroy=function(){this.wutil.autosaveDisable(),e.call(this)}.bind(this)},saveSelection:function(e){var t=window.getSelection();t.rangeCount?s=t.getRangeAt(0):e&&(s=null)},restoreSelection:function(){if(document.activeElement!==n&&n.focus(),null!==s){var e=window.getSelection();e.removeAllRanges(),e.addRange(s),s=null}},clearSelection:function(){s=null},getSelection:function(){return s},insertAtCaret:function(e){if(this.opts.visual)return console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode."),!1;r.focus();var t=this.$textarea.getCaret();-1==t&&console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.");var a=r.value;return a=a.substr(0,t)+e+a.substr(t),r.value=a,!0},insertDynamic:function(e,t){this.wutil.inWysiwygMode()?this.insert.html(e,!1):((void 0===t||null===t)&&(t=e),this.wutil.insertAtCaret(t))},setOption:function(e,t){-1!==e.indexOf(".")?(e=e.split(".",2),this.opts[e[0]][e[1]]=t):this.opts[e]=t},getOption:function(e){if(-1!==e.indexOf(".")){if(e=e.split(".",2),this.opts[e[0]][e[1]])return this.opts[e[0]][e[1]]}else if(this.opts[e])return this.opts[e];return null},inPlainMode:function(){return!this.opts.visual},inWysiwygMode:function(){return this.opts.visual},replaceRangesWith:function(e){getSelection().removeAllRanges(),getSelection().addRange(e)},getText:function(){return this.wutil.inWysiwygMode()&&(this.code.startSync(),r.value=this.wbbcode.convertFromHtml(r.value).trim()),r.value.trim()},isEmptyEditor:function(){return this.opts.visual?this.utils.isEmpty(n.innerHTML):""===r.value.trim()},submit:function(){this.wutil.inWysiwygMode()&&(this.code.startSync(),r=this.wbbcode.convertFromHtml(r.value).trim()),this.wutil.autosavePurge()},reset:function(){this.opts.visual&&(n.innerHTML="",this.wutil.saveSelection()),r.value="",WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:r.id})},autosaveEnable:function(e){return this.wutil.getOption("woltlab.autosave").active||this.wutil.setOption("woltlab.autosave",{active:!0,key:e}),null===this.wutil._autosaveWorker&&(this.wutil.autosavePurgeOutdated(),this.wutil._autosaveWorker=new WCF.PeriodicalExecuter(function(e){this.wutil.saveTextToStorage(!1)}.bind(this),15e3)),!0},saveTextToStorage:function(t){var n=this.wutil.getText();if(e!=n||t)try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:n,timestamp:Date.now()})),e=n,a=!0,null===o&&(o=new WCF.PeriodicalExecuter(function(e){if(i!==!0){if(a===!1)return e.stop(),void(o=null);this.wutil.autosaveShowNotice("saved"),a=!1}}.bind(this),12e4))}catch(e){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+e.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(e){console.debug("[wutil.autosavePurge] Unable to access local storage: "+e.message)}},autosaveRestore:function(){var e=this.wutil.getOption("woltlab.autosave"),t=null;try{t=localStorage.getItem(e.key)}catch(e){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+e.message)}try{t=null===t?null:JSON.parse(t)}catch(e){t=null}return null!==t&&t.content?e.lastEditTime&&1e3*e.lastEditTime>t.timestamp?(this.wutil.autosavePurge(),!1):e.prompt?(this.wutil.autosaveShowNotice("prompt",t),!1):(this.wutil.inWysiwygMode()?this.wutil.setOption("woltlab.originalValue",t.content):r.value=t.content,this.wutil.autosaveShowNotice("restored",{timestamp:t.timestamp}),!0):!1},autosaveShowNotice:function(e,a){if(null===t){t=$('
'),t.appendTo(this.$box);var i=function(e){(null===e||"opacity"===e.originalEvent.propertyName)&&(t.hasClass("open")&&null!==e?t.data("callbackOpen")&&t.data("callbackOpen")():(t.data("callbackClose")&&t.data("callbackClose")(),t.removeData("callbackClose"),t.removeData("callbackOpen"),t.removeClass("redactorAutosaveNoticeIcons"),t.empty(),$('').appendTo(t)))}.bind(this);t.on("transitionend webkitTransitionEnd",i)}var o="";switch(e){case"prompt":$('').prependTo(t);var n=$('').appendTo(t),s=$('').appendTo(t);n.click(function(){this.wutil.replaceText(a.content),i(null),this.wutil.autosaveShowNotice("restored",a)}.bind(this)),s.click(function(){this.wutil.autosavePurge(),t.removeClass("open")}.bind(this)),o=WCF.Language.get("wcf.message.autosave.prompt"),t.addClass("redactorAutosaveNoticeIcons");var l="";l=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+r.id,function(e){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+r.id,l),setTimeout(function(){t.removeClass("open")},3e3)}.bind(this));break;case"restored":$('').prependTo(t);var n=$('').appendTo(t),s=$('').appendTo(t);n.click(function(){t.removeClass("open")}),s.click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),function(e){"confirm"===e&&(this.wutil.reset(),this.wutil.autosavePurge(),t.removeClass("open"))}.bind(this))}.bind(this)),o=WCF.Language.get("wcf.message.autosave.restored"),t.addClass("redactorAutosaveNoticeIcons");var l="";l=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+r.id,function(e){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+r.id,l),setTimeout(function(){n.trigger("click")},3e3)}.bind(this));break;case"saved":if(t.hasClass("open"))return;setTimeout(function(){t.removeClass("open")},2e3),o=WCF.Language.get("wcf.message.autosave.saved")}t.children("span.redactorAutosaveMessage").text(o),t.addClass("open"),"saved"!==e&&WCF.DOMNodeInsertedHandler.execute()},autosavePurgeOutdated:function(){var e=0,t=this.wutil.getOption("woltlab.autosave").prefix,a=t+"_wcf_master";try{e=localStorage.getItem(a)}catch(e){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+e.message)}if(0!==e){var i=Date.now()-6048e5;if(null===e||i>e){var o=new RegExp("^"+t+"_");for(var n in localStorage)if(n.match(o)&&n!==a){var s=localStorage.getItem(n);try{s=JSON.parse(s)}catch(e){s={timestamp:0}}if(null===s||!s.timestamp||s.timestampa;a++)if(this.wutil.containsTag(e.childNodes[a],t))return!0;return!1},replaceText:function(e){var t=$(document),a=t.scrollTop(),i=!1;this.wutil.inWysiwygMode()&&(this.code.toggle(),i=!0),r.value=e,i&&(this.code.toggle(),t.scrollTop(a)),t.trigger("resize")},setCaretBefore:function(e){this.wutil._setCaret(e,!0)},setCaretAfter:function(e){this.wutil._setCaret(e,!1)},_setCaret:function(e,t){var a;a=(e[0]||e).parentElement&&"BLOCKQUOTE"===(e[0]||e).parentElement.tagName?$("
"+this.opts.invisibleSpace+"
"):$("

"+this.opts.invisibleSpace+"

"),a[t?"insertBefore":"insertAfter"](e),this.caret.setEnd(a[0])},fixDOM:function(){for(var e,t,a=n.querySelectorAll("li"),i=0,o=a.length;o>i;i++)e=a[0],""===e.innerHTML&&(t=e.parentNode,t.childElementCount>1&&t.removeChild(e));for(var s=n.getElementsByTagName("INPUT");s.length;)s[0].parentNode.removeChild(s[0])}}}; +if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wutil=function(){"use strict";var t=null,e=null,n=null;return{_autosaveWorker:null,init:function(){t=this.$editor[0],n=this.$textarea[0],this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this))},saveSelection:function(t){var n=window.getSelection();n.rangeCount?e=n.getRangeAt(0):t&&(e=null)},restoreSelection:function(){if(document.activeElement!==t&&t.focus(),null!==e){var n=window.getSelection();n.removeAllRanges(),n.addRange(e),e=null}},clearSelection:function(){e=null},getSelection:function(){return e},insertAtCaret:function(t){if(this.opts.visual)return console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode."),!1;n.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=n.value;return i=i.substr(0,e)+t+i.substr(e),n.value=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(){return this.wutil.inWysiwygMode()&&(this.code.startSync(),n.value=this.wbbcode.convertFromHtml(n.value).trim()),n.value.trim()},isEmptyEditor:function(){return this.opts.visual?this.utils.isEmpty(t.innerHTML):""===n.value.trim()},submit:function(){this.wutil.inWysiwygMode()&&(this.code.startSync(),n=this.wbbcode.convertFromHtml(n.value).trim()),this.wautosave.purge()},reset:function(){this.opts.visual&&(t.innerHTML="",this.wutil.saveSelection()),n.value="",WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:n.id})},autosaveEnable:function(t){this.wautosave.enable(t)},saveTextToStorage:function(t){this.wautosave.save(t)},autosaveDisable:function(){return this.wautosave.disable()},autosavePurge:function(){this.wautosave.purge()},autosaveRestore:function(){return this.wautosave.restore()},autosaveShowNotice:function(t,e){this.wautosave.showNotice(t,e)},autosavePurgeOutdated:function(){this.wautosave.purgeOutdated()},autosavePause:function(){this.wautosave.pause()},autosaveResume:function(){this.wautosave.resume()},buttonReplace:function(t,e,n,i,o){var r=this.buttonGet(t),s=this.buttonAddAfter(t,e,n,i,o);return r.parent().hasClass("separator")&&s.parent().addClass("separator"),r.parent().remove(),s},removeZeroWidthSpace:function(t){return t.replace(/\u200b/g,"")},getSource:function(){return this.$textarea},getName:function(){return n.id},selectionEndOfEditor:function(){var e=t.lastElementChild;if(null===e||"BLOCKQUOTE"===e.nodeName||"DIV"===e.nodeName&&e.classList.contains("codeBox")||"KBD"===e.nodeName){var n=this.utils.createSpaceElement();t.appendChild(n),this.caret.setEnd(n),this.wutil.saveSelection()}else this.focus.setEnd()},adjustSelectionForBlockElement:function(){if(document.activeElement!==t&&this.wutil.restoreSelection(),window.getSelection().rangeCount){var e=window.getSelection().getRangeAt(0);if(e.collapsed){var n=e.startContainer;if(n.nodeType===Node.TEXT_NODE&&n.parentNode&&n.parentNode.parentNode===t)return;for(;n&&n!==t;)n=n.parentNode;n.parentNode===t?this.caret.setAfter(n):this.wutil.selectionEndOfEditor()}}},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===Node.TEXT_NODE&&e.endOffsetn;n++)if(this.wutil.containsTag(t.childNodes[n],e))return!0;return!1},replaceText:function(t){var e=$(document),i=e.scrollTop(),o=!1;this.wutil.inWysiwygMode()&&(this.code.toggle(),o=!0),n.value=t,o&&(this.code.toggle(),e.scrollTop(i)),e.trigger("resize")},setCaretBefore:function(t){this.caret.setBefore(t)},setCaretAfter:function(t){this.caret.setAfter(t)},_setCaret:function(t,e){this.caret[e?"setBefore":"setAfter"](t)},fixDOM:function(){for(var e,n=t.querySelectorAll("li:empty"),i=0,o=n.length;o>i;i++)e=n[i].parentNode,e.childElementCount>1&&e.removeChild(n[i]);for(n=t.getElementsByTagName("INPUT");n.length;)n[0].parentNode.removeChild(n[0])}}};