Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Mon, 5 Dec 2016 10:31:47 +0000 (11:31 +0100)
committerwoltlab.com <woltlab@woltlab.com>
Mon, 5 Dec 2016 10:31:47 +0000 (11:31 +0100)
wcfsetup/install/files/js/WCF.Combined.min.js

index b23ecfb7c8e280e6ac7c6c6486027e621bd05539..b5f2f048d3965056a5712d1c055fe0e69962d543 100755 (executable)
@@ -81,7 +81,7 @@ WCF.CloseOverlayHandler={addCallback:function(e,t){require(["Ui/CloseOverlay"],f
 (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);
+(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.parent().children("small.innerError").remove(),t=t.parent().children("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);
 
 // WCF.ImageViewer.js
 (function (window, undefined) {"use strict";WCF.ImageViewer=Class.extend({_triggerElement:null,init:function(){this._triggerElement=$('<span class="wcfImageViewerTriggerElement" />').data("disableSlideshow",!0).hide().appendTo(document.body),this._triggerElement.wcfImageViewer({enableSlideshow:0,imageSelector:".jsImageViewerEnabled",staticViewer:!0}),WCF.DOMNodeInsertedHandler.addCallback("WCF.ImageViewer",$.proxy(this._domNodeInserted,this)),WCF.DOMNodeInsertedHandler.execute()},_domNodeInserted:function(){this._initImageSizeCheck(),this._rebuildImageViewer()},_rebuildImageViewer:function(){var i=$("a.jsImageViewer");i.length&&i.removeClass("jsImageViewer").addClass("jsImageViewerEnabled").click($.proxy(this._click,this))},_click:function(i){i.ctrlKey||(i.preventDefault(),i.stopPropagation(),$(i.currentTarget).closest(".popover").length||this._triggerElement.wcfImageViewer("open",null,$(i.currentTarget).wcfIdentify()))},_initImageSizeCheck:function(){$(".jsResizeImage").each($.proxy(function(i,e){e.complete&&this._checkImageSize({currentTarget:e})},this)),$(".jsResizeImage").on("load",$.proxy(this._checkImageSize,this))},_checkImageSize:function(i){var e=$(i.currentTarget);if(!e.is(":visible"))return void e.off("load");if(e.removeClass("jsResizeImage"),!e.closest(".messageSignature").length){var t=new Image;t.src=e.attr("src");var s=e.closest("div.messageText, div.messageTextPreview").width();s<t.width?e.parents("a").length||(e.wrap('<a href="'+e.attr("src")+'" class="jsImageViewerEnabled embeddedImageLink" />'),e.parent().click($.proxy(this._click,this)),"right"==e.css("float")?e.parent().addClass("messageFloatObjectRight"):"left"==e.css("float")&&e.parent().addClass("messageFloatObjectLeft"),e[0].style.removeProperty("float"),e[0].style.removeProperty("margin")):e.removeClass("embeddedAttachmentLink")}}}),$.widget("ui.wcfImageViewer",{_active:-1,_activeImage:null,_container:null,_didInit:!1,_disableSlideshow:!1,_eventNamespace:"",_images:[],_isMobile:!1,_isOpen:!1,_items:-1,_maxDimensions:{height:0,width:0},_proxy:null,_slideshowEnabled:!1,_thumbnailContainerWidth:0,_thumbnailMarginRight:0,_thumbnailOffset:0,_thumbnailWidth:0,_timer:null,_ui:{buttonNext:null,buttonPrevious:null,header:null,image:null,imageContainer:null,imageList:null,slideshow:{container:null,enlarge:null,next:null,previous:null,toggle:null}},options:{shiftBy:5,enableSlideshow:1,speed:5,className:"",imageSelector:"",staticViewer:!1},_create:function(){this._active=-1,this._activeImage=null,this._container=null,this._didInit=!1,this._disableSlideshow=this.element.data("disableSlideshow"),this._eventNamespace=this.element.wcfIdentify(),this._images=[],this._isMobile=!1,this._isOpen=!1,this._items=-1,this._maxDimensions={height:document.documentElement.clientHeight,width:document.documentElement.clientWidth},this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._slideshowEnabled=!1,this._thumbnailContainerWidth=0,this._thumbnailMarginRight=0,this._thumbnailOffset=0,this._thumbnaiLWidth=0,this._timer=null,this._ui={},this.element.click($.proxy(this.open,this)),window.addEventListener("popstate",function(i){return null!=i.state&&"imageViewer"===i.state.name&&i.state.container===this._eventNamespace?(this.open(i),void this.showImage(i.state.image)):void this.close(i)}.bind(this))},open:function(i,e){if(i&&i.preventDefault(),this._isOpen)return!1;if(i&&"popstate"===i.type||window.history.pushState({name:"imageViewer"},"",""),this.options.staticViewer){var t=this._getStaticImages();this._initUI(),this._createThumbnails(t,!0),this._render(!0,void 0,e),this._isOpen=!0,WCF.System.DisableScrolling.disable(),WCF.System.DisableZoom.disable(),$.browser.touch&&setTimeout($.proxy(function(){this._isMobile&&!this._container.hasClass("maximized")&&this._toggleView()},this),500)}else 0===this._images.length?this._loadNextImages(!0):(this._render(!1,this.element.data("targetImageID")),this._items>1&&this._slideshowEnabled&&this.startSlideshow(),this._isOpen=!0,WCF.System.DisableScrolling.disable(),WCF.System.DisableZoom.disable());return this._bindListener(),document.documentElement.classList.add("pageOverlayActive"),!0},close:function(i){return i&&i.preventDefault(),i&&"popstate"===i.type?this._isOpen?(this._container.removeClass("open"),null!==this._timer&&this._timer.stop(),this._unbindListener(),this._isOpen=!1,WCF.System.DisableScrolling.enable(),WCF.System.DisableZoom.enable(),document.documentElement.classList.remove("pageOverlayActive"),!0):!1:void window.history.back()},startSlideshow:function(){return this._disableSlideshow||this._slideshowEnabled?!1:(null===this._timer?this._timer=new WCF.PeriodicalExecuter($.proxy(function(){var i=this._active+1;i==this._items&&(i=0),this.showImage(i)},this),1e3*this.options.speed):this._timer.resume(),this._slideshowEnabled=!0,this._ui.slideshow.toggle.children("span").removeClass("fa-play").addClass("fa-pause"),!0)},stopSlideshow:function(i){return this._slideshowEnabled?(this._timer.stop(),i&&this._ui.slideshow.toggle.children("span").removeClass("fa-pause").addClass("fa-play"),this._slideshowEnabled=!1,!0):!1},_bindListener:function(){$(document).on("keydown."+this._eventNamespace,$.proxy(this._keyDown,this)),$(window).on("resize."+this._eventNamespace,$.proxy(this._renderImage,this))},_unbindListener:function(){$(document).off("keydown."+this._eventNamespace),$(window).off("resize."+this._eventNamespace)},_keyDown:function(i){switch(i.which){case $.ui.keyCode.ESCAPE:this.close();break;case $.ui.keyCode.LEFT:this._previousImage();break;case $.ui.keyCode.RIGHT:this._nextImage();break;case $.ui.keyCode.UP:this._container.hasClass("maximized")||this._toggleView();break;case $.ui.keyCode.DOWN:this._container.hasClass("maximized")&&this._toggleView();break;case $.ui.keyCode.ENTER:var e=this._ui.header.find("> div > h1 > a");1==e.length?window.location=e.prop("href"):this._ui.slideshow.full.trigger("click");break;case 80:this._ui.slideshow.toggle.trigger("click");break;default:return!0}return!1},_render:function(i,e,t){this._container.addClass("open");var s=null;if(i&&(s=this._ui.imageList.children("li:eq(0)"),this._thumbnailMarginRight=parseInt(s.css("marginRight").replace(/px$/,""))||0,this._thumbnailWidth=s.outerWidth(!0),this._thumbnailContainerWidth=this._ui.imageList.parent().innerWidth(),this._items>1&&this.options.enableSlideshow&&!e&&!t&&this.startSlideshow()),e)this._ui.imageList.children("li").each($.proxy(function(i,t){var s=$(t);return s.data("objectID")==e?(s.trigger("click"),this.moveToImage(s.data("index")),!1):void 0},this));else if(t){var a=0;$(this.options.imageSelector).each(function(i,e){return $(e).wcfIdentify()==t?(a=i,!1):void 0});var n=this._ui.imageList.children("li:eq("+a+")");if(-1!==this._active){var h=!1;this._active!=n.data("index")&&(h=!0),this._ui.images[this._activeImage].prop("src")!=this._images[this._active].image.url&&(h=!0),h&&(this._active=-1)}n.trigger("click"),this.moveToImage(n.data("index"))}else null!==s&&s.trigger("click");this._toggleButtons(),this._preload()},_preload:function(){if(this._images.length<this._items){var i=this._images.length*this._thumbnailWidth;i-this._thumbnailOffset<this._thumbnailContainerWidth&&this._loadNextImages(!1)}},_showImage:function(i){this.showImage($(i.currentTarget).data("index"),!0)},showImage:function(i,e){if(this._active==i)return!1;this.stopSlideshow(e||!1),-1!=this._active&&this._images[this._active].listItem.removeClass("active"),this._active=i,window.history.replaceState({name:"imageViewer",container:this._eventNamespace,image:this._active},"","");var t=this._images[i];this._ui.imageList.children("li").removeClass("active"),t.listItem.addClass("active");var s=this._ui.imageContainer.getDimensions("inner"),a=this._activeImage?0:1;null!==this._activeImage&&this._ui.images[this._activeImage].removeClass("active"),this._activeImage=a;var n=this._active;if(this._ui.imageContainer.addClass("loading"),this._ui.images[a].off("load").prop("src","data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw=="),this._ui.images[a].on("load",$.proxy(function(){this._imageOnLoad(n,a)},this)),this._renderImage(a,t,s),!this.options.staticViewer){var h=this._ui.header.find("> div > a").prop("href",t.user.link).prop("title",t.user.username);h.children("img").prop("src",t.user.avatarURL)}var o=WCF.String.escapeHTML(t.image.title);if(t.image.link&&(o='<a href="'+t.image.link+'">'+o+"</a>"),this._ui.header.find("> div > h1").html(o),!this.options.staticViewer){var l=t.series&&t.series.title?WCF.String.escapeHTML(t.series.title):"";t.series.link&&(l='<a href="'+t.series.link+'">'+l+"</a>"),this._ui.header.find("> div > h2").html(l)}return this._ui.header.find("> div > h3").text(WCF.Language.get("wcf.imageViewer.seriesIndex").replace(/{x}/,t.listItem.data("index")+1).replace(/{y}/,this._items)),this._ui.slideshow.full.data("link",t.image.fullURL?t.image.fullURL:t.image.url),this.moveToImage(t.listItem.data("index")),this._toggleButtons(),!0},_imageOnLoad:function(i,e){i==this._active&&(this._ui.imageContainer.removeClass("loading"),this._ui.images[e].addClass("active"),this.options.staticViewer&&this._renderImage(e,null),this.startSlideshow())},_renderImage:function(i,e,t){var s=!0;e||(i=this._activeImage,e=this._images[this._active],t={height:$(window).height()-(this._container.hasClass("maximized")||this._container.hasClass("wcfImageViewerMobile")?0:200),width:this._ui.imageContainer.innerWidth()},s=!1),t.height-=22,t.width-=20;var a=this._ui.images[i];if(a.prop("src")!==e.image.url&&a.prop("src",e.image.url),s&&a[0].complete&&a.trigger("load"),this.options.staticViewer&&!e.image.height&&a[0].complete)if($.browser.mozilla||$.browser.safari){var n=new Image;n.src=e.image.url,e.image.height=n.height,e.image.width=n.width}else a.css({height:"auto",width:"auto"}),e.image.height=a[0].height,e.image.width=a[0].width;var h=e.image.height,o=e.image.width,l=0;h>t.height&&(l=t.height/h,h=t.height,o=Math.floor(o*l)),o>t.width&&(l=t.width/o,o=t.width,h=Math.floor(h*l));var r=Math.floor((t.width-o)/2);this._ui.images[i].css({height:h+"px",left:r+10+"px",marginTop:-1*Math.round(h/2)+"px",width:o+"px"})},_initUI:function(){if(this._didInit)return!1;this._didInit=!0,this._container=$('<div class="wcfImageViewer'+(this.options.staticViewer?" wcfImageViewerStatic":"")+'" />').appendTo(document.body);var i=$("<div><img /><img /></div>").appendTo(this._container),e=$('<footer><span class="wcfImageViewerButtonPrevious icon fa-angle-double-left" /><div><ul /></div><span class="wcfImageViewerButtonNext icon fa-angle-double-right" /></footer>').appendTo(this._container),t=$("<ul />").appendTo(i),s=$('<li class="wcfImageViewerSlideshowButtonPrevious"><span class="icon icon48 fa-angle-left" /></li>').appendTo(t),a=$('<li class="wcfImageViewerSlideshowButtonToggle pointer"><span class="icon icon48 fa-play" /></li>').appendTo(t),n=$('<li class="wcfImageViewerSlideshowButtonNext"><span class="icon icon48 fa-angle-right" /></li>').appendTo(t),h=$('<li class="wcfImageViewerSlideshowButtonEnlarge pointer jsTooltip" title="'+WCF.Language.get("wcf.imageViewer.button.enlarge")+'"><span class="icon icon48 fa-expand" /></li>').appendTo(t),o=$('<li class="wcfImageViewerSlideshowButtonFull pointer jsTooltip" title="'+WCF.Language.get("wcf.imageViewer.button.full")+'"><span class="icon icon48 fa-external-link" /></li>').appendTo(t);return this._ui={buttonNext:e.children("span.wcfImageViewerButtonNext"),buttonPrevious:e.children("span.wcfImageViewerButtonPrevious"),header:$("<header><div"+(this.options.staticViewer?">":' class="box64"><a class="jsTooltip"><img /></a>')+"<h1 /><h2 /><h3 /></div></header>").appendTo(this._container),imageContainer:i,images:[i.children("img:eq(0)").on("webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd",function(){$(this).removeClass("animateTransformation")}),i.children("img:eq(1)").on("webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd",function(){$(this).removeClass("animateTransformation")})],imageList:e.find("> div > ul"),slideshow:{container:t,enlarge:h,full:o,next:n,previous:s,toggle:a}},this._ui.buttonNext.click($.proxy(this._next,this)),this._ui.buttonPrevious.click($.proxy(this._previous,this)),n.click($.proxy(this._nextImage,this)),s.click($.proxy(this._previousImage,this)),h.click($.proxy(this._toggleView,this)),a.click($.proxy(function(){this._items<2||(this._slideshowEnabled?this.stopSlideshow(!0):(this._disableSlideshow=!1,this.startSlideshow()))},this)),o.click(function(i){window.location=$(i.currentTarget).data("link")}),$('<span class="wcfImageViewerButtonClose icon icon48 fa-times pointer jsTooltip" title="'+WCF.Language.get("wcf.global.button.close")+'" />').appendTo(this._ui.header).click($.proxy(this.close,this)),$.browser.mobile||i.click(function(e){e.target===i[0]&&this.close()}.bind(this)),WCF.DOMNodeInsertedHandler.execute(),enquire.register("(max-width: 767px)",{match:$.proxy(this._enableMobileView,this),unmatch:$.proxy(this._disableMobileView,this)}),!0},_enableMobileView:function(){this._container.addClass("wcfImageViewerMobile");var i=this;this._ui.imageContainer.swipe({swipeLeft:function(e){i._container.hasClass("maximized")&&i._nextImage(e)},swipeRight:function(e){i._container.hasClass("maximized")&&i._previousImage(e)},tap:function(e,t){switch(t.tagName){case"DIV":case"IMG":i._toggleView()}}}),this._isMobile=!0},_disableMobileView:function(){this._container.removeClass("wcfImageViewerMobile"),this._ui.imageContainer.swipe("destroy"),this._isMobile=!1},_toggleView:function(){this._ui.images[this._activeImage].addClass("animateTransformation"),this._container.toggleClass("maximized"),this._ui.slideshow.enlarge.toggleClass("active").children("span").toggleClass("fa-expand").toggleClass("fa-compress"),this._renderImage(null,void 0,null)},_next:function(i,e){if(this._ui.buttonNext.hasClass("pointer")){void 0==e&&this.stopSlideshow(!0);var t=Math.max(this._items*this._thumbnailWidth-this._thumbnailContainerWidth-this._thumbnailMarginRight,0);this._thumbnailOffset=Math.min(this._thumbnailOffset+this._thumbnailWidth*(e?e:this.options.shiftBy),t),this._ui.imageList.css("marginLeft",-1*this._thumbnailOffset)}this._preload(),this._toggleButtons()},_previous:function(i,e){this._ui.buttonPrevious.hasClass("pointer")&&(void 0==e&&this.stopSlideshow(!0),this._thumbnailOffset=Math.max(this._thumbnailOffset-this._thumbnailWidth*(e?e:this.options.shiftBy),0),this._ui.imageList.css("marginLeft",-1*this._thumbnailOffset)),this._toggleButtons()},_nextImage:function(i){this._ui.slideshow.next.hasClass("pointer")&&(this._disableSlideshow=!0,this.stopSlideshow(!0),this.showImage(this._active+1),i&&(i.preventDefault(),i.stopPropagation()))},_previousImage:function(i){this._ui.slideshow.previous.hasClass("pointer")&&(this._disableSlideshow=!0,this.stopSlideshow(!0),this.showImage(this._active-1),i&&(i.preventDefault(),i.stopPropagation()))},moveToImage:function(i){var e=(i-3)*this._thumbnailWidth,t=e+5*this._thumbnailWidth,s=this._thumbnailOffset,a=this._thumbnailOffset+this._thumbnailContainerWidth,n=!1;if((s>e||t>a)&&(n=!0),n){var h=0;if(s>e){for(;s>e;)h++,s-=this._thumbnailWidth;this._previous(null,h)}else{for(;t>a;)h++,a+=this._thumbnailWidth;this._next(null,h)}}},_toggleButtons:function(){this._thumbnailOffset>0?this._ui.buttonPrevious.addClass("pointer"):this._ui.buttonPrevious.removeClass("pointer");var i=this._images.length*this._thumbnailWidth-this._thumbnailContainerWidth-this._thumbnailMarginRight;this._thumbnailOffset>=i?this._ui.buttonNext.removeClass("pointer"):this._ui.buttonNext.addClass("pointer"),this._active>0?this._ui.slideshow.previous.addClass("pointer"):this._ui.slideshow.previous.removeClass("pointer"),this._active+1<this._images.length?this._ui.slideshow.next.addClass("pointer"):this._ui.slideshow.next.removeClass("pointer"),this._items<2?this._ui.slideshow.toggle.removeClass("pointer"):this._ui.slideshow.toggle.addClass("pointer")},_createThumbnails:function(i){this.options.staticViewer&&(this._images=[],this._ui.imageList.empty());for(var e=0,t=i.length;t>e;e++){var s=i[e],a=$('<li class="loading pointer"><img src="'+s.thumbnail.url+'" /></li>').appendTo(this._ui.imageList);a.data("index",this._images.length).data("objectID",s.objectID).click($.proxy(this._showImage,this));var n=a.children("img");if(n.get(0).complete)a.removeClass("loading"),this.options.staticViewer&&this._fixThumbnailDimensions(n);else{var h=this;n.on("load",function(){var i=$(this);i.parent().removeClass("loading"),h.options.staticViewer&&h._fixThumbnailDimensions(i)})}s.listItem=a,this._images.push(s)}},_fixThumbnailDimensions:function(i){var e=new Image;e.src=i.prop("src");var t=e.height,s=e.width;if(t==s)t=s=80;else if(s>t){var a=80/s;s=80,t*=a}else{var a=80/t;t=80,s*=a}i.css({height:t+"px",width:s+"px"})},_loadNextImages:function(i){this._proxy.setOption("data",{actionName:"loadNextImages",className:this.options.className,interfaceName:"wcf\\data\\IImageViewerAction",objectIDs:[this.element.data("objectID")],parameters:{maximumHeight:this._maxDimensions.height,maximumWidth:this._maxDimensions.width,offset:this._images.length,targetImageID:i&&this.element.data("targetImageID")?this.element.data("targetImageID"):0}}),this._proxy.setOption("showLoadingOverlay",!1),this._proxy.sendRequest()},_getStaticImages:function(){var i=[];return $(this.options.imageSelector).each(function(e,t){var s=$(t),a=s.find("> img, .attachmentThumbnailImage > img").first();a.length||(a=s.parentsUntil(".formAttachmentList").last().find(".attachmentTinyThumbnail")),i.push({image:{fullURL:a.data("source")?a.data("source").replace(/\\\//g,"/"):s.prop("href"),link:"",title:s.prop("title"),url:s.prop("href")},series:null,thumbnail:{url:a.prop("src")},user:null})}),this._items=i.length,i},_success:function(i){i.returnValues.items&&(this._items=i.returnValues.items);var e=this._initUI();this._createThumbnails(i.returnValues.images);var t=i.returnValues.targetImageID?i.returnValues.targetImageID:0;this._render(e,t),this._isOpen||(this._isOpen=!0,WCF.System.DisableScrolling.disable(),WCF.System.DisableZoom.disable())}}); })(this);