Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Sun, 16 Oct 2016 17:46:49 +0000 (19:46 +0200)
committerwoltlab.com <woltlab@woltlab.com>
Sun, 16 Oct 2016 17:46:49 +0000 (19:46 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/combined.min.js
wcfsetup/install/files/js/WCF.Combined.min.js

index 4287b2536389e0f04c70e58ad9446393afac4b3b..f96a2fe95e85c6cb3178a125664f01222a3964e2 100644 (file)
@@ -61,7 +61,7 @@ $.Redactor.prototype.WoltLabReply=function(){"use strict";var t=null,e=null,s=nu
 // WoltLabSize.js
 $.Redactor.prototype.WoltLabSize=function(){"use strict";return{init:function(){for(var t,e=[8,10,12,14,18,24,36],i=this.WoltLabSize.setSize.bind(this),o={},s=0,r=e.length;r>s;s++)t=e[s],o["size_"+t]={title:t,func:i};o.removeSize={title:this.lang.get("remove-size"),func:this.WoltLabSize.removeSize.bind(this)};var n=this.button.add("woltlabSize","");this.button.addDropdown(n,o);var a=n.data("dropdown");a.find("a").each(function(t,e){e.className.match(/redactor-dropdown-size_(\d{1,2})/)&&(e.style.setProperty("font-size",RegExp.$1+"pt",""),e.parentNode.classList.add("woltlab-size-selection"))}),$('<li class="dropdownDivider"></li>').insertBefore(a.children("li").last())},setSize:function(t){this.selection.save(),require(["WoltLabSuite/Core/Ui/Redactor/Format"],function(e){this.buffer.set(),e.format(this.$editor[0],"font-size",t.replace(/^size_/,"")+"pt"),this.buffer.set()}.bind(this))},removeSize:function(){this.selection.save(),require(["WoltLabSuite/Core/Ui/Redactor/Format"],function(t){this.buffer.set(),t.removeFormat(this.$editor[0],"font-size"),this.buffer.set()}.bind(this))}}};
 // WoltLabSmiley.js
-$.Redactor.prototype.WoltLabSmiley=function(){"use strict";var t=0;return{init:function(){require(["EventHandler"],function(t){t.add("com.woltlab.wcf.redactor2","insertSmiley_"+this.$element[0].id,this.WoltLabSmiley._insert.bind(this))}.bind(this))},_insert:function(i){if(!this.WoltLabSource.isActive()){this.buffer.set();var e="wscSmiley_"+this.uuid+"_"+t++,r=i.img.cloneNode();r.id=e,this.insert.html(r.outerHTML),r=elById(e),r.outerHTML=r.outerHTML}}}};
+$.Redactor.prototype.WoltLabSmiley=function(){"use strict";var t=0;return{init:function(){require(["EventHandler"],function(t){t.add("com.woltlab.wcf.redactor2","insertSmiley_"+this.$element[0].id,this.WoltLabSmiley._insert.bind(this))}.bind(this))},_insert:function(i){if(!this.WoltLabSource.isActive()){this.buffer.set();var e="wscSmiley_"+this.uuid+"_"+t++,r=i.img.cloneNode();r.id=e,this.insert.html(r.outerHTML),r=elById(e),r.removeAttribute("id"),r.outerHTML=r.outerHTML}}}};
 // WoltLabSource.js
 $.Redactor.prototype.WoltLabSource=function(){"use strict";return{init:function(){this.source.setCaretOnShow=function(){},this.source.setCaretOnHide=function(e){return e};var e=this.source.hide;this.source.hide=function(){e.call(this),setTimeout(this.focus.end.bind(this),100),this.placeholder.enable()}.bind(this);var t=this.source.$textarea[0];this.$element[0].parentNode.insertBefore(t,this.$element[0]);var r=this.source.show;this.source.show=function(){var e=this.$editor[0].offsetHeight;r.call(this),t.style.setProperty("height",Math.ceil(e)+"px",""),t.style.setProperty("display","block",""),t.value=this.WoltLabSource.format(t.value),t.selectionStart=t.selectionEnd=t.value.length}.bind(this),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","validate_"+this.$element[0].id,function(e){t.clientHeight&&(e.api.throwError(this.$element[0],WCF.Language.get("wcf.editor.source.error.active")),e.valid=!1)}.bind(this))},isActive:function(){return"none"===this.$editor[0].style.getPropertyValue("display")},format:function(e){var t=this.block.tags.join("|").toLowerCase();t+="|ul|ol|li";var r="[^'\">]*(?:(?:\"[^\"]*\"|'[^']*')[^'\">]*)*",i=[];e=e.replace(new RegExp("<pre"+r+">[sS]*?</pre>","g"),function(e){return i.push(e),"@@@WCF_PRE_BACKUP_"+(i.length-1)+"@@@"}),e=e.replace(new RegExp("\\s*</("+t+")("+r+")>\\s*","g"),"\n</$1$2>"),e=e.replace(new RegExp("\\s*<("+t+")("+r+")>\\s*","g"),"\n<$1$2>\n"),e=e.replace(new RegExp("<(ol|ul)("+r+")>\\s*","g"),"<$1$2>\n");var n,s,o,a=e.split(/\n/),l=0,c=new RegExp("^<(?:"+t+")"),h=new RegExp("^</(?:"+t+")>$"),u=!1;for(n=0,s=a.length;s>n;n++){if(o=a[n],u=!1,o.match(c)?u=!0:o.match(h)&&l--,l>0){var p=l;for(a[n]="";p--;)a[n]+="  ";a[n]+=o}u&&l++}for(e=a.join("\n"),n=0,s=i.length;s>n;n++)e=e.replace("@@@WCF_PRE_BACKUP_"+n+"@@@",i[n]);return e.trim()}}};
 // WoltLabSpoiler.js
index 6c37b976f8480b0437cb308960feebba69b50d24..b6aa2b8bf219ea8ff7e84de8feea4b6c04364cae 100755 (executable)
@@ -80,7 +80,7 @@ void 0!==n&&i.children(this._options.items).each($.proxy(function(e,t){var i=$(t
 (function (window, undefined) {"use strict";WCF.Attachment={},WCF.Attachment.Upload=WCF.Upload.extend({_autoInsert:[],_insertAllButton:null,_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_editorId:"",_replaceOnLoad:{},init:function(t,e,a,i,s,n,r,l){if(this._super(t,e,"wcf\\data\\attachment\\AttachmentAction",{multiple:!0,maxUploads:r}),this._autoInsert=[],this._objectType=a,this._objectID=parseInt(i),this._tmpHash=s,this._parentObjectID=parseInt(n),this._editorId=l,this._buttonSelector.children("p.button").click($.proxy(this._validateLimit,this)),this._fileListSelector.find(".jsButtonInsertAttachment").click($.proxy(this._insert,this)),this._fileListSelector.find(".jsButtonAttachmentInsertThumbnail").click($.proxy(this._insert,this)),this._fileListSelector.find(".jsButtonAttachmentInsertFull").click($.proxy(this._insert,this)),WCF.DOMNodeRemovedHandler.addCallback("WCF.Attachment.Upload",$.proxy(this._removeLimitError,this)),WCF.System.Event.addListener("com.woltlab.wcf.action.delete","attachment_"+this._editorId,$.proxy(this._removeLimitError,this)),this._makeSortable(),this._insertAllButton=$('<p class="button jsButtonAttachmentInsertAll">'+WCF.Language.get("wcf.attachment.insertAll")+"</p>").hide().appendTo(this._buttonSelector),this._insertAllButton.click($.proxy(this._insertAll,this)),this._fileListSelector.children("li:not(.uploadFailed)").length&&this._insertAllButton.show(),this._editorId){WCF.System.Event.addListener("com.woltlab.wcf.redactor2","submit_"+this._editorId,this._submitInline.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+this._editorId,this._reset.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId,this._editorUpload.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId,this._editorUpload.bind(this));var o=WCF.System.Event.addListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,function(t){var e=this._getImageAttachments(),a=t.attributes[0]||0;if(e.hasOwnProperty(a)){var i=t.attributes[2];i=i===!0||"true"===i;var s=elCreate("img");s.className="woltlabAttachment",s.src=e[a][i?"thumbnailUrl":"url"],elData(s,"attachment-id",a);var n=t.attributes[1]||"none";"left"===n?s.classList.add("messageFloatObjectLeft"):"right"===n&&s.classList.add("messageFloatObjectRight");var r=t.metacode;r.parentNode.insertBefore(s,r),elRemove(r),t.cancel=!0}}.bind(this));WCF.System.Event.addListener("com.woltlab.wcf.redactor2","destroy_"+this._editorId,function(){WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","submit_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","reset_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId),WCF.System.Event.removeListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,o)}.bind(this))}},_editorUpload:function(t){var e,a=null;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",!0),t.file?e=this._upload(void 0,t.file):(e=this._upload(void 0,void 0,t.blob),a=t.replace||null),null===a?this._autoInsert.push(e):this._replaceOnLoad[e]=a,t.uploadID=e},_getImageAttachments:function(){var t={};return this._fileListSelector.children("li").each(function(e,a){var i=$(a);i.data("isImage")&&(t[~~i.data("objectID")]={thumbnailUrl:i.find(".jsButtonAttachmentInsertThumbnail").data("url"),url:i.find(".jsButtonAttachmentInsertFull").data("url")})}),t},_submitInline:function(t){this._tmpHash&&(t.tmpHash=this._tmpHash)},_reset:function(){this._fileListSelector.hide().empty(),this._insertAllButton.hide(),this._validateLimit()},_validateLimit:function(){var t=this._buttonSelector.next("small.innerError"),e=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length,a=this._fileUpload?this._fileUpload.prop("files").length:0;if(0>=e||a>e){var i=0>=e?WCF.Language.get("wcf.attachment.upload.error.reachedLimit"):WCF.Language.get("wcf.attachment.upload.error.reachedRemainingLimit").replace(/#remaining#/,e);return t.length||(t=$('<small class="innerError" />').insertAfter(this._buttonSelector)),t.html(i),!1}return t.remove(),!0},_removeLimitError:function(t){var e=this._fileListSelector.children("li");e.filter(":not(.uploadFailed)").length||this._insertAllButton.hide(),e.length||this._fileListSelector.hide(),this._editorId&&t.button&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","deleteAttachment_"+this._editorId,{attachmentId:t.button.data("objectID")})},_upload:function(t,e,a){var i=void 0;return this._validateLimit()&&(i=this._super(t,e,a)),this._fileUpload&&(this._removeButton(),this._createButton()),i},_createUploadMatrix:function(t){return this._fileListSelector.children("li.uploadFailed").remove(),this._super(t)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(t){var e=$('<li class="box64"><span class="icon icon64 fa-spinner" /><div><div><p>'+t.name+'</p><small><progress max="100"></progress></small></div><ul></ul></div></li>').data("filename",t.name);return this._fileListSelector.append(e),this._fileListSelector.show(),this._buttonSelector.data("maxSize")<t.size&&(e.find("progress").remove(),e.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),e.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"</small>")),e.addClass("uploadFailed")),e},_success:function(t,e){var a;for(var i in this._uploadMatrix[t])if(this._uploadMatrix[t].hasOwnProperty(i)){var s=this._uploadMatrix[t][i];s.find("progress").remove();var n=s.data("filename"),r=s.data("internalFileID");if(e.returnValues&&e.returnValues.attachments[r]){a=e.returnValues.attachments[r],a.tinyURL?(s.children(".fa-spinner").replaceWith($('<img src="'+a.tinyURL+'" alt="" class="attachmentTinyThumbnail" />')),s.data("height",a.height),s.data("width",a.width),elData(s[0],"is-image",a.isImage)):s.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-paperclip");var l=$('<a href=""></a>');l.text(n).attr("href",a.url),0!=a.isImage&&l.addClass("jsImageViewer").attr("title",n),s.find("p").empty().append(l),s.find("small").append(a.formattedFilesize);var o=s.find("ul").addClass("buttonGroup"),d=$('<li><span class="button small jsDeleteButton" data-object-id="'+a.attachmentID+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'" data-event-name="attachment_'+this._editorId+'">'+WCF.Language.get("wcf.global.button.delete")+"</span></li>");if(o.append(d),s.data("objectID",a.attachmentID),this._editorId)if(a.tinyURL){if(a.thumbnailURL){var c=$('<li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="'+a.attachmentID+'" data-url="'+WCF.String.escapeHTML(a.thumbnailURL)+'">'+WCF.Language.get("wcf.attachment.insertThumbnail")+"</span></li>").appendTo(o);c.children("span.button").click($.proxy(this._insert,this))}var h=$('<li><span class="button small jsButtonAttachmentInsertFull" data-object-id="'+a.attachmentID+'" data-url="'+WCF.String.escapeHTML(a.url)+'">'+WCF.Language.get("wcf.attachment.insertFull")+"</span></li>").appendTo(o);h.children("span.button").click($.proxy(this._insert,this))}else{var m=$('<li><span class="button small jsButtonAttachmentInsertPlain" data-object-id="'+a.attachmentID+'">'+WCF.Language.get("wcf.attachment.insert")+"</span></li>");m.appendTo(o).children("span.button").click($.proxy(this._insert,this))}if(this._replaceOnLoad.hasOwnProperty(t)){if(!s.hasClass("uploadFailed")){var u=this._replaceOnLoad[t];u&&u.parentNode&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","replaceAttachment_"+this._editorId,{attachmentId:a.attachmentID,img:u,src:a.thumbnailURL?a.thumbnailURL:a.url})}this._replaceOnLoad[t]=null}}else{s.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban");var p="";p=e.returnValues&&e.returnValues.errors[r]?e.returnValues.errors[r].errorType:"uploadFailed",s.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error."+p)+"</small>")),s.addClass("uploadFailed")}if(WCF.inArray(t,this._autoInsert)&&(this._autoInsert.splice(this._autoInsert.indexOf(t),1),!s.hasClass("uploadFailed"))){var _=s.find(".jsButtonAttachmentInsertThumbnail");_.length||(_=s.find(".jsButtonAttachmentInsertFull")),_.trigger("click")}}this._makeSortable(),this._fileListSelector.children("li:not(.uploadFailed)").length?this._insertAllButton.show():this._insertAllButton.hide(),WCF.DOMNodeInsertedHandler.execute()},_insert:function(t){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId,{attachmentId:elData(t.currentTarget,"object-id"),url:elData(t.currentTarget,"url")})},_insertAll:function(){this._fileListSelector.children("li:not(.uploadFailed)").find(".jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain").trigger("click")},_error:function(t){this._fileListSelector.find("li").each(function(e,a){var i=$(a);i.children(".fa-spinner").length&&(i.addClass("uploadFailed").children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),i.find("div > div").append($('<small class="innerError">'+(t.responseJSON&&t.responseJSON.message?t.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+"</small>")))})},_makeSortable:function(){var t=this._fileListSelector.children("li:not(.uploadFailed)");t.length&&(t.addClass("sortableAttachment").children("img").addClass("sortableNode"),this._fileListSelector.hasClass("sortableList")||(this._fileListSelector.addClass("sortableList"),require(["Environment"],function(t){"desktop"===t.platform()&&new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:!1,items:"li.sortableAttachment",toleranceElement:null,start:function(t,e){e.placeholder[0].style.setProperty("height",e.helper[0].offsetHeight+"px","")},update:function(){var t=[];this._fileListSelector.children("li:not(.uploadFailed)").each(function(e,a){t.push($(a).data("objectID"))}),t.length&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:t,objectID:this._objectID,objectType:this._objectType,tmpHash:this._tmpHash}}})}.bind(this)},!0)}.bind(this))))}}); })(this);
 
 // WCF.ColorPicker.js
-(function (window, undefined) {"use strict";WCF.ColorPicker=Class.extend({_bar:null,_barActive:!1,_barSelector:null,_dialog:null,_didInit:!1,_elementID:"",_gradient:null,_gradientActive:!1,_gradientSelector:null,_hex:null,_hsv:{},_newColor:null,_oldColor:null,_rgba:{},_rgbaRegExp:null,init:function(t){this._elementID="",this._hsv={h:0,s:100,v:100},this._position={};var a=$(t);return a.length?void a.click($.proxy(this._open,this)):void console.debug("[WCF.ColorPicker] Selector does not match any element, aborting.")},_open:function(t){this._didInit||(this._initColorPicker(),this._didInit=!0);var a=$(t.currentTarget);this._elementID=a.wcfIdentify(),this._parseColor(a);var s=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);this._oldColor.css({backgroundColor:"rgba("+s.r+", "+s.g+", "+s.b+", "+this._rgba.a.val()/100+")"}),this._dialog.wcfDialog({title:WCF.Language.get("wcf.style.colorPicker")}),this._hex.focus()},_parseColor:function(t){if(t.data("hsv")&&t.data("rgb")){var a=t.data("hsv");for(var s in a)this._hsv[s]=a[s];this._updateValues(t.data("rgb"),!0,!0),this._rgba.a.val(parseInt(t.data("alpha")))}else{null===this._rgbaRegExp&&(this._rgbaRegExp=new RegExp("^rgba\\((\\d{1,3}), ?(\\d{1,3}), ?(\\d{1,3}), ?(1|1\\.00?|0|0?\\.[0-9]{1,2})\\)$")),this._rgbaRegExp.exec(t.data("color"));var i=RegExp.$4;0===i.indexOf(".")&&(i="0"+i),i*=100,this._updateValues({r:RegExp.$1,g:RegExp.$2,b:RegExp.$3,a:Math.round(i)},!0,!0)}},_initColorPicker:function(){this._dialog=$('<div id="colorPickerContainer" />').hide().appendTo(document.body),this._gradient=$('<div id="colorPickerGradient" />').appendTo(this._dialog),this._gradientSelector=$('<span id="colorPickerGradientSelector"><span></span></span>').appendTo(this._gradient),this._bar=$('<div id="colorPickerBar" />').appendTo(this._dialog),this._barSelector=$('<span id="colorPickerBarSelector" />').appendTo(this._bar),this._gradient.mousedown($.proxy(this._mouseDownGradient,this)),this._bar.mousedown($.proxy(this._mouseDownBar,this));var t=this;$(document).mouseup(function(a){t._barActive?(t._barActive=!1,t._mouseBar(a)):t._gradientActive&&(t._gradientActive=!1,t._mouseGradient(a))}).mousemove(function(a){t._barActive?t._mouseBar(a):t._gradientActive&&t._mouseGradient(a)}),this._initColorPickerForm()},_initColorPickerForm:function(){var t=$('<div id="colorPickerForm" />').appendTo(this._dialog);$("<small>"+WCF.Language.get("wcf.style.colorPicker.new")+"</small>").appendTo(t);var a=$('<ul class="colors" />').appendTo(t);this._newColor=$('<li class="new"><span /></li>').appendTo(a).children("span"),this._oldColor=$('<li class="old"><span /></li>').appendTo(a).children("span"),$("<small>"+WCF.Language.get("wcf.style.colorPicker.current")+"</small>").appendTo(t);var s=$('<ul class="rgba" />').appendTo(t);this._createInputElement("r","R",0,255).appendTo(s),this._createInputElement("g","G",0,255).appendTo(s),this._createInputElement("b","B",0,255).appendTo(s),this._createInputElement("a","a",0,100).appendTo(s);var i=$('<ul class="hex"><li><label><span>#</span></label></li></ul>').appendTo(t);this._hex=$('<input type="text" maxlength="6" />').appendTo(i.find("label")),this._rgba.r.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.g.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.b.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.a.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._hex.blur($.proxy(this._blurHex,this)).keyup($.proxy(this._keyUpHex,this));var e=$('<div class="formSubmit" />').appendTo(this._dialog);$('<button class="buttonPrimary">'+WCF.Language.get("wcf.style.colorPicker.button.apply")+"</button>").appendTo(e).click($.proxy(this._submit,this));var r=this;this._hex.on("paste",function(){r._hex.attr("maxlength","7"),setTimeout(function(){var t=r._hex.val();"#"==t.substring(0,1)&&(t=t.substr(1)),t.length>6&&(t=t.substring(0,6)),r._hex.attr("maxlength","6").val(t)},50)}),t.find("input").focus(function(){this.select()})},_keyUpRGBA:function(t){13==t.which&&(this._blurRgba(),this._submit())},_keyUpHex:function(t){13==t.which&&(this._blurHex(),this._submit())},_submit:function(){var t=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v),a={};for(var s in this._hsv)a[s]=this._hsv[s];var i=$("#"+this._elementID);i.data("hsv",a).css({backgroundColor:"rgba("+t.r+", "+t.g+", "+t.b+", "+this._rgba.a.val()/100+")"}).data("alpha",parseInt(this._rgba.a.val())),i.data("rgb",{r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()}),$("#"+i.data("store")).val("rgba("+this._rgba.r.val()+", "+this._rgba.g.val()+", "+this._rgba.b.val()+", "+this._rgba.a.val()/100+")").trigger("change"),this._dialog.wcfDialog("close")},_createInputElement:function(t,a,s,i){var e=$('<li class="'+t+'" />'),r=$("<label />").appendTo(e);return $("<span>"+a+"</span>").appendTo(r),this._rgba[t]=$('<input type="number" value="0" min="'+s+'" max="'+i+'" step="1" />').appendTo(r),e},_mouseDownGradient:function(t){this._gradientActive=!0,this._mouseGradient(t)},_mouseGradient:function(t){var a=this._gradient.getOffsets("offset"),s=Math.max(Math.min(t.pageX-a.left,255),0),i=Math.max(Math.min(t.pageY-a.top,255),0);this._hsv.s=100*Math.max(0,Math.min(1,s/255)),this._hsv.v=100*Math.max(0,Math.min(1,(255-i)/255)),this._updateValues(null)},_mouseDownBar:function(t){this._barActive=!0,this._mouseBar(t)},_mouseBar:function(t){var a=this._bar.getOffsets("offset"),s=Math.max(Math.min(t.pageY-a.top,255),0);this._barSelector.css({top:s+"px"}),this._hsv.h=Math.max(0,Math.min(359,Math.round((255-s)/255*360))),this._updateValues(null)},_blurRgba:function(){for(var t in this._rgba){var a=parseInt(this._rgba[t].val())||0;this._rgba[t].val("a"===t?Math.max(0,Math.min(100,a)):Math.max(0,Math.min(255,a)))}this._updateValues({r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()},!0,!0)},_blurHex:function(){var t=this.hexToRgb(this._hex.val());t!==Number.NaN&&this._updateValues(t,!0,!0)},_updateValues:function(t,a,s){a=a===!0?!0:!1,s=s===!0?!0:!1,null===t&&(t=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v),0==this._rgba.a.val()&&(t.a=100)),void 0===t.a&&(t.a=this._rgba.a.val());for(var i in t)this._rgba[i].val(t[i]);if(this._hex.val(this.rgbToHex(t.r,t.g,t.b)),a||s){var e=this.rgbToHsv(t.r,t.g,t.b);a&&(this._hsv.h=e.h),s&&(this._hsv.s=e.s,this._hsv.v=e.v)}var r=Math.max(0,Math.min(255,255-this._hsv.h/360*255));this._barSelector.css({top:r+"px"});var h=Math.max(0,Math.min(255,this._hsv.s/100*255)),r=Math.max(0,Math.min(255,255-this._hsv.v/100*255));this._gradientSelector.css({left:h-6+"px",top:r-6+"px"}),this._newColor.css({backgroundColor:"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a/100+")"});var n=this.hsvToRgb(this._hsv.h,100,100);this._gradient.css({backgroundColor:"rgb("+n.r+", "+n.g+", "+n.b+")"})},hsvToRgb:function(t,a,s){var i,e,r,h,n,o={r:0,g:0,b:0};if(i=Math.floor(t/60),e=t/60-i,a/=100,s/=100,r=s*(1-a),h=s*(1-a*e),n=s*(1-a*(1-e)),0==a)o.r=o.g=o.b=s;else switch(i){case 1:o.r=h,o.g=s,o.b=r;break;case 2:o.r=r,o.g=s,o.b=n;break;case 3:o.r=r,o.g=h,o.b=s;break;case 4:o.r=n,o.g=r,o.b=s;break;case 5:o.r=s,o.g=r,o.b=h;break;case 0:case 6:o.r=s,o.g=n,o.b=r}return{r:Math.round(255*o.r),g:Math.round(255*o.g),b:Math.round(255*o.b)}},rgbToHsv:function(t,a,s){var i,e,r,h,n,o;if(t/=255,a/=255,s/=255,h=Math.max(Math.max(t,a),s),n=Math.min(Math.min(t,a),s),o=h-n,i=0,h!==n){switch(h){case t:i=60*(0+(a-s)/o);break;case a:i=60*(2+(s-t)/o);break;case s:i=60*(4+(t-a)/o)}0>i&&(i+=360)}return e=0===h?0:o/h,r=h,{h:Math.round(i),s:Math.round(100*e),v:Math.round(100*r)}},hexToRgb:function(t){return/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)?(t=t.split(""),"#"===t[0]&&t.shift(),3===t.length?{r:parseInt(t[0]+""+t[0],16),g:parseInt(t[1]+""+t[1],16),b:parseInt(t[2]+""+t[2],16)}:{r:parseInt(t[0]+""+t[1],16),g:parseInt(t[2]+""+t[3],16),b:parseInt(t[4]+""+t[5],16)}):Number.NaN},rgbToHex:function(t,a,s){return"0123456789ABCDEF".charAt((t-t%16)/16)+""+"0123456789ABCDEF".charAt(t%16)+("0123456789ABCDEF".charAt((a-a%16)/16)+""+"0123456789ABCDEF".charAt(a%16))+("0123456789ABCDEF".charAt((s-s%16)/16)+""+"0123456789ABCDEF".charAt(s%16))}}); })(this);
+(function (window, undefined) {"use strict";WCF.ColorPicker=Class.extend({_bar:null,_barActive:!1,_barSelector:null,_dialog:null,_didInit:!1,_elementID:"",_gradient:null,_gradientActive:!1,_gradientSelector:null,_hex:null,_hsv:{},_newColor:null,_oldColor:null,_rgba:{},_rgbaRegExp:null,init:function(t){this._elementID="",this._hsv={h:0,s:100,v:100},this._position={};var a=$(t);return a.length?void a.click($.proxy(this._open,this)):void console.debug("[WCF.ColorPicker] Selector does not match any element, aborting.")},_open:function(t){this._didInit||(this._initColorPicker(),this._didInit=!0);var a=$(t.currentTarget);this._elementID=a.wcfIdentify(),this._parseColor(a);var i=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);this._oldColor.css({backgroundColor:"rgba("+i.r+", "+i.g+", "+i.b+", "+this._rgba.a.val()/100+")"}),this._dialog.wcfDialog({title:WCF.Language.get("wcf.style.colorPicker")}),window.setTimeout(function(){this._hex.focus()}.bind(this),200)},_parseColor:function(t){if(t.data("hsv")&&t.data("rgb")){var a=t.data("hsv");for(var i in a)this._hsv[i]=a[i];this._updateValues(t.data("rgb"),!0,!0),this._rgba.a.val(parseInt(t.data("alpha")))}else{null===this._rgbaRegExp&&(this._rgbaRegExp=new RegExp("^rgba\\((\\d{1,3}), ?(\\d{1,3}), ?(\\d{1,3}), ?(1|1\\.00?|0|0?\\.[0-9]{1,2})\\)$")),this._rgbaRegExp.exec(t.data("color"));var s=RegExp.$4;0===s.indexOf(".")&&(s="0"+s),s*=100,this._updateValues({r:RegExp.$1,g:RegExp.$2,b:RegExp.$3,a:Math.round(s)},!0,!0)}},_initColorPicker:function(){this._dialog=$('<div id="colorPickerContainer" />').hide().appendTo(document.body),this._gradient=$('<div id="colorPickerGradient" />').appendTo(this._dialog),this._gradientSelector=$('<span id="colorPickerGradientSelector"><span></span></span>').appendTo(this._gradient),this._bar=$('<div id="colorPickerBar" />').appendTo(this._dialog),this._barSelector=$('<span id="colorPickerBarSelector" />').appendTo(this._bar),this._gradient.mousedown($.proxy(this._mouseDownGradient,this)),this._bar.mousedown($.proxy(this._mouseDownBar,this));var t=this;$(document).mouseup(function(a){t._barActive?(t._barActive=!1,t._mouseBar(a)):t._gradientActive&&(t._gradientActive=!1,t._mouseGradient(a))}).mousemove(function(a){t._barActive?t._mouseBar(a):t._gradientActive&&t._mouseGradient(a)}),this._initColorPickerForm()},_initColorPickerForm:function(){var t=$('<div id="colorPickerForm" />').appendTo(this._dialog);$("<small>"+WCF.Language.get("wcf.style.colorPicker.new")+"</small>").appendTo(t);var a=$('<ul class="colors" />').appendTo(t);this._newColor=$('<li class="new"><span /></li>').appendTo(a).children("span"),this._oldColor=$('<li class="old"><span /></li>').appendTo(a).children("span"),$("<small>"+WCF.Language.get("wcf.style.colorPicker.current")+"</small>").appendTo(t);var i=$('<ul class="rgba" />').appendTo(t);this._createInputElement("r","R",0,255).appendTo(i),this._createInputElement("g","G",0,255).appendTo(i),this._createInputElement("b","B",0,255).appendTo(i),this._createInputElement("a","a",0,100).appendTo(i);var s=$('<ul class="hex"><li><label><span>#</span></label></li></ul>').appendTo(t);this._hex=$('<input type="text" maxlength="6" />').appendTo(s.find("label")),this._rgba.r.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.g.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.b.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._rgba.a.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this)),this._hex.blur($.proxy(this._blurHex,this)).keyup($.proxy(this._keyUpHex,this));var e=$('<div class="formSubmit" />').appendTo(this._dialog);$('<button class="buttonPrimary">'+WCF.Language.get("wcf.style.colorPicker.button.apply")+"</button>").appendTo(e).click($.proxy(this._submit,this));var r=this;this._hex.on("paste",function(){r._hex.attr("maxlength","7"),setTimeout(function(){var t=r._hex.val();"#"==t.substring(0,1)&&(t=t.substr(1)),t.length>6&&(t=t.substring(0,6)),r._hex.attr("maxlength","6").val(t)},50)}),t.find("input").focus(function(){this.select()})},_keyUpRGBA:function(t){13==t.which&&(this._blurRgba(),this._submit())},_keyUpHex:function(t){13==t.which&&(this._blurHex(),this._submit())},_submit:function(){var t=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v),a={};for(var i in this._hsv)a[i]=this._hsv[i];var s=$("#"+this._elementID);s.data("hsv",a).css({backgroundColor:"rgba("+t.r+", "+t.g+", "+t.b+", "+this._rgba.a.val()/100+")"}).data("alpha",parseInt(this._rgba.a.val())),s.data("rgb",{r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()}),$("#"+s.data("store")).val("rgba("+this._rgba.r.val()+", "+this._rgba.g.val()+", "+this._rgba.b.val()+", "+this._rgba.a.val()/100+")").trigger("change"),this._dialog.wcfDialog("close")},_createInputElement:function(t,a,i,s){var e=$('<li class="'+t+'" />'),r=$("<label />").appendTo(e);return $("<span>"+a+"</span>").appendTo(r),this._rgba[t]=$('<input type="number" value="0" min="'+i+'" max="'+s+'" step="1" />').appendTo(r),e},_mouseDownGradient:function(t){this._gradientActive=!0,this._mouseGradient(t)},_mouseGradient:function(t){var a=this._gradient.getOffsets("offset"),i=Math.max(Math.min(t.pageX-a.left,255),0),s=Math.max(Math.min(t.pageY-a.top,255),0);this._hsv.s=100*Math.max(0,Math.min(1,i/255)),this._hsv.v=100*Math.max(0,Math.min(1,(255-s)/255)),this._updateValues(null)},_mouseDownBar:function(t){this._barActive=!0,this._mouseBar(t)},_mouseBar:function(t){var a=this._bar.getOffsets("offset"),i=Math.max(Math.min(t.pageY-a.top,255),0);this._barSelector.css({top:i+"px"}),this._hsv.h=Math.max(0,Math.min(359,Math.round((255-i)/255*360))),this._updateValues(null)},_blurRgba:function(){for(var t in this._rgba){var a=parseInt(this._rgba[t].val())||0;this._rgba[t].val("a"===t?Math.max(0,Math.min(100,a)):Math.max(0,Math.min(255,a)))}this._updateValues({r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()},!0,!0)},_blurHex:function(){var t=this.hexToRgb(this._hex.val());t!==Number.NaN&&this._updateValues(t,!0,!0)},_updateValues:function(t,a,i){a=a===!0?!0:!1,i=i===!0?!0:!1,null===t&&(t=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v),0==this._rgba.a.val()&&(t.a=100)),void 0===t.a&&(t.a=this._rgba.a.val());for(var s in t)this._rgba[s].val(t[s]);if(this._hex.val(this.rgbToHex(t.r,t.g,t.b)),a||i){var e=this.rgbToHsv(t.r,t.g,t.b);a&&(this._hsv.h=e.h),i&&(this._hsv.s=e.s,this._hsv.v=e.v)}var r=Math.max(0,Math.min(255,255-this._hsv.h/360*255));this._barSelector.css({top:r+"px"});var h=Math.max(0,Math.min(255,this._hsv.s/100*255)),r=Math.max(0,Math.min(255,255-this._hsv.v/100*255));this._gradientSelector.css({left:h-6+"px",top:r-6+"px"}),this._newColor.css({backgroundColor:"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a/100+")"});var n=this.hsvToRgb(this._hsv.h,100,100);this._gradient.css({backgroundColor:"rgb("+n.r+", "+n.g+", "+n.b+")"})},hsvToRgb:function(t,a,i){var s,e,r,h,n,o={r:0,g:0,b:0};if(s=Math.floor(t/60),e=t/60-s,a/=100,i/=100,r=i*(1-a),h=i*(1-a*e),n=i*(1-a*(1-e)),0==a)o.r=o.g=o.b=i;else switch(s){case 1:o.r=h,o.g=i,o.b=r;break;case 2:o.r=r,o.g=i,o.b=n;break;case 3:o.r=r,o.g=h,o.b=i;break;case 4:o.r=n,o.g=r,o.b=i;break;case 5:o.r=i,o.g=r,o.b=h;break;case 0:case 6:o.r=i,o.g=n,o.b=r}return{r:Math.round(255*o.r),g:Math.round(255*o.g),b:Math.round(255*o.b)}},rgbToHsv:function(t,a,i){var s,e,r,h,n,o;if(t/=255,a/=255,i/=255,h=Math.max(Math.max(t,a),i),n=Math.min(Math.min(t,a),i),o=h-n,s=0,h!==n){switch(h){case t:s=60*(0+(a-i)/o);break;case a:s=60*(2+(i-t)/o);break;case i:s=60*(4+(t-a)/o)}0>s&&(s+=360)}return e=0===h?0:o/h,r=h,{h:Math.round(s),s:Math.round(100*e),v:Math.round(100*r)}},hexToRgb:function(t){return/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(t)?(t=t.split(""),"#"===t[0]&&t.shift(),3===t.length?{r:parseInt(t[0]+""+t[0],16),g:parseInt(t[1]+""+t[1],16),b:parseInt(t[2]+""+t[2],16)}:{r:parseInt(t[0]+""+t[1],16),g:parseInt(t[2]+""+t[3],16),b:parseInt(t[4]+""+t[5],16)}):Number.NaN},rgbToHex:function(t,a,i){return"0123456789ABCDEF".charAt((t-t%16)/16)+""+"0123456789ABCDEF".charAt(t%16)+("0123456789ABCDEF".charAt((a-a%16)/16)+""+"0123456789ABCDEF".charAt(a%16))+("0123456789ABCDEF".charAt((i-i%16)/16)+""+"0123456789ABCDEF".charAt(i%16))}}); })(this);
 
 // WCF.Comment.js
 (function (window, undefined) {"use strict";WCF.Comment={},WCF.Comment.Handler=Class.extend({_commentAdd:null,_commentButtonList:{},_comments:{},_container:null,_containerID:"",_displayedComments:0,_loadNextComments:null,_loadNextResponses:{},_proxy:null,_responses:{},_userAvatar:"",_userAvatarSmall:"",_commentData:{},_guestDialog:null,init:function(e,t,s){this._commentAdd=null,this._commentButtonList={},this._comments={},this._containerID=e,this._displayedComments=0,this._loadNextComments=null,this._loadNextResponses={},this._responses={},this._userAvatar=t,this._userAvatarSmall=s,this._container=$("#"+$.wcfEscapeID(this._containerID)),this._container.length||console.debug("[WCF.Comment.Handler] Unable to find container identified by '"+this._containerID+"'"),this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)}),this._initComments(),this._initResponses(),this._container.data("canAdd")&&this._initAddComment(),WCF.DOMNodeInsertedHandler.execute(),WCF.DOMNodeInsertedHandler.addCallback("WCF.Comment.Handler",$.proxy(this._domNodeInserted,this)),WCF.System.ObjectStore.add("WCF.Comment.Handler",this)},_handleLoadNextComments:function(){this._displayedComments<this._container.data("comments")?(null===this._loadNextComments&&(this._loadNextComments=$('<li class="commentLoadNext showMore"><button class="small">'+WCF.Language.get("wcf.comment.more")+"</button></li>").appendTo(this._container),this._loadNextComments.children("button").click($.proxy(this._loadComments,this))),this._loadNextComments.children("button").enable()):null!==this._loadNextComments&&this._loadNextComments.remove()},_handleLoadNextResponses:function(e){var t=this._comments[e];if(t.data("displayedResponses",t.find("ul.commentResponseList > li").length),t.data("displayedResponses")<t.data("responses")){if(void 0===this._loadNextResponses[e]){var s=t.data("responses")-t.data("displayedResponses");this._loadNextResponses[e]=$('<li class="jsCommentLoadNextResponses"><a>'+WCF.Language.get("wcf.comment.response.more",{count:s})+"</a></li>").appendTo(this._commentButtonList[e]),this._loadNextResponses[e].children("a").data("commentID",e).click($.proxy(this._loadResponses,this)),this._commentButtonList[e].parent().show()}}else if(void 0!==this._loadNextResponses[e]){var n=this._loadNextResponses[e].next();this._loadNextResponses[e].remove(),n.length&&n.trigger("click")}},_loadComments:function(){this._loadNextComments.children("button").disable(),this._proxy.setOption("data",{actionName:"loadComments",className:"wcf\\data\\comment\\CommentAction",parameters:{data:{objectID:this._container.data("objectID"),objectTypeID:this._container.data("objectTypeID"),lastCommentTime:this._container.data("lastCommentTime")}}}),this._proxy.sendRequest()},_loadResponses:function(e){this._loadResponsesExecute($(e.currentTarget).disable().data("commentID"),!1)},_loadResponsesExecute:function(e,t){this._proxy.setOption("data",{actionName:"loadResponses",className:"wcf\\data\\comment\\response\\CommentResponseAction",parameters:{data:{commentID:e,lastResponseTime:this._comments[e].data("lastResponseTime"),loadAllResponses:t?1:0}}}),this._proxy.sendRequest()},_domNodeInserted:function(){this._initComments(),this._initResponses()},_initComments:function(){var e=this,t=!1;this._container.find(".jsComment").each(function(s,n){var a=$(n).removeClass("jsComment"),o=a.data("commentID");e._comments[o]=a;var i=a.find("ul.commentResponseList");i.length||(i=a.find(".commentContent"));var r=$('<div class="commentOptionContainer" />').hide().insertAfter(i);e._commentButtonList[o]=$('<ul class="inlineList dotSeparated" />').appendTo(r),e._handleLoadNextResponses(o),e._initComment(o,a),e._displayedComments++,t=!0}),t&&this._handleLoadNextComments()},_initComment:function(e,t){if(this._container.data("canAdd")&&this._initAddResponse(e,t),t.data("canEdit")){var s=$('<li><a href="#" class="jsTooltip" title="'+WCF.Language.get("wcf.global.button.edit")+'"><span class="icon icon16 fa-pencil" /> <span class="invisible">'+WCF.Language.get("wcf.global.button.edit")+"</span></a></li>");s.data("commentID",e).appendTo(t.find("ul.buttonList:eq(0)")).click($.proxy(this._prepareEdit,this))}if(t.data("canDelete")){var n=$('<li><a href="#" class="jsTooltip" title="'+WCF.Language.get("wcf.global.button.delete")+'"><span class="icon icon16 fa-times" /> <span class="invisible">'+WCF.Language.get("wcf.global.button.delete")+"</span></a></li>");n.data("commentID",e).appendTo(t.find("ul.buttonList:eq(0)")).click($.proxy(this._delete,this))}},_initResponses:function(){var e=this;this._container.find(".jsCommentResponse").each(function(t,s){var n=$(s).removeClass("jsCommentResponse"),a=n.data("responseID");e._responses[a]=n,e._initResponse(a,n)})},_initResponse:function(e,t){if(t.data("canEdit")){var s=$('<li><a href="#" class="jsTooltip" title="'+WCF.Language.get("wcf.global.button.edit")+'"><span class="icon icon16 fa-pencil" /> <span class="invisible">'+WCF.Language.get("wcf.global.button.edit")+"</span></a></li>"),n=this;s.data("responseID",e).appendTo(t.find("ul.buttonList:eq(0)")).click(function(e){n._prepareEdit(e,!0)})}if(t.data("canDelete")){var a=$('<li><a href="#" class="jsTooltip" title="'+WCF.Language.get("wcf.global.button.delete")+'"><span class="icon icon16 fa-times" /> <span class="invisible">'+WCF.Language.get("wcf.global.button.delete")+"</span></a></li>"),n=this;a.data("responseID",e).appendTo(t.find("ul.buttonList:eq(0)")).click(function(e){n._delete(e,!0)})}},_initAddComment:function(){this._commentAdd=$('<li class="box48 jsCommentAdd">'+this._userAvatar+"<div /></li>").prependTo(this._container);var e=this._commentAdd.children("div"),t=$('<textarea placeholder="'+WCF.Language.get("wcf.comment.add")+'" maxlength="65535" class="long" />').appendTo(e).flexible();$('<button class="small">'+WCF.Language.get("wcf.global.button.submit")+"</button>").click($.proxy(this._save,this)).appendTo(e),t.keyup($.proxy(this._keyUp,this))},_initAddResponse:function(e,t){var s=$('<li class="jsCommentShowAddResponse"><a>'+WCF.Language.get("wcf.comment.button.response.add")+"</a></li>").data("commentID",e).click($.proxy(this._showAddResponse,this)).appendTo(this._commentButtonList[e]),n=$('<div class="box32 commentResponseAdd jsCommentResponseAdd">'+this._userAvatarSmall+"<div /></div>").hide();n.appendTo(this._commentButtonList[e].parent().show());var a=n.children("div"),o=$('<textarea placeholder="'+WCF.Language.get("wcf.comment.response.add")+'" maxlength="65535" class="long" />').data("commentID",e).appendTo(a).flexible();$('<button class="small">'+WCF.Language.get("wcf.global.button.submit")+"</button>").click($.proxy(function(e){this._save(e,!0)},this)).appendTo(a);var i=this;o.keyup(function(e){i._keyUp(e,!0)}),t.data("responsePlaceholder",s).data("responseInput",n)},_prepareEdit:function(e,t){e.preventDefault();var s=$(e.currentTarget),n={objectID:this._container.data("objectID"),objectTypeID:this._container.data("objectTypeID")};t===!0?n.responseID=s.data("responseID"):n.commentID=s.data("commentID"),this._proxy.setOption("data",{actionName:"prepareEdit",className:"wcf\\data\\comment\\CommentAction",parameters:{data:n}}),this._proxy.sendRequest()},_showAddResponse:function(e){var t=$(e.currentTarget),s=t.data("commentID");t.prev().hasClass("jsCommentLoadNextResponses")&&(this._loadResponsesExecute(s,!0),t.parent().children(".button").disable()),t.remove();var n=this._comments[s].data("responseInput").show();n.find("textarea").focus(),n.parents(".commentOptionContainer").addClass("jsAddResponseActive")},_keyUp:function(e,t){return e.which===$.ui.keyCode.ESCAPE?void $(e.currentTarget).val("").trigger("blur",e).trigger("updateHeight"):e.which===$.ui.keyCode.ENTER&&e.ctrlKey?(this._save(null,t,$(e.currentTarget)),!1):void 0},_save:function(e,t,s){var n=null===e?s:$(e.currentTarget).parent().children("textarea");n.next("small.innerError").remove();var a=$.trim(n.val());if(""!=a){var o="addComment",i={message:a,objectID:this._container.data("objectID"),objectTypeID:this._container.data("objectTypeID")};t===!0&&(o="addResponse",i.commentID=n.data("commentID")),WCF.User.userID?new WCF.Action.Proxy({autoSend:!0,data:{actionName:o,className:"wcf\\data\\comment\\CommentAction",parameters:{data:i}},success:$.proxy(this._success,this),failure:function(e,t,s,a){return e.returnValues&&e.returnValues.fieldName&&"text"===e.returnValues.fieldName&&e.returnValues.errorType?($('<small class="innerError">'+e.returnValues.errorType+"</small>").insertAfter(n),!1):void this._failure(e,t,s,a)}.bind(this)}):(this._commentData=i,this._proxy.setOption("data",{actionName:"getGuestDialog",className:"wcf\\data\\comment\\CommentAction",parameters:{data:{message:a,objectID:this._container.data("objectID"),objectTypeID:this._container.data("objectTypeID")}}}),this._proxy.sendRequest())}},_delete:function(e,t){e.preventDefault(),WCF.System.Confirmation.show(WCF.Language.get("wcf.comment.delete.confirmMessage"),$.proxy(function(s){if("confirm"===s){var n={objectID:this._container.data("objectID"),objectTypeID:this._container.data("objectTypeID")};t!==!0?n.commentID=$(e.currentTarget).data("commentID"):n.responseID=$(e.currentTarget).data("responseID"),this._proxy.setOption("data",{actionName:"remove",className:"wcf\\data\\comment\\CommentAction",parameters:{data:n}}),this._proxy.sendRequest()}},this))},_failure:function(){return!WCF.User.userID&&this._guestDialog&&this._guestDialog.find('input[type="submit"]').enable(),!0},_success:function(e){switch(e.actionName){case"addComment":e.returnValues.guestDialog?this._createGuestDialog(e.returnValues.guestDialog,e.returnValues.useCaptcha):(this._commentAdd.find("textarea").val("").blur().trigger("updateHeight"),$(e.returnValues.template).insertAfter(this._commentAdd).wcfFadeIn(),WCF.User.userID||this._guestDialog.wcfDialog("close"));break;case"addResponse":if(e.returnValues.guestDialog)this._createGuestDialog(e.returnValues.guestDialog,e.returnValues.useCaptcha);else{var t=this._comments[e.returnValues.commentID];t.find(".jsCommentResponseAdd textarea").val("").blur().trigger("updateHeight");var s=t.find("ul.commentResponseList");s.length||(s=$('<ul class="containerList commentResponseList" />').insertBefore(t.find(".commentOptionContainer"))),$(e.returnValues.template).appendTo(s).wcfFadeIn(),WCF.User.userID||this._guestDialog.wcfDialog("close")}break;case"edit":this._update(e);break;case"loadComments":this._insertComments(e);break;case"loadResponses":this._insertResponses(e);break;case"prepareEdit":this._edit(e);break;case"remove":this._remove(e);break;case"getGuestDialog":this._createGuestDialog(e.returnValues.template,e.returnValues.useCaptcha)}WCF.DOMNodeInsertedHandler.execute()},_insertComments:function(e){$(e.returnValues.template).insertBefore(this._loadNextComments),this._container.data("lastCommentTime",e.returnValues.lastCommentTime)},_insertResponses:function(e){var t=this._comments[e.returnValues.commentID];$(e.returnValues.template).appendTo(t.find("ul.commentResponseList")),t.data("lastResponseTime",e.returnValues.lastResponseTime),this._handleLoadNextResponses(e.returnValues.commentID)},_remove:function(e){if(e.returnValues.commentID)this._comments[e.returnValues.commentID].remove(),delete this._comments[e.returnValues.commentID];else{var t=this._responses[e.returnValues.responseID],s=this._comments[t.parents("li.comment:eq(0)").data("commentID")];s.data("responses",parseInt(s.data("responses"))-1);var n=t.parent();t.remove(),n.children().length||n.empty(),delete this._responses[e.returnValues.responseID]}},_edit:function(e){var t;t=e.returnValues.commentID?this._comments[e.returnValues.commentID].find(".commentContent:eq(0) .userMessage:eq(0)"):this._responses[e.returnValues.responseID].find(".commentContent:eq(0) .userMessage:eq(0)"),t.html($.proxy(function(t,s){var n=$('<textarea class="long" maxlength="65535" />').val(e.returnValues.message);return n.data("__html",s).keyup($.proxy(this._keyUpEdit,this)),e.returnValues.commentID?n.data("commentID",e.returnValues.commentID):n.data("responseID",e.returnValues.responseID),n},this));var s=t.children("textarea");$('<button class="small">'+WCF.Language.get("wcf.global.button.submit")+"</button>").insertAfter(s).click($.proxy(this._saveEdit,this)),s.focus().flexible(),t.parent().find(".containerHeadline:eq(0)").hide(),t.parent().find(".buttonGroupNavigation:eq(0)").hide()},_update:function(e){var t;t=e.returnValues.commentID?this._comments[e.returnValues.commentID].find(".commentContent:eq(0) .userMessage:eq(0) > textarea"):this._responses[e.returnValues.responseID].find(".commentContent:eq(0) .userMessage:eq(0) > textarea"),t.data("__html",e.returnValues.message),this._cancelEdit(t)},_createGuestDialog:function(e,t){!!this._guestDialog;this._guestDialog||(this._guestDialog=$('<div id="commentAddGuestDialog" />').hide().appendTo(document.body)),this._guestDialog.html(e),this._guestDialog.data("useCaptcha",t),this._guestDialog.find('input[type="submit"]').click($.proxy(this._submit,this)),this._guestDialog.find('input[type="text"]').keydown($.proxy(this._keyDown,this)),this._guestDialog.wcfDialog({title:WCF.Language.get("wcf.comment.guestDialog.title")})},_keyDown:function(e){e.which===$.ui.keyCode.ENTER&&this._submit()},_submit:function(){var e={actionName:this._commentData.commentID?"addResponse":"addComment",className:"wcf\\data\\comment\\CommentAction"},t=this._commentData;t.username=this._guestDialog.find('input[name="username"]').val(),e.parameters={data:t},e=$.extend(WCF.System.Captcha.getData("commentAdd"),e),this._proxy.setOption("data",e),this._proxy.sendRequest()},_keyUpEdit:function(e){return e.which===$.ui.keyCode.ESCAPE?void this._cancelEdit($(e.currentTarget)):e.which===$.ui.keyCode.ENTER&&e.ctrlKey?(this._saveEdit(e),!1):void 0},_saveEdit:function(e){var t=$(e.currentTarget);t.is("button")&&(t.prev("small.innerError").remove(),t=t.prev("textarea"));var s=$.trim(t.val());if(""!==s){var n={message:s,objectID:this._container.data("objectID"),objectTypeID:this._container.data("objectTypeID")};t.data("commentID")?n.commentID=t.data("commentID"):n.responseID=t.data("responseID"),new WCF.Action.Proxy({autoSend:!0,data:{actionName:"edit",className:"wcf\\data\\comment\\CommentAction",parameters:{data:n}},success:$.proxy(this._success,this),failure:function(e,s,n,a){return e.returnValues&&e.returnValues.fieldName&&"text"===e.returnValues.fieldName&&e.returnValues.errorType?($('<small class="innerError">'+e.returnValues.errorType+"</small>").insertAfter(t),!1):void this._failure(e,s,n,a)}.bind(this)})}},_cancelEdit:function(e){e.parent().prev(".containerHeadline:eq(0)").show(),e.parent().next(".buttonGroupNavigation:eq(0)").show(),e.parent().html(e.data("__html"))}}),WCF.Comment.Response={}; })(this);