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

index 463d0546f88afe9a27be6343e8b0cd25b11c9616..51adc305062e1ccd8c974ed714abe65bd0ad56d5 100644 (file)
@@ -17,3 +17,4 @@ 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])}}};
+