From: woltlab.com Date: Sat, 20 Jun 2015 14:31:51 +0000 (+0200) Subject: Updating minified JavaScript files X-Git-Tag: 2.1.5~17^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=aa330feac12e957e0dacbb59071d387093bf0217;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 dc77d62be0..7d5279f2a3 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js @@ -1,7 +1,7 @@ // table.js if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.table=function(){return{getTemplate:function(){return String()+'
'},init:function(){var b={};b.insert_table={title:this.lang.get("insert_table"),func:this.table.show};b.insert_row_above={title:this.lang.get("insert_row_above"),func:this.table.addRowAbove};b.insert_row_below={title:this.lang.get("insert_row_below"),func:this.table.addRowBelow};b.insert_column_left={title:this.lang.get("insert_column_left"),func:this.table.addColumnLeft};b.insert_column_right={title:this.lang.get("insert_column_right"),func:this.table.addColumnRight};b.add_head={title:this.lang.get("add_head"),func:this.table.addHead};b.delete_head={title:this.lang.get("delete_head"),func:this.table.deleteHead};b.delete_column={title:this.lang.get("delete_column"),func:this.table.deleteColumn};b.delete_row={title:this.lang.get("delete_row"),func:this.table.deleteRow};b.delete_table={title:this.lang.get("delete_table"),func:this.table.deleteTable};this.observe.addButton("td","table");this.observe.addButton("th","table");var a=this.button.addBefore("link","table",this.lang.get("table"));this.button.addDropdown(a,b)},show:function(){this.modal.addTemplate("table",this.table.getTemplate());this.modal.load("table",this.lang.get("insert_table"),300);this.modal.createCancelButton();var a=this.modal.createActionButton(this.lang.get("insert"));a.on("click",this.table.insert);this.selection.save();this.modal.show();$("#redactor-table-rows").focus()},insert:function(){var n=$("#redactor-table-rows").val(),c=$("#redactor-table-columns").val(),a=$("
"),b=Math.floor(Math.random()*99999),l=$('
'),e,h,j,k;for(e=0;e");for(j=0;j"+this.opts.invisibleSpace+"");if(e===0&&j===0){k.append(this.selection.getMarker())}$(h).append(k)}l.append(h)}a.append(l);var f=a.html();this.modal.close();this.selection.restore();if(this.table.getTable()){return}this.buffer.set();var g=this.selection.getBlock()||this.selection.getCurrent();if(g&&g.tagName!="BODY"){if(g.tagName=="LI"){g=$(g).closest("ul, ol")}$(g).after(f)}else{this.insert.html(f)}this.selection.restore();var m=this.$editor.find("#table"+b);if(!this.opts.linebreaks&&(this.utils.browser("mozilla")||this.utils.browser("msie"))){var d=m.next();if(d.length===0){m.after(this.opts.emptyHtml)}}this.observe.buttons();m.find("span.redactor-selection-marker").remove();m.removeAttr("id");this.code.sync();this.core.setCallback("insertedTable",m)},getTable:function(){var a=$(this.selection.getParent()).closest("table");if(!this.utils.isRedactorParent(a)){return false}if(a.size()===0){return false}return a},restoreAfterDelete:function(a){this.selection.restore();a.find("span.redactor-selection-marker").remove();this.code.sync()},deleteTable:function(){var b=this.table.getTable();if(!b){return}this.buffer.set();var a=b.next();if(!this.opts.linebreaks&&a.length!==0){this.caret.setStart(a)}else{this.caret.setAfter(b)}b.remove();this.code.sync()},deleteRow:function(){var a=this.table.getTable();if(!a){return}var c=$(this.selection.getCurrent());this.buffer.set();var e=c.closest("tr");var b=e.prev().length?e.prev():e.next();if(b.length){var d=b.children("td, th").first();if(d.length){d.prepend(this.selection.getMarker())}}e.remove();this.table.restoreAfterDelete(a)},deleteColumn:function(){var c=this.table.getTable();if(!c){return}this.buffer.set();var d=$(this.selection.getCurrent());var a=d.closest("td, th");var b=a[0].cellIndex;c.find("tr").each($.proxy(function(f,g){var e=$(g);var h=b-1<0?b+1:b-1;if(f===0){e.find("td, th").eq(h).prepend(this.selection.getMarker())}e.find("td, th").eq(b).remove()},this));this.table.restoreAfterDelete(c)},addHead:function(){var a=this.table.getTable();if(!a){return}this.buffer.set();if(a.find("thead").size()!==0){this.table.deleteHead();return}var b=a.find("tr").first().clone();b.find("td").html(this.opts.invisibleSpace);$thead=$("").append(b);a.prepend($thead);this.code.sync()},deleteHead:function(){var a=this.table.getTable();if(!a){return}var b=a.find("thead");if(b.size()===0){return}this.buffer.set();b.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(c){var a=this.table.getTable();if(!a){return}this.buffer.set();var b=$(this.selection.getCurrent());var d=b.closest("tr");var e=d.clone();e.find("th").replaceWith(function(){var f=$("");f[0].attributes=this.attributes;return f.append($(this).contents())});e.find("td").html(this.opts.invisibleSpace);if(c=="after"){d.after(e)}else{d.before(e)}this.code.sync()},addColumn:function(d){var c=this.table.getTable();if(!c){return}var b=0;var e=$(this.selection.getCurrent());this.buffer.set();var f=e.closest("tr");var a=e.closest("td, th");f.find("td, th").each($.proxy(function(g,h){if($(h)[0]===a[0]){b=g}},this));c.find("tr").each($.proxy(function(g,j){var h=$(j).find("td, th").eq(b);var k=h.clone();k.html(this.opts.invisibleSpace);if(d=="after"){h.after(k)}else{h.before(k)}},this));this.code.sync()}}}; // wbbcode.js -if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode=function(){var a=false;return{init:function(){var e=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){if($.browser.msie){this.$editor.addClass("msie")}var i=$.trim(this.wutil.getOption("woltlab.originalValue"));if(i.length){this.wutil.replaceText(i);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection()}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var d=this.clean.onSync;this.clean.onSync=(function(i){i=i.replace(/\u200C/g,"__wcf_zwnj__");i=i.replace(/\u200D/g,"__wcf_zwj__");if(a===true){a=false}else{i=i.replace(/

]+)?><\/p>/g,"

@@@wcf_empty_line@@@

")}i=d.call(this,i);i=i.replace(/__wcf_zwnj__/g,"\u200C");return i.replace(/__wcf_zwj__/g,"\u200D")}).bind(this);if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var c=this.button.get("table");if(c.length){var h=c.data("dropdown");h.find(".redactor-dropdown-add_head").parent().remove();h.find(".redactor-dropdown-delete_head").parent().remove();$('"}return'

"+__REDACTOR_CODE_HIGHLIGHTERS[N]+(Q?": "+WCF.String.escapeHTML(Q):"")+'

    '+V+"
"}).bind(this));I=I.replace(z,i)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:I});return I},_expandFormatting:function(e,c,f){if(!e.length){return c+this.opts.invisibleSpace+f}var b=e.indexOf("[/td]");if(b!==-1){var d=e.substring(0,b);if(d.indexOf("[td]")===-1){return c+d+f+e.substring(b)}}var d=e.split("\n");e="";for(var i=0,h=d.length;i]*)>/g,function(g,j,i){if(i&&i.match(/style="([^"]+?)"/)){if(/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var d=$('
').appendTo(document.body);var f=parseInt(d[0].clientWidth);d.remove();var e=-1;var h=false;$.each(c,function(m,l){if(e===-1){e=m}else{if(Math.abs(f-l)/g,"[/size]");b=b.replace(/<(article|header)[^>]+>/g,"
");b=b.replace(/<\/(article|header)>/g,"
");b=b.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"

");b=b.replace(/<\/(div|p)><\/(div|p)>/g,"

");b=b.replace(/<(?:div|p|span)[^>]+>/gi,function(d){return d.replace(/ class="[^"]+"/,"")});b=b.replace(/<\/?wbr[^>]*>/g,"");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:b});return b},_pasteCallback:function(b){b=b.replace(/\[size=(\d+)\]/g,'

');b=b.replace(/\[\/size\]/g,"

");b=b.replace(/style="([^"]+)"/,function(c,e){var d=e.split(";");var g=[];for(var i=0,f=d.length;i]+)>/g,function(c,d){c=c.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return c});return b},insertAttachment:function(f,d){f=parseInt(f);var b=this.wutil.getOption("woltlab.attachment"+(!d?"Thumbnail":"")+"Url");var e=this.wbbcode._getImageAttachments();if(b&&e[f]!==undefined){var c="";if(d){c=' style="width: '+e[f].width+"px; max-height: "+e[f].height+"px; max-width: "+e[f].width+'px;"'}this.wutil.insertDynamic('","[attach="+f+(d?",none,"+e[f].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+f+"][/attach]")}},removeAttachment:function(b){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(c,e){var d=$(e);if(d.data("attachmentID")==b){d.remove()}})},_getImageAttachments:function(){var c=this.wutil.getOption("woltlab.attachmentImages")||[];if(c.length){delete this.opts.attachmentImages;return c}var b={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),b);return b.imageAttachments},_keydownCallback:function(u){switch(u.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var m=this.selection.getCurrent();var l=this.selection.getParent();l=(l)?$(l):l;var i=(l)?l.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(u.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var g=false;if(i.length){var j=true;for(var b=0;b0){continue}if(c.children.length>1||c.children[0].tagName==="BR"){continue}c=c.children[0];while(c.children.length===1){c=c.children[0]}if(c.children.length===0&&c.tagName==="BR"){var e=c.parentNode;var b=document.createTextNode("\u200b");e.appendChild(b);e.removeChild(c)}}break}},observeQuotes:function(){this.$editor.find(".redactorQuoteEdit").off("click.wbbcode").on("click.wbbcode",$.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(e){var c=$(e.currentTarget).closest("header");var d=$('');$(''+WCF.Language.get("wcf.bbcode.quote.edit")+"").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(e.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(d);var b=c.offset();d.css({left:b.left+"px",top:(b.top+20)+"px"});$(".redactor-link-tooltip").remove();d.appendTo(document.body);this.selection.remove()},observeCodeListings:function(){this.$editor.find(".codeBox").each((function(b,e){var c=$(e);var d=c.find(".redactorEditCodeBox");if(!d.length){d=$('
'+WCF.Language.get("wcf.bbcode.code.edit")+"
").insertAfter(c.find("> div > div > h3"))}d.off("click.wbbcode").on("click.wbbcode",(function(){this.wbbcode._handleInsertCode(c,false)}).bind(this))}).bind(this))},_openQuoteEditOverlay:function(b,d){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(d?"insert":"edit")),400);var c=this.modal.createActionButton(this.lang.get("save"));if(d){this.selection.save();c.click($.proxy(function(){var g=$("#redactorQuoteAuthor").val();var f=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();a=true;var e=this.selection.getHtml();if(this.utils.isEmpty(e)){e=""}var h=this.wbbcode.insertQuoteBBCode(g,f,e);if(h!==null){if(!e.length){if($.browser.mozilla){h.children("br[type=_moz]").replaceWith("
"+this.opts.invisibleSpace+"
")}this.caret.setStart(h.children("div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(b.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(b.attr("cite")));c.click($.proxy(function(){var e=$("#redactorQuoteAuthor").val();b.data("author",e);b.attr("data-author",e);b.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(b);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(c){var d=c.data("author");var b=c.attr("cite");if(b){b=WCF.String.escapeHTML(b)}c.find("> header > h3").empty().append(this.wbbcode._buildQuoteHeader(d,b))},insertQuoteBBCode:function(g,l,i,j){var k="[quote]";var c="[/quote]";if(g){if(l){k="[quote='"+g+"','"+l+"']"}else{k="[quote='"+g+"']"}}var p=null;if(this.wutil.inWysiwygMode()){var o=WCF.getUUID();var e="";if(j){e=this.wbbcode.convertToHtml(k+j+c)}else{e=this.wbbcode.convertToHtml(k+o+c);e=e.replace(o,i.replace(/^

/,"").replace(/<\/p>$/,""))}e=e.replace(/^

/,"").replace(/<\/p>$/,"");e=e.replace(/

div");if(n.length==1){if(n[0].innerHTML===""){n[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var m=p.find("> div > br[type=_moz]");if(m.length){$("
"+this.opts.invisibleSpace+"
").insertBefore(m);m.remove()}}}p.removeAttr("id");this.wutil.setCaretAfter(p[0]);var d=p[0].previousElementSibling;if(d!==null&&d.nodeName==="P"&&d.innerHTML==="\u200B"){d=d.previousElementSibling;if(d!==null&&d.nodeName==="P"&&(d.innerHTML==="\u200B"||d.innerHTML==="
")){d.parentNode.removeChild(d.nextElementSibling)}}}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(k+j+c)}this.wutil.saveSelection();return p},_buildQuoteHeader:function(c,d){var b="";if(!c&&d){c=d;d=""}if(c){if(d){b+=''}b+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(c)});if(d){b+=""}}else{b=""+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+""}return b},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_handleInsertCode:function(d,f){this.modal.load("code",WCF.Language.get("wcf.bbcode.code."+(f?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save")).addClass("buttonPrimary");if(f){this.selection.get();var c=this.selection.getText();this.selection.save();this.modal.show();var j=$("#redactorCodeBox").focus();j.val(c);b.click($.proxy(function(){var q=$("#redactorCodeBox");var n=$("#redactorCodeFilename");var s=$("#redactorCodeHighlighter");var t=$("#redactorCodeLineNumber");var p=q.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(p).length===0){if(!q.next("small.innerError").length){$(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(q)}return}var o=$.trim(n.val().replace(/['"]/g,""));var r="[code="+s.val()+","+t.val()+(o.length?",'"+o+"'":"")+"]";if(r.match(/\[code=([^,]+),(\d+)\]/)){r="[code="+RegExp.$2+","+RegExp.$1+"]"}r+=p;r+="[/code]";this.wutil.adjustSelectionForBlockElement();this.wutil.saveSelection();var m=this.wbbcode.convertToHtml(r);this.buffer.set();this.insert.html(m,false);var q=this.$editor.find(".codeBox:not(.jsRedactorCodeBox)");this.wbbcode.observeCodeListings();this.wbbcode.fixBlockLevelElements();q.attr("contenteditable","false");this.wutil.setCaretAfter(q[0]);this.modal.close()},this))}else{var h=this.modal.createActionButton(WCF.Language.get("wcf.global.button.delete"));h.click((function(){this.buffer.set();d.remove();this.modal.close()}).bind(this));this.modal.show();var j=$("#redactorCodeBox").focus();var i=$("#redactorCodeFilename");var g=$("#redactorCodeHighlighter");var k=$("#redactorCodeLineNumber");g.val(d.data("highlighter"));i.val(d.data("filename")||"");var e=d.find("> div > ol");k.val(parseInt(e.prop("start")));var l="";e.children("li").each(function(m,n){l+=$(n).text().replace(/^\u200b$/,"")+"\n"});j.val(l.replace(/^\n+/,"").replace(/\n+$/,""));b.click($.proxy(function(){var n=j.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(n).length===0){if(!j.next("small.innerError").length){$(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(j)}return}var r=g.val();d.data("highlighter",r);d.attr("data-highlighter",r);var o=__REDACTOR_CODE_HIGHLIGHTERS[r];var m=$.trim(i.val().replace(/['"]/g,""));if(m){o+=": "+WCF.String.escapeHTML(m);d.data("filename",m);d.attr("data-filename",m)}else{d.removeAttr("data-filename");d.removeData("filename")}d.data("highlighter",g.val());d.find("> div > div > h3").html(o);var p=d.find("> div > ol").empty();var s=parseInt(k.val());p.prop("start",(s>1?s:1));n=n.split("\n");var q="";for(var t=0;t"+WCF.String.escapeHTML(n[t])+""}p.append($(q));this.modal.close()},this))}},fixBlockLevelElements:function(){var b=(function(e,c){var d=e[c];if(d&&d.nodeType===Node.ELEMENT_NODE&&d.tagName==="P"){if(!d.innerHTML.length){d.parentElement.removeChild(d)}}}).bind(this);this.$editor.find("blockquote, .codeBox").each(function(){b(this,"previousElementSibling");b(this,"nextElementSibling")})},fixFormatting:function(d){var b=function(f){f.style.removeProperty("text-align");for(var g=0;g]+)?><\/p>/g,"

@@@wcf_empty_line@@@

")}i=d.call(this,i);i=i.replace(/__wcf_zwnj__/g,"\u200C");return i.replace(/__wcf_zwj__/g,"\u200D")}).bind(this);if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var c=this.button.get("table");if(c.length){var h=c.data("dropdown");h.find(".redactor-dropdown-add_head").parent().remove();h.find(".redactor-dropdown-delete_head").parent().remove();$('
";return T})};for(var b=B.length-1;b>=0;b--){var v=B[b];var z=new RegExp("@@"+v.hashCode+"@@","g");I=I.replace(z,q(v.content))}}I=I.replace(/<(?:div|p)><(blockquote|div)/g,"<$1");I=I.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"");if(u.length){for(var b=u.length-1;b>=0;b--){var A=u[b];var z=new RegExp("@@"+A.key+"@@","g");var i=A.value;i=i.replace(/^\[tt\]([\s\S]+)\[\/tt\]/,(function(J,L){var K=L.split("\n");L="";for(var O=0,N=K.length;O

"}L+="[tt]"+M+"[/tt]"}else{if(O===0||(O+1)===N){continue}if(L.match(/\[\/tt\]$/)){L+="

"+this.opts.invisibleSpace+""}else{L+="


"}}}return L}).bind(this));i=i.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,(function(M,U,O){var N="plain";var S=0;var Q="";if(U){U=U.substring(1);U=U.split(",");var P=function(W){return W.match(/^\d+$/)};var L=function(W){return(W.indexOf(".")!==-1)||(W.match(/^(["']).*\1$/))};var K=function(W){return(__REDACTOR_CODE_HIGHLIGHTERS[W]!==undefined)};var J=function(W){return W.replace(/^(["'])(.*)\1$/,"$2")};switch(U.length){case 1:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0}else{if(L(U[0])){Q=J(U[0])}else{if(K(U[0])){N=U[0]}}}break;case 2:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0;if(K(U[1])){N=U[1]}else{if(L(U[1])){Q=J(U[1])}}}else{if(K(U[0])){N=U[0]}if(L(U[1])){Q=J(U[1])}}break;case 3:if(K(U[0])){N=U[0]}if(P(U[1])){S=U[1]}if(L(U[2])){Q=J(U[2])}break}}O=O.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);var V="";for(var T=0;T"+R+""}return'

"+__REDACTOR_CODE_HIGHLIGHTERS[N]+(Q?": "+WCF.String.escapeHTML(Q):"")+'

    '+V+"
"}).bind(this));I=I.replace(z,i)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:I});return I},_expandFormatting:function(e,c,f){if(!e.length){return c+this.opts.invisibleSpace+f}var b=e.indexOf("[/td]");if(b!==-1){var d=e.substring(0,b);if(d.indexOf("[td]")===-1){return c+d+f+e.substring(b)}}var d=e.split("\n");e="";for(var i=0,h=d.length;i]*)>/g,function(g,j,i){if(i&&i.match(/style="([^"]+?)"/)){if(/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var d=$('
').appendTo(document.body);var f=parseInt(d[0].clientWidth);d.remove();var e=-1;var h=false;$.each(c,function(m,l){if(e===-1){e=m}else{if(Math.abs(f-l)/g,"[/size]");b=b.replace(/<(article|header)[^>]+>/g,"
");b=b.replace(/<\/(article|header)>/g,"
");b=b.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"

");b=b.replace(/<\/(div|p)><\/(div|p)>/g,"

");b=b.replace(/<(?:div|p|span)[^>]+>/gi,function(d){return d.replace(/ class="[^"]+"/,"")});b=b.replace(/<\/?wbr[^>]*>/g,"");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:b});return b},_pasteCallback:function(b){b=b.replace(/\[size=(\d+)\]/g,'

');b=b.replace(/\[\/size\]/g,"

");b=b.replace(/style="([^"]+)"/,function(c,e){var d=e.split(";");var g=[];for(var i=0,f=d.length;i]+)>/g,function(c,d){c=c.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return c});return b},insertAttachment:function(f,d){f=parseInt(f);var b=this.wutil.getOption("woltlab.attachment"+(!d?"Thumbnail":"")+"Url");var e=this.wbbcode._getImageAttachments();if(b&&e[f]!==undefined){var c="";if(d){c=' style="width: '+e[f].width+"px; max-height: "+e[f].height+"px; max-width: "+e[f].width+'px;"'}this.wutil.insertDynamic('","[attach="+f+(d?",none,"+e[f].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+f+"][/attach]")}},removeAttachment:function(b){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(c,e){var d=$(e);if(d.data("attachmentID")==b){d.remove()}})},_getImageAttachments:function(){var c=this.wutil.getOption("woltlab.attachmentImages")||[];if(c.length){delete this.opts.attachmentImages;return c}var b={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),b);return b.imageAttachments},_keydownCallback:function(x){switch(x.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var p=this.selection.getCurrent();var n=this.selection.getParent();n=(n)?$(n):n;var j=(n)?n.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(x.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var h=false;if(j.length){var k=true;for(var b=0;b0){continue}if(c.children.length>1||c.children[0].tagName==="BR"){continue}c=c.children[0];while(c.children.length===1){c=c.children[0]}if(c.children.length===0&&c.tagName==="BR"){var e=c.parentNode;var b=document.createTextNode("\u200b");e.appendChild(b);e.removeChild(c)}}break}},observeQuotes:function(){this.$editor.find(".redactorQuoteEdit").off("click.wbbcode").on("click.wbbcode",$.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(e){var c=$(e.currentTarget).closest("header");var d=$('');$(''+WCF.Language.get("wcf.bbcode.quote.edit")+"").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(e.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(d);var b=c.offset();d.css({left:b.left+"px",top:(b.top+20)+"px"});$(".redactor-link-tooltip").remove();d.appendTo(document.body);this.selection.remove()},observeCodeListings:function(){this.$editor.find(".codeBox").each((function(b,e){var c=$(e);var d=c.find(".redactorEditCodeBox");if(!d.length){d=$('
'+WCF.Language.get("wcf.bbcode.code.edit")+"
").insertAfter(c.find("> div > div > h3"))}d.off("click.wbbcode").on("click.wbbcode",(function(){this.wbbcode._handleInsertCode(c,false)}).bind(this))}).bind(this))},_openQuoteEditOverlay:function(b,d){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(d?"insert":"edit")),400);var c=this.modal.createActionButton(this.lang.get("save"));if(d){this.selection.save();c.click($.proxy(function(){var g=$("#redactorQuoteAuthor").val();var f=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();a=true;var e=this.selection.getHtml();if(this.utils.isEmpty(e)){e=""}var h=this.wbbcode.insertQuoteBBCode(g,f,e);if(h!==null){if(!e.length){if($.browser.mozilla){h.children("br[type=_moz]").replaceWith("
"+this.opts.invisibleSpace+"
")}this.caret.setStart(h.children("div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(b.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(b.attr("cite")));c.click($.proxy(function(){var e=$("#redactorQuoteAuthor").val();b.data("author",e);b.attr("data-author",e);b.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(b);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(c){var d=c.data("author");var b=c.attr("cite");if(b){b=WCF.String.escapeHTML(b)}c.find("> header > h3").empty().append(this.wbbcode._buildQuoteHeader(d,b))},insertQuoteBBCode:function(g,l,i,j){var k="[quote]";var c="[/quote]";if(g){if(l){k="[quote='"+g+"','"+l+"']"}else{k="[quote='"+g+"']"}}var p=null;if(this.wutil.inWysiwygMode()){var o=WCF.getUUID();var e="";if(j){e=this.wbbcode.convertToHtml(k+j+c)}else{e=this.wbbcode.convertToHtml(k+o+c);e=e.replace(o,i.replace(/^

/,"").replace(/<\/p>$/,""))}e=e.replace(/^

/,"").replace(/<\/p>$/,"");e=e.replace(/

div");if(n.length==1){if(n[0].innerHTML===""){n[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var m=p.find("> div > br[type=_moz]");if(m.length){$("
"+this.opts.invisibleSpace+"
").insertBefore(m);m.remove()}}}p.removeAttr("id");this.wutil.setCaretAfter(p[0]);var d=p[0].previousElementSibling;if(d!==null&&d.nodeName==="P"&&d.innerHTML==="\u200B"){d=d.previousElementSibling;if(d!==null&&d.nodeName==="P"&&(d.innerHTML==="\u200B"||d.innerHTML==="
")){d.parentNode.removeChild(d.nextElementSibling)}}}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(k+j+c)}this.wutil.saveSelection();return p},_buildQuoteHeader:function(c,d){var b="";if(!c&&d){c=d;d=""}if(c){if(d){b+=''}b+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(c)});if(d){b+=""}}else{b=""+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+""}return b},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_handleInsertCode:function(d,f){this.modal.load("code",WCF.Language.get("wcf.bbcode.code."+(f?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save")).addClass("buttonPrimary");if(f){this.selection.get();var c=this.selection.getText();this.selection.save();this.modal.show();var j=$("#redactorCodeBox").focus();j.val(c);b.click($.proxy(function(){var q=$("#redactorCodeBox");var n=$("#redactorCodeFilename");var s=$("#redactorCodeHighlighter");var t=$("#redactorCodeLineNumber");var p=q.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(p).length===0){if(!q.next("small.innerError").length){$(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(q)}return}var o=$.trim(n.val().replace(/['"]/g,""));var r="[code="+s.val()+","+t.val()+(o.length?",'"+o+"'":"")+"]";if(r.match(/\[code=([^,]+),(\d+)\]/)){r="[code="+RegExp.$2+","+RegExp.$1+"]"}r+=p;r+="[/code]";this.wutil.adjustSelectionForBlockElement();this.wutil.saveSelection();var m=this.wbbcode.convertToHtml(r);this.buffer.set();this.insert.html(m,false);var q=this.$editor.find(".codeBox:not(.jsRedactorCodeBox)");this.wbbcode.observeCodeListings();this.wbbcode.fixBlockLevelElements();q.attr("contenteditable","false");this.wutil.setCaretAfter(q[0]);this.modal.close()},this))}else{var h=this.modal.createActionButton(WCF.Language.get("wcf.global.button.delete"));h.click((function(){this.buffer.set();d.remove();this.modal.close()}).bind(this));this.modal.show();var j=$("#redactorCodeBox").focus();var i=$("#redactorCodeFilename");var g=$("#redactorCodeHighlighter");var k=$("#redactorCodeLineNumber");g.val(d.data("highlighter"));i.val(d.data("filename")||"");var e=d.find("> div > ol");k.val(parseInt(e.prop("start")));var l="";e.children("li").each(function(m,n){l+=$(n).text().replace(/^\u200b$/,"")+"\n"});j.val(l.replace(/^\n+/,"").replace(/\n+$/,""));b.click($.proxy(function(){var n=j.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(n).length===0){if(!j.next("small.innerError").length){$(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(j)}return}var r=g.val();d.data("highlighter",r);d.attr("data-highlighter",r);var o=__REDACTOR_CODE_HIGHLIGHTERS[r];var m=$.trim(i.val().replace(/['"]/g,""));if(m){o+=": "+WCF.String.escapeHTML(m);d.data("filename",m);d.attr("data-filename",m)}else{d.removeAttr("data-filename");d.removeData("filename")}d.data("highlighter",g.val());d.find("> div > div > h3").html(o);var p=d.find("> div > ol").empty();var s=parseInt(k.val());p.prop("start",(s>1?s:1));n=n.split("\n");var q="";for(var t=0;t"+WCF.String.escapeHTML(n[t])+""}p.append($(q));this.modal.close()},this))}},fixBlockLevelElements:function(){var b=(function(e,c){var d=e[c];if(d&&d.nodeType===Node.ELEMENT_NODE&&d.tagName==="P"){if(!d.innerHTML.length){d.parentElement.removeChild(d)}}}).bind(this);this.$editor.find("blockquote, .codeBox").each(function(){b(this,"previousElementSibling");b(this,"nextElementSibling")})},fixFormatting:function(d){var b=function(f){f.style.removeProperty("text-align");for(var g=0;g").append(e).insertAfter(this.button.get(d).parent());if(a!==null){this.button.setAwesome(b,a)}},_addBBCodeButton:function(b){var c="__wcf_"+b.name;var a=this.button.add(c,b.label);this.button.addCallback(a,this.wbutton._insertBBCode);this._bbcodes[c]={name:b.name,voidElement:(b.voidElement===true)};if(b.icon.match(/^fa\-[a-z\-]+$/)){this.button.setAwesome(c,b.icon)}else{a.css("background-image","url("+__REDACTOR_ICON_PATH+b.icon+")")}},_insertBBCode:function(a){var d=this._bbcodes[a].name;var b={buttonName:a,cancel:false,redactor:this};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","insertBBCode_"+d+"_"+this.$textarea.wcfIdentify(),b);if(b.cancel===false){var c=this.selection.getHtml();c=c.replace(/

@@@wcf_empty_line@@@<\/p>/g,"


");if(false&&d==="tt"){var e=(this.selection.getParent())?$(this.selection.getParent()):null;if(e&&e.closest("inline.inlineCode",this.$editor.get()[0]).length){this.inline.toggleClass("inlineCode")}else{this.inline.toggleClass("inlineCode")}}else{this.buffer.set();if(this.utils.browser("mozilla")&&!c.length){var f=getSelection().getRangeAt(0).startContainer;if(f.nodeType===Node.ELEMENT_NODE&&f.tagName==="P"&&f.innerHTML==="
"){f.removeChild(f.children[0])}}if(this._bbcodes[a].voidElement){this.insert.html(c+this.selection.getMarkerAsHtml()+"["+d+"]",false)}else{this.insert.html("["+d+"]"+c+this.selection.getMarkerAsHtml()+"[/"+d+"]",false)}this.selection.restore()}}},insertImage:function(){this.image.show()},_insertImage:function(){var d=$("#redactor-image-link-source");var b=d.val().trim();if(b.length){this.buffer.set();var c=$("#redactor-image-align").val();var a="";if(c==="left"||c==="right"){a=' style="float: '+c+'"'}this.insert.html('",false);this.modal.close();this.observe.images()}else{if(!d.next("small.innerError")){$(''+WCF.Language.get("wcf.global.form.error.empty")+"").insertAfter(d)}}}}}; // wfontcolor.js @@ -15,4 +15,4 @@ if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wmonkeypatch=functio // wupload.js if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wupload=function(){return{_boundGlobalUploadEvents:false,_dropArea:{},_timer:null,_isDragging:false,_isFile:false,init:function(){var a=".redactor_"+this.$textarea.wcfIdentify();$(document).on("dragover"+a,$.proxy(this.wupload._dragOver,this));$(document).on("dragleave"+a,$.proxy(this.wupload._dragLeave,this));$(document).on("drop"+a,(function(b){b.preventDefault();this.wupload._revertDropArea(undefined,this.$textarea.wcfIdentify())}).bind(this));if(!this.wupload._boundGlobalUploadEvents){this.wupload._boundGlobalUploadEvents=true;$(document).on("dragend",function(b){b.preventDefault()})}WCF.System.Event.addListener("com.woltlab.wcf.attachment","autoInsert_"+this.$textarea.wcfIdentify(),$.proxy(this.wupload.insertPastedImageAttachment,this))},_dragOver:function(d){d=d.originalEvent;if(!this.$editor.is(":visible")){return}if(!d.dataTransfer||!d.dataTransfer.types){return}var e=false;for(var c in d.dataTransfer){if(/^moz/.test(c)){e=true;break}}this.wupload._isFile=false;if(e){if(d.dataTransfer.types[0]==="application/x-moz-file"){this.wupload._isFile=true}}else{for(var g=0;g'+WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")+"
").hide().appendTo(document.body);this.wupload._dropArea[b].on("dragover",$.proxy(this.wupload._hoverDropArea,this)).on("dragleave",$.proxy(this.wupload._revertDropArea,this)).on("drop",$.proxy(this.wupload._drop,this))}var a=(this.wutil.inWysiwygMode())?this.$editor.getDimensions("outer"):this.$textarea.getDimensions("outer");var f=(this.wutil.inWysiwygMode())?this.$editor.getOffsets("offset"):this.$textarea.getOffsets("offset");this.wupload._dropArea[b].css({height:a.height+"px",left:f.left+"px",lineHeight:a.height+"px",top:f.top+"px",width:a.width+"px"}).show();this.wupload._isDragging=true}d.preventDefault()},_hoverDropArea:function(a){this.wupload._dropArea[this.$textarea.wcfIdentify()].addClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropNow"))},_revertDropArea:function(c,a){if(!this.wupload._isFile){return}var b=a||this.$textarea.wcfIdentify();this.wupload._dropArea[b].removeClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropHere"));if(a){this.wupload._dropArea[b].hide()}},_dragLeave:function(){if(!this.wupload._isDragging||!this.wupload._isFile){return}if(this.wupload._timer===null){this.wupload._timer=new WCF.PeriodicalExecuter((function(a){a.stop();if(!this.wupload._isDragging){this.wupload._dropArea[this.$textarea.wcfIdentify()].hide()}}).bind(this),100)}else{this.wupload._timer.resume()}this.wupload._isDragging=false},_drop:function(b){if(!this.wupload._isFile){return}b=b.originalEvent||b;if(b.dataTransfer&&b.dataTransfer.files.length){b.preventDefault();var a=this.$textarea.wcfIdentify();this.wupload._revertDropArea(undefined,a);for(var c=0;c')},this))},insertPastedImageAttachment:function(b){var a=this.$editor.find("span.redactor-pastedImageFromClipboard-"+b.uploadID);a.before(b.attachment);a.remove()}}}; // wutil.js -if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wutil=function(){var c="";var d=null;var a=false;var b=false;var e=null;return{_autosaveWorker:null,_range:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this));if(this.wutil.getOption("woltlab.autosave").active){this.wutil.autosaveEnable();if(this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")){this.wutil.setOption("woltlab.autosaveOnce",true)}else{this.wutil.autosaveRestore()}}this.wutil.setOption("autosave",false);var f=this.core.destroy;this.core.destroy=(function(){this.wutil.autosaveDisable();f.call(this)}).bind(this)},saveSelection:function(g){var f=getSelection();if(f.rangeCount){this.wutil._range=f.getRangeAt(0)}else{if(g){this.wutil._range=null}}},restoreSelection:function(){if(document.activeElement!==this.$editor[0]){this.$editor.focus()}if(this.wutil._range!==null){var f=window.getSelection();f.removeAllRanges();f.addRange(this.wutil._range);this.wutil._range=null}},clearSelection:function(){this.wutil._range=null},getSelection:function(){return this.wutil._range},insertAtCaret:function(g){if(this.opts.visual){console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode.");return false}this.$textarea.focus();var h=this.$textarea.getCaret();if(h==-1){console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.")}var f=this.$textarea.val();f=f.substr(0,h)+g+f.substr(h);this.$textarea.val(f);return true},insertDynamic:function(f,g){if(this.wutil.inWysiwygMode()){this.insert.html(f,false)}else{if(g===undefined||g===null){g=f}this.wutil.insertAtCaret(g)}},setOption:function(f,g){if(f.indexOf(".")!==-1){f=f.split(".",2);this.opts[f[0]][f[1]]=g}else{this.opts[f]=g}},getOption:function(f){if(f.indexOf(".")!==-1){f=f.split(".",2);if(this.opts[f[0]][f[1]]){return this.opts[f[0]][f[1]]}}else{if(this.opts[f]){return this.opts[f]}}return null},inPlainMode:function(){return !this.opts.visual},inWysiwygMode:function(){return(this.opts.visual)},replaceRangesWith:function(f){getSelection().removeAllRanges();getSelection().addRange(f)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(f)))}var g=$.trim(this.$textarea.val());g=this.wutil._removeSuperfluousNewlines(g);return g},isEmptyEditor:function(){if(this.opts.visual){return this.utils.isEmpty(this.$editor.html())}return(!$.trim(this.$textarea.val()))},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=$.trim(this.wbbcode.convertFromHtml(this.$textarea.val()));f=this.wutil._removeSuperfluousNewlines(f);this.$textarea.val(f)}this.wutil.autosavePurge()},_removeSuperfluousNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])\n/g,"$1");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_removeSuperfluousNewlines",f);return f.text},addNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])/g,"$1\n");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_addNewlines",f);return f.text},reset:function(){if(this.opts.visual){this.$editor.html("

"+this.opts.invisibleSpace+"

");this.wutil.saveSelection()}this.$textarea.val("");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(f){if(!this.wutil.getOption("woltlab.autosave").active){this.wutil.setOption("woltlab.autosave",{active:true,key:f})}if(this.wutil._autosaveWorker===null){this.wutil.autosavePurgeOutdated();this.wutil._autosaveWorker=new WCF.PeriodicalExecuter((function(g){this.wutil.saveTextToStorage(false)}).bind(this),15*1000)}return true},saveTextToStorage:function(g){var f=this.wutil.getText();if(c==f&&!g){return}try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:f,timestamp:Date.now()}));c=f;a=true;if(e===null){e=new WCF.PeriodicalExecuter((function(i){if(b===true){return}if(a===false){i.stop();e=null;return}this.wutil.autosaveShowNotice("saved");a=false}).bind(this),120*1000)}}catch(h){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+h.message)}},autosaveDisable:function(){if(!this.wutil.getOption("woltlab.autosave").active){return false}this.wutil._autosaveWorker.stop();this.wutil._autosaveWorker=null;this.wutil.setOption("woltlab.autosave",{active:false,key:""});return true},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(f){console.debug("[wutil.autosavePurge] Unable to access local storage: "+f.message)}},autosaveRestore:function(){var f=this.wutil.getOption("woltlab.autosave");var g=null;try{g=localStorage.getItem(f.key)}catch(h){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+h.message)}try{g=(g===null)?null:JSON.parse(g)}catch(h){g=null}if(g===null||!g.content){return false}if(f.lastEditTime&&(f.lastEditTime*1000)>g.timestamp){this.wutil.autosavePurge();return false}if(f.prompt){this.wutil.autosaveShowNotice("prompt",g);return false}if(this.wutil.inWysiwygMode()){this.wutil.setOption("woltlab.originalValue",g.content)}else{this.$textarea.val(g.content)}this.wutil.autosaveShowNotice("restored",{timestamp:g.timestamp});return true},autosaveShowNotice:function(j,l){if(d===null){d=$('
');d.appendTo(this.$box);var h=(function(m){if(m!==null&&m.originalEvent.propertyName!=="opacity"){return}if(d.hasClass("open")&&m!==null){if(d.data("callbackOpen")){d.data("callbackOpen")()}}else{if(d.data("callbackClose")){d.data("callbackClose")()}d.removeData("callbackClose");d.removeData("callbackOpen");d.removeClass("redactorAutosaveNoticeIcons");d.empty();$('').appendTo(d)}}).bind(this);d.on("transitionend webkitTransitionEnd",h)}var i="";switch(j){case"prompt":$('').prependTo(d);var k=$('').appendTo(d);var f=$('').appendTo(d);k.click((function(){this.wutil.replaceText(l.content);h(null);this.wutil.autosaveShowNotice("restored",l)}).bind(this));f.click((function(){this.wutil.autosavePurge();d.removeClass("open")}).bind(this));i=WCF.Language.get("wcf.message.autosave.prompt");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){d.removeClass("open")},3000)}).bind(this));break;case"restored":$('').prependTo(d);var k=$('').appendTo(d);var f=$('').appendTo(d);k.click(function(){d.removeClass("open")});f.click((function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),(function(m){if(m==="confirm"){this.wutil.reset();this.wutil.autosavePurge();d.removeClass("open")}}).bind(this))}).bind(this));i=WCF.Language.get("wcf.message.autosave.restored");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){k.trigger("click")},3000)}).bind(this));break;case"saved":if(d.hasClass("open")){return}setTimeout(function(){d.removeClass("open")},2000);i=WCF.Language.get("wcf.message.autosave.saved");break}d.children("span.redactorAutosaveMessage").text(i);d.addClass("open");if(j!=="saved"){WCF.DOMNodeInsertedHandler.execute()}},autosavePurgeOutdated:function(){var j=0;var m=this.wutil.getOption("woltlab.autosave").prefix;var l=m+"_wcf_master";try{j=localStorage.getItem(l)}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}if(j===0){return}var f=Date.now()-(7*24*3600*1000);if(j===null||j"+this.opts.invisibleSpace+"
")}else{f=$("

"+this.opts.invisibleSpace+"

")}f[(h?"insertBefore":"insertAfter")](g);this.caret.setEnd(f[0])},fixDOM:function(){var f=this.$editor[0].childNodes[0];var j=f;var m=null;while(j){f=j;j=f.nextSibling;if(f.nodeType===Element.ELEMENT_NODE){if(this.reIsBlock.test(f.tagName)){m=null}else{if(m===null){m=$("

").insertBefore(f)}m.append(f)}}else{if(f.nodeType===Element.TEXT_NODE){if(m===null){if(j){if(j.nodeType===Element.ELEMENT_NODE&&j.tagName==="P"&&j.innerHTML==="\u200B"){var l=j.nextSibling;this.$editor[0].removeChild(j);j=l}}m=$("

").insertBefore(f)}m.append(f)}}}var i=this.$editor[0].getElementsByTagName("li");for(var p=0,o=i.length;p1){n.parentElement.removeChild(n);p--;o--}}}for(var p=0,o=this.$editor[0].children.length;p0){continue}if(h.children.length>1||(h.children.length===1&&h.children[0].tagName==="BR")){continue}while(h.children.length===1){h=h.children[0]}if(h.childNodes.length===0&&h.tagName!=="BR"){var g=document.createTextNode("\u200b");h.appendChild(g)}}}}}; +if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wutil=function(){var c="";var d=null;var a=false;var b=false;var e=null;return{_autosaveWorker:null,_range:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this));if(this.wutil.getOption("woltlab.autosave").active){this.wutil.autosaveEnable();if(this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")){this.wutil.setOption("woltlab.autosaveOnce",true)}else{this.wutil.autosaveRestore()}}this.wutil.setOption("autosave",false);var f=this.core.destroy;this.core.destroy=(function(){this.wutil.autosaveDisable();f.call(this)}).bind(this)},saveSelection:function(g){var f=getSelection();if(f.rangeCount){this.wutil._range=f.getRangeAt(0)}else{if(g){this.wutil._range=null}}},restoreSelection:function(){if(document.activeElement!==this.$editor[0]){this.$editor.focus()}if(this.wutil._range!==null){var f=window.getSelection();f.removeAllRanges();f.addRange(this.wutil._range);this.wutil._range=null}},clearSelection:function(){this.wutil._range=null},getSelection:function(){return this.wutil._range},insertAtCaret:function(g){if(this.opts.visual){console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode.");return false}this.$textarea.focus();var h=this.$textarea.getCaret();if(h==-1){console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.")}var f=this.$textarea.val();f=f.substr(0,h)+g+f.substr(h);this.$textarea.val(f);return true},insertDynamic:function(f,g){if(this.wutil.inWysiwygMode()){this.insert.html(f,false)}else{if(g===undefined||g===null){g=f}this.wutil.insertAtCaret(g)}},setOption:function(f,g){if(f.indexOf(".")!==-1){f=f.split(".",2);this.opts[f[0]][f[1]]=g}else{this.opts[f]=g}},getOption:function(f){if(f.indexOf(".")!==-1){f=f.split(".",2);if(this.opts[f[0]][f[1]]){return this.opts[f[0]][f[1]]}}else{if(this.opts[f]){return this.opts[f]}}return null},inPlainMode:function(){return !this.opts.visual},inWysiwygMode:function(){return(this.opts.visual)},replaceRangesWith:function(f){getSelection().removeAllRanges();getSelection().addRange(f)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(f)))}var g=$.trim(this.$textarea.val());g=this.wutil._removeSuperfluousNewlines(g);return g},isEmptyEditor:function(){if(this.opts.visual){return this.utils.isEmpty(this.$editor.html())}return(!$.trim(this.$textarea.val()))},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=$.trim(this.wbbcode.convertFromHtml(this.$textarea.val()));f=this.wutil._removeSuperfluousNewlines(f);this.$textarea.val(f)}this.wutil.autosavePurge()},_removeSuperfluousNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])\n/g,"$1");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_removeSuperfluousNewlines",f);return f.text},addNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])/g,"$1\n");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_addNewlines",f);return f.text},reset:function(){if(this.opts.visual){this.$editor.html("

"+this.opts.invisibleSpace+"

");this.wutil.saveSelection()}this.$textarea.val("");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(f){if(!this.wutil.getOption("woltlab.autosave").active){this.wutil.setOption("woltlab.autosave",{active:true,key:f})}if(this.wutil._autosaveWorker===null){this.wutil.autosavePurgeOutdated();this.wutil._autosaveWorker=new WCF.PeriodicalExecuter((function(g){this.wutil.saveTextToStorage(false)}).bind(this),15*1000)}return true},saveTextToStorage:function(g){var f=this.wutil.getText();if(c==f&&!g){return}try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:f,timestamp:Date.now()}));c=f;a=true;if(e===null){e=new WCF.PeriodicalExecuter((function(i){if(b===true){return}if(a===false){i.stop();e=null;return}this.wutil.autosaveShowNotice("saved");a=false}).bind(this),120*1000)}}catch(h){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+h.message)}},autosaveDisable:function(){if(!this.wutil.getOption("woltlab.autosave").active){return false}this.wutil._autosaveWorker.stop();this.wutil._autosaveWorker=null;this.wutil.setOption("woltlab.autosave",{active:false,key:""});return true},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(f){console.debug("[wutil.autosavePurge] Unable to access local storage: "+f.message)}},autosaveRestore:function(){var f=this.wutil.getOption("woltlab.autosave");var g=null;try{g=localStorage.getItem(f.key)}catch(h){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+h.message)}try{g=(g===null)?null:JSON.parse(g)}catch(h){g=null}if(g===null||!g.content){return false}if(f.lastEditTime&&(f.lastEditTime*1000)>g.timestamp){this.wutil.autosavePurge();return false}if(f.prompt){this.wutil.autosaveShowNotice("prompt",g);return false}if(this.wutil.inWysiwygMode()){this.wutil.setOption("woltlab.originalValue",g.content)}else{this.$textarea.val(g.content)}this.wutil.autosaveShowNotice("restored",{timestamp:g.timestamp});return true},autosaveShowNotice:function(j,l){if(d===null){d=$('
');d.appendTo(this.$box);var h=(function(m){if(m!==null&&m.originalEvent.propertyName!=="opacity"){return}if(d.hasClass("open")&&m!==null){if(d.data("callbackOpen")){d.data("callbackOpen")()}}else{if(d.data("callbackClose")){d.data("callbackClose")()}d.removeData("callbackClose");d.removeData("callbackOpen");d.removeClass("redactorAutosaveNoticeIcons");d.empty();$('').appendTo(d)}}).bind(this);d.on("transitionend webkitTransitionEnd",h)}var i="";switch(j){case"prompt":$('').prependTo(d);var k=$('').appendTo(d);var f=$('').appendTo(d);k.click((function(){this.wutil.replaceText(l.content);h(null);this.wutil.autosaveShowNotice("restored",l)}).bind(this));f.click((function(){this.wutil.autosavePurge();d.removeClass("open")}).bind(this));i=WCF.Language.get("wcf.message.autosave.prompt");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){d.removeClass("open")},3000)}).bind(this));break;case"restored":$('').prependTo(d);var k=$('').appendTo(d);var f=$('').appendTo(d);k.click(function(){d.removeClass("open")});f.click((function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),(function(m){if(m==="confirm"){this.wutil.reset();this.wutil.autosavePurge();d.removeClass("open")}}).bind(this))}).bind(this));i=WCF.Language.get("wcf.message.autosave.restored");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){k.trigger("click")},3000)}).bind(this));break;case"saved":if(d.hasClass("open")){return}setTimeout(function(){d.removeClass("open")},2000);i=WCF.Language.get("wcf.message.autosave.saved");break}d.children("span.redactorAutosaveMessage").text(i);d.addClass("open");if(j!=="saved"){WCF.DOMNodeInsertedHandler.execute()}},autosavePurgeOutdated:function(){var j=0;var m=this.wutil.getOption("woltlab.autosave").prefix;var l=m+"_wcf_master";try{j=localStorage.getItem(l)}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}if(j===0){return}var f=Date.now()-(7*24*3600*1000);if(j===null||j"+this.opts.invisibleSpace+"
")}else{f=$("

"+this.opts.invisibleSpace+"

")}f[(h?"insertBefore":"insertAfter")](g);this.caret.setEnd(f[0])},fixDOM:function(){var f=this.$editor[0].childNodes[0];var j=f;var m=null;while(j){f=j;j=f.nextSibling;if(f.nodeType===Element.ELEMENT_NODE){if(this.reIsBlock.test(f.tagName)){m=null}else{if(m===null){m=$("

").insertBefore(f)}m.append(f)}}else{if(f.nodeType===Element.TEXT_NODE){if(m===null){if(j){if(j.nodeType===Element.ELEMENT_NODE&&j.tagName==="P"&&j.innerHTML==="\u200B"){var l=j.nextSibling;this.$editor[0].removeChild(j);j=l}}m=$("

").insertBefore(f)}m.append(f)}}}var i=this.$editor[0].getElementsByTagName("li");for(var q=0,o=i.length;q1){n.parentElement.removeChild(n);q--;o--}}}for(var q=0,o=this.$editor[0].children.length;q0){continue}if(h.children.length>1||(h.children.length===1&&h.children[0].tagName==="BR")){continue}while(h.children.length===1){h=h.children[0]}if(h.childNodes.length===0&&h.tagName!=="BR"){var g=document.createTextNode("\u200b");h.appendChild(g)}}var p=this.$editor[0].getElementsByTagName("INPUT");while(p.length){p[0].parentNode.removeChild(p[0])}}}};