Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Thu, 5 Feb 2015 18:21:47 +0000 (19:21 +0100)
committerwoltlab.com <woltlab@woltlab.com>
Thu, 5 Feb 2015 18:21:47 +0000 (19:21 +0100)
wcfsetup/install/files/js/WCF.Combined.min.js

index 1fa6919eb78ffa9cdb5ada032af263b487869938..c2899a03a63714a53da83a8faaee8af4e9824954 100755 (executable)
@@ -88,7 +88,7 @@ window.matchMedia||(window.matchMedia=function(){var c=window.styleMedia||window
 (function (window, undefined) {"use strict";WCF.ACL={};WCF.ACL.List=Class.extend({_categoryName:"",_container:null,_containerElements:{},_objectID:0,_objectTypeID:null,_options:{},_proxy:null,_search:null,_values:{group:{},user:{}},init:function(g,i,d,b,c,j){this._objectID=b||0;this._objectTypeID=i;this._categoryName=d;if(c===undefined){c=true}this._values={group:{},user:{}};this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,success:$.proxy(this._success,this)});this._container=$(g).hide().addClass("aclContainer");var f=this._container.children("dd");var a=$('<ul class="aclList container" />').appendTo(f);var k=$('<input type="text" class="long" placeholder="'+WCF.Language.get("wcf.acl.search."+(!c?"user.":"")+"description")+'" />').appendTo(f);var e=$('<ul class="aclPermissionList container" />').hide().appendTo(f);this._containerElements={aclList:a,denyAll:null,grantAll:null,permissionList:e,searchInput:k};this._search=new WCF.Search.User(k,$.proxy(this.addObject,this),c);var l=this._container.parents("form:eq(0)");l.submit($.proxy(this.submit,this));var h=l.find("input[type=reset]:eq(0)");if(h.length){h.click($.proxy(this._reset,this))}if(j){this._success(j)}else{this._loadACL()}},_reset:function(){this._values={group:{},user:{}};this._containerElements.aclList.empty();this._containerElements.searchInput.val("");this._containerElements.permissionList.hide().find("input[type=checkbox]").prop("checked",false)},_loadACL:function(){this._proxy.setOption("data",{actionName:"loadAll",className:"wcf\\data\\acl\\option\\ACLOptionAction",parameters:{categoryName:this._categoryName,objectID:this._objectID,objectTypeID:this._objectTypeID}});this._proxy.sendRequest()},addObject:function(b){var a=this._createListItem(b.objectID,b.label,b.type);this._savePermissions();this._containerElements.aclList.children("li").removeClass("active");a.addClass("active");this._search.addExcludedSearchValue(b.label);this._containerElements.permissionList.find("input[type=checkbox]").prop("checked",false);this._containerElements.searchInput.val("");this._containerElements.permissionList.show();WCF.DOMNodeInsertedHandler.execute()},_createListItem:function(d,a,c){var b=$('<li><span class="icon icon16 icon-'+(c==="group"?"group":"user")+'" /> <span>'+a+"</span></li>").appendTo(this._containerElements.aclList);b.data("objectID",d).data("type",c).data("label",a).click($.proxy(this._click,this));$('<span class="icon icon16 icon-remove jsTooltip pointer" title="'+WCF.Language.get("wcf.global.button.delete")+'" />').click($.proxy(this._removeItem,this)).appendTo(b);return b},_removeItem:function(d){var b=$(d.currentTarget).parent();var a=b.data("type");var c=b.data("objectID");this._search.removeExcludedSearchValue(b.data("label"));b.remove();if(this._values[a][c]){delete this._values[a][c]}this._selectFirstEntry()},_selectFirstEntry:function(){var a=this._containerElements.aclList.children("li:eq(0)");if(a.length){this._select(a,false)}else{this._reset()}},_success:function(g,f,l){if(!$.getLength(g.returnValues.options)){return}var i=0;var n={};for(var h in g.returnValues.options){var a=g.returnValues.options[h];var j=$("<li><span>"+a.label+"</span></li>").data("optionID",h).data("optionName",a.optionName);var d=$('<input type="checkbox" id="grant'+h+'" />').appendTo(j).wrap('<label for="grant'+h+'" class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.grant")+'" />');var b=$('<input type="checkbox" id="deny'+h+'" />').appendTo(j).wrap('<label for="deny'+h+'" class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.deny")+'" />');d.data("type","grant").data("optionID",h).change($.proxy(this._change,this));b.data("type","deny").data("optionID",h).change($.proxy(this._change,this));if(!n[a.categoryName]){n[a.categoryName]=[]}if(a.categoryName===""){j.appendTo(this._containerElements.permissionList)}else{n[a.categoryName].push(j)}i++}if(i>1){var j=$('<li class="aclFullAccess"><span>'+WCF.Language.get("wcf.acl.option.fullAccess")+"</span></li>").prependTo(this._containerElements.permissionList);this._containerElements.grantAll=$('<input type="checkbox" id="grantAll_'+this._container.attr("id")+'" />').appendTo(j).wrap('<label class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.grant")+'" />');this._containerElements.denyAll=$('<input type="checkbox" id="denyAll_'+this._container.attr("id")+'" />').appendTo(j).wrap('<label class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.deny")+'" />');this._containerElements.grantAll.data("type","grant").change($.proxy(this._changeAll,this));this._containerElements.denyAll.data("type","deny").change($.proxy(this._changeAll,this))}if($.getLength(n)){for(var e in n){var c=n[e];if(g.returnValues.categories[e]){$('<li class="aclCategory">'+g.returnValues.categories[e]+"</li>").appendTo(this._containerElements.permissionList)}for(var m=0,k=c.length;m<k;m++){c[m].appendTo(this._containerElements.permissionList)}}}this._parseData(g,"group");this._parseData(g,"user");this._container.show();this._selectFirstEntry()},_parseData:function(c,a){if(!$.getLength(c.returnValues[a].option)){return}for(var b in c.returnValues[a].label){this._createListItem(b,c.returnValues[a].label[b],a);this._search.addExcludedSearchValue(c.returnValues[a].label[b])}this._values[a]=c.returnValues[a].option;WCF.DOMNodeInsertedHandler.execute()},_click:function(b){var a=$(b.currentTarget);if(a.hasClass("active")){return}this._select(a,true)},_select:function(b,a){if(a){this._savePermissions()}this._containerElements.aclList.children("li").removeClass("active");b.addClass("active");this._setupPermissions(b.data("type"),b.data("objectID"))},_change:function(d){var c=$(d.currentTarget);var b=c.data("optionID");var a=c.data("type");if(c.is(":checked")){if(a==="deny"){$("#grant"+b).prop("checked",false);if(this._containerElements.grantAll!==null){this._containerElements.grantAll.prop("checked",false)}}else{$("#deny"+b).prop("checked",false);if(this._containerElements.denyAll!==null){this._containerElements.denyAll.prop("checked",false)}}}else{if(a==="deny"&&this._containerElements.denyAll!==null){this._containerElements.denyAll.prop("checked",false)}else{if(a==="grant"&&this._containerElements.grantAll!==null){this._containerElements.grantAll.prop("checked",false)}}}var e=true;this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(g,h){var f=$(h);if(f.data("type")===a&&f.attr("id")!==a+"All_"+this._container.attr("id")){if(!f.is(":checked")){e=false;return false}}},this));if(a=="deny"){if(this._containerElements.denyAll!==null){if(e){this._containerElements.denyAll.prop("checked",true)}else{this._containerElements.denyAll.prop("checked",false)}}}else{if(this._containerElements.grantAll!==null){if(e){this._containerElements.grantAll.prop("checked",true)}else{this._containerElements.grantAll.prop("checked",false)}}}},_changeAll:function(c){var b=$(c.currentTarget);var a=b.data("type");if(b.is(":checked")){if(a==="deny"){this._containerElements.grantAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="deny"&&d.attr("id")!=="denyAll_"+this._container.attr("id")){d.prop("checked",true).trigger("change")}},this))}else{this._containerElements.denyAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="grant"&&d.attr("id")!=="grantAll_"+this._container.attr("id")){d.prop("checked",true).trigger("change")}},this))}}else{if(a==="deny"){this._containerElements.grantAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="deny"&&d.attr("id")!=="denyAll_"+this._container.attr("id")){d.prop("checked",false).trigger("change")}},this))}else{this._containerElements.denyAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="grant"&&d.attr("id")!=="grantAll_"+this._container.attr("id")){d.prop("checked",false).trigger("change")}},this))}}},_setupPermissions:function(b,c){this._containerElements.permissionList.find("input[type='checkbox']").prop("checked",false);if(this._values[b]&&this._values[b][c]){for(var a in this._values[b][c]){if(this._values[b][c][a]==1){$("#grant"+a).prop("checked",true).trigger("change")}else{$("#deny"+a).prop("checked",true).trigger("change")}}}this._containerElements.permissionList.show()},_savePermissions:function(){var b=this._containerElements.aclList.find("li.active");if(!b.length){return}var c=b.data("objectID");var a=b.data("type");this._values[a][c]={};this._containerElements.permissionList.find("input[type='checkbox']").each((function(d,h){var g=$(h);if(g.attr("id")!="grantAll_"+this._container.attr("id")&&g.attr("id")!="denyAll_"+this._container.attr("id")){var f=(g.data("type")==="deny")?0:1;var e=g.data("optionID");if(g.is(":checked")){this._values[a][c][e]=f;g.prop("checked",false)}else{if(this._values[a]&&this._values[a][c]&&this._values[a][c][e]&&this._values[a][c][e]==f){delete this._values[a][c][e]}}}}).bind(this))},submit:function(a){this._savePermissions();this._save("group");this._save("user")},_save:function(a){if($.getLength(this._values[a])){var b=this._container.parents("form:eq(0)");for(var e in this._values[a]){var d=this._values[a][e];for(var c in d){$('<input type="hidden" name="aclValues['+a+"]["+e+"]["+c+']" value="'+d[c]+'" />').appendTo(b)}}}}}); })(this);
 
 // WCF.Attachment.js
-(function (window, undefined) {"use strict";WCF.Attachment={};WCF.Attachment.Upload=WCF.Upload.extend({_autoInsert:[],_insertAllButton:null,_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_wysiwygContainerID:"",init:function(c,g,a,h,d,e,f,b){this._super(c,g,"wcf\\data\\attachment\\AttachmentAction",{multiple:true,maxUploads:f});this._autoInsert=[];this._objectType=a;this._objectID=parseInt(h);this._tmpHash=d;this._parentObjectID=parseInt(e);this._wysiwygContainerID=b;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.System.Event.addListener("com.woltlab.wcf.action.delete","attachment_"+this._wysiwygContainerID,$.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));if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}if(this._wysiwygContainerID){WCF.System.Event.addListener("com.woltlab.wcf.messageOptionsInline","submit_"+this._wysiwygContainerID,$.proxy(this._submitInline,this));WCF.System.Event.addListener("com.woltlab.wcf.messageOptionsInline","prepareExtended_"+this._wysiwygContainerID,$.proxy(this._prepareExtended,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._reset,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","upload_"+this._wysiwygContainerID,$.proxy(this._editorUpload,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","getImageAttachments_"+this._wysiwygContainerID,$.proxy(this._getImageAttachments,this))}},_editorUpload:function(b){var a;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",true);if(b.file){a=this._upload(undefined,b.file)}else{a=this._upload(undefined,undefined,b.blob)}this._autoInsert.push(a);b.uploadID=a},_getImageAttachments:function(a){this._fileListSelector.children("li").each(function(b,d){var c=$(d);if(c.children("img.attachmentTinyThumbnail").length){a.imageAttachments[parseInt(c.data("objectID"))]={height:parseInt(c.data("height")),width:parseInt(c.data("width"))}}})},_submitInline:function(a){if(this._tmpHash){a.tmpHash=this._tmpHash}},_prepareExtended:function(a){if(!this._objectID&&this._tmpHash&&this._fileListSelector.children("li:not(.uploadFailed)").length){a.tmpHash=this._tmpHash}},_reset:function(){this._fileListSelector.hide().empty();this._insertAllButton.hide();this._validateLimit()},_validateLimit:function(){var c=this._buttonSelector.next("small.innerError");var a=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length;var d=(this._fileUpload)?this._fileUpload.prop("files").length:0;if(a<=0||a<d){var b=(a<=0)?WCF.Language.get("wcf.attachment.upload.error.reachedLimit"):WCF.Language.get("wcf.attachment.upload.error.reachedRemainingLimit").replace(/#remaining#/,a);if(!c.length){c=$('<small class="innerError" />').insertAfter(this._buttonSelector)}c.html(b);return false}c.remove();return true},_removeLimitError:function(b){var a=this._fileListSelector.children("li");if(!a.filter(":not(.uploadFailed)").length){this._insertAllButton.hide()}if(!a.length){setTimeout((function(){this._fileListSelector.wcfBlindOut()}).bind(this),250)}if(this._wysiwygContainerID){$("#"+this._wysiwygContainerID).redactor("wbbcode.removeAttachment",b.button.data("objectID"))}},_upload:function(c,b,a){var d=undefined;if(this._validateLimit()){d=this._super(c,b,a)}if(this._fileUpload){this._removeButton();this._createButton()}return d},_createUploadMatrix:function(a){this._fileListSelector.children("li.uploadFailed").remove();return this._super(a)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(a){var b=$('<li class="box64"><span class="icon icon48 icon-spinner" /><div><div><p>'+a.name+'</p><small><progress max="100"></progress></small></div><ul></ul></div></li>').data("filename",a.name);this._fileListSelector.append(b);this._fileListSelector.show();if(this._buttonSelector.data("maxSize")<a.size){b.find("progress").remove();b.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");b.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"</small>"));b.addClass("uploadFailed")}return b},_success:function(b,d){for(var l in this._uploadMatrix[b]){var i=this._uploadMatrix[b][l];i.find("progress").remove();var j=i.data("filename");var m=i.data("internalFileID");if(d.returnValues&&d.returnValues.attachments[m]){if(d.returnValues.attachments[m].tinyURL){i.children(".icon-spinner").replaceWith($('<img src="'+d.returnValues.attachments[m]["tinyURL"]+'" alt="" class="attachmentTinyThumbnail" />'));i.data("height",d.returnValues.attachments[m].height);i.data("width",d.returnValues.attachments[m].width)}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-paper-clip")}var f=$('<a href=""></a>');f.text(j).attr("href",d.returnValues.attachments[m]["url"]);if(d.returnValues.attachments[m]["isImage"]!=0){f.addClass("jsImageViewer").attr("title",j)}i.find("p").empty().append(f);i.find("small").append(d.returnValues.attachments[m]["formattedFilesize"]);var a=i.find("ul").addClass("buttonGroup");var h=$('<li><span class="button small jsDeleteButton" data-object-id="'+d.returnValues.attachments[m]["attachmentID"]+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'" data-event-name="attachment_'+this._wysiwygContainerID+'">'+WCF.Language.get("wcf.global.button.delete")+"</span></li>");a.append(h);i.data("objectID",d.returnValues.attachments[m].attachmentID);if(this._wysiwygContainerID){if(d.returnValues.attachments[m].tinyURL){var k=$('<li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertThumbnail")+"</span></li>").appendTo(a);var g=$('<li><span class="button small jsButtonAttachmentInsertFull" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertFull")+"</span></li>").appendTo(a);k.children("span.button").click($.proxy(this._insert,this));g.children("span.button").click($.proxy(this._insert,this))}else{var c=$('<li><span class="button small jsButtonAttachmentInsertPlain" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insert")+"</span></li>");c.children("span.button").click($.proxy(this._insert,this)).appendTo(a)}}}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");var e="";if(d.returnValues&&d.returnValues.errors[m]){e=d.returnValues.errors[m]["errorType"]}else{e="uploadFailed"}i.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error."+e)+"</small>"));i.addClass("uploadFailed")}i.css("display","block");if(WCF.inArray(b,this._autoInsert)){this._autoInsert.splice(this._autoInsert.indexOf(b),1);if(!i.hasClass("uploadFailed")){WCF.System.Event.fireEvent("com.woltlab.wcf.attachment","autoInsert_"+this._wysiwygContainerID,{attachment:"[attach="+d.returnValues.attachments[m].attachmentID+"][/attach]",uploadID:b})}}}this._makeSortable();if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}else{this._insertAllButton.hide()}WCF.DOMNodeInsertedHandler.execute()},_insert:function(d,c){var b=(d===null)?c:$(d.currentTarget).data("objectID");var a=(d!==null)?$(d.currentTarget).hasClass("jsButtonAttachmentInsertFull"):false;if($.browser.redactor){$("#"+this._wysiwygContainerID).redactor("wbbcode.insertAttachment",b,a)}},_insertAll:function(){this._fileListSelector.children("li:not(.uploadFailed)").each($.proxy(function(a,b){this._insert(null,$(b).data("objectID"))},this))},_error:function(a){this._fileListSelector.find("li").each(function(b,d){var c=$(d);if(c.children(".icon-spinner").length){c.addClass("uploadFailed").children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");c.find("div > div").append($('<small class="innerError">'+(a.responseJSON&&a.responseJSON.message?a.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+"</small>"))}})},_makeSortable:function(){var b=this._fileListSelector.children("li:not(.uploadFailed)");if(!b.length){return}b.addClass("sortableAttachment").children("img").addClass("sortableNode");if(!this._fileListSelector.hasClass("sortableList")){this._fileListSelector.addClass("sortableList");var a=this;new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:false,items:"li.sortableAttachment",toleranceElement:null,update:function(d,e){var c=[];a._fileListSelector.children("li:not(.uploadFailed)").each(function(f,g){c.push($(g).data("objectID"))});if(c.length){new WCF.Action.Proxy({autoSend:true,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:c,objectID:a._objectID,objectType:a._objectType,tmpHash:a._tmpHash}}})}}},true)}}}); })(this);
+(function (window, undefined) {"use strict";WCF.Attachment={};WCF.Attachment.Upload=WCF.Upload.extend({_autoInsert:[],_insertAllButton:null,_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_wysiwygContainerID:"",init:function(c,g,a,h,d,e,f,b){this._super(c,g,"wcf\\data\\attachment\\AttachmentAction",{multiple:true,maxUploads:f});this._autoInsert=[];this._objectType=a;this._objectID=parseInt(h);this._tmpHash=d;this._parentObjectID=parseInt(e);this._wysiwygContainerID=b;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.System.Event.addListener("com.woltlab.wcf.action.delete","attachment_"+this._wysiwygContainerID,$.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));if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}if(this._wysiwygContainerID){WCF.System.Event.addListener("com.woltlab.wcf.messageOptionsInline","submit_"+this._wysiwygContainerID,$.proxy(this._submitInline,this));WCF.System.Event.addListener("com.woltlab.wcf.messageOptionsInline","prepareExtended_"+this._wysiwygContainerID,$.proxy(this._prepareExtended,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._reset,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","upload_"+this._wysiwygContainerID,$.proxy(this._editorUpload,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","getImageAttachments_"+this._wysiwygContainerID,$.proxy(this._getImageAttachments,this))}},_editorUpload:function(b){var a;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",true);if(b.file){a=this._upload(undefined,b.file)}else{a=this._upload(undefined,undefined,b.blob)}this._autoInsert.push(a);b.uploadID=a},_getImageAttachments:function(a){this._fileListSelector.children("li").each(function(b,d){var c=$(d);if(c.children("img.attachmentTinyThumbnail").length){a.imageAttachments[parseInt(c.data("objectID"))]={height:parseInt(c.data("height")),width:parseInt(c.data("width"))}}})},_submitInline:function(a){if(this._tmpHash){a.tmpHash=this._tmpHash}},_prepareExtended:function(a){if(!this._objectID&&this._tmpHash&&this._fileListSelector.children("li:not(.uploadFailed)").length){a.tmpHash=this._tmpHash}},_reset:function(){this._fileListSelector.hide().empty();this._insertAllButton.hide();this._validateLimit()},_validateLimit:function(){var c=this._buttonSelector.next("small.innerError");var a=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length;var d=(this._fileUpload)?this._fileUpload.prop("files").length:0;if(a<=0||a<d){var b=(a<=0)?WCF.Language.get("wcf.attachment.upload.error.reachedLimit"):WCF.Language.get("wcf.attachment.upload.error.reachedRemainingLimit").replace(/#remaining#/,a);if(!c.length){c=$('<small class="innerError" />').insertAfter(this._buttonSelector)}c.html(b);return false}c.remove();return true},_removeLimitError:function(b){var a=this._fileListSelector.children("li");if(!a.filter(":not(.uploadFailed)").length){this._insertAllButton.hide()}if(!a.length){setTimeout((function(){this._fileListSelector.wcfBlindOut()}).bind(this),250)}if(this._wysiwygContainerID){$("#"+this._wysiwygContainerID).redactor("wbbcode.removeAttachment",b.button.data("objectID"))}},_upload:function(c,b,a){var d=undefined;if(this._validateLimit()){d=this._super(c,b,a)}if(this._fileUpload){this._removeButton();this._createButton()}return d},_createUploadMatrix:function(a){this._fileListSelector.children("li.uploadFailed").remove();return this._super(a)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(a){var b=$('<li class="box64"><span class="icon icon48 icon-spinner" /><div><div><p>'+a.name+'</p><small><progress max="100"></progress></small></div><ul></ul></div></li>').data("filename",a.name);this._fileListSelector.append(b);this._fileListSelector.show();if(this._buttonSelector.data("maxSize")<a.size){b.find("progress").remove();b.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");b.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"</small>"));b.addClass("uploadFailed")}return b},_success:function(b,d){for(var l in this._uploadMatrix[b]){var i=this._uploadMatrix[b][l];i.find("progress").remove();var j=i.data("filename");var m=i.data("internalFileID");if(d.returnValues&&d.returnValues.attachments[m]){if(d.returnValues.attachments[m].tinyURL){i.children(".icon-spinner").replaceWith($('<img src="'+d.returnValues.attachments[m]["tinyURL"]+'" alt="" class="attachmentTinyThumbnail" />'));i.data("height",d.returnValues.attachments[m].height);i.data("width",d.returnValues.attachments[m].width)}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-paper-clip")}var f=$('<a href=""></a>');f.text(j).attr("href",d.returnValues.attachments[m]["url"]);if(d.returnValues.attachments[m]["isImage"]!=0){f.addClass("jsImageViewer").attr("title",j)}i.find("p").empty().append(f);i.find("small").append(d.returnValues.attachments[m]["formattedFilesize"]);var a=i.find("ul").addClass("buttonGroup");var h=$('<li><span class="button small jsDeleteButton" data-object-id="'+d.returnValues.attachments[m]["attachmentID"]+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'" data-event-name="attachment_'+this._wysiwygContainerID+'">'+WCF.Language.get("wcf.global.button.delete")+"</span></li>");a.append(h);i.data("objectID",d.returnValues.attachments[m].attachmentID);if(this._wysiwygContainerID){if(d.returnValues.attachments[m].tinyURL){var k=$('<li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertThumbnail")+"</span></li>").appendTo(a);var g=$('<li><span class="button small jsButtonAttachmentInsertFull" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertFull")+"</span></li>").appendTo(a);k.children("span.button").click($.proxy(this._insert,this));g.children("span.button").click($.proxy(this._insert,this))}else{var c=$('<li><span class="button small jsButtonAttachmentInsertPlain" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insert")+"</span></li>");c.appendTo(a).children("span.button").click($.proxy(this._insert,this))}}}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");var e="";if(d.returnValues&&d.returnValues.errors[m]){e=d.returnValues.errors[m]["errorType"]}else{e="uploadFailed"}i.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error."+e)+"</small>"));i.addClass("uploadFailed")}i.css("display","block");if(WCF.inArray(b,this._autoInsert)){this._autoInsert.splice(this._autoInsert.indexOf(b),1);if(!i.hasClass("uploadFailed")){WCF.System.Event.fireEvent("com.woltlab.wcf.attachment","autoInsert_"+this._wysiwygContainerID,{attachment:"[attach="+d.returnValues.attachments[m].attachmentID+"][/attach]",uploadID:b})}}}this._makeSortable();if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}else{this._insertAllButton.hide()}WCF.DOMNodeInsertedHandler.execute()},_insert:function(d,c){var b=(d===null)?c:$(d.currentTarget).data("objectID");var a=(d!==null)?$(d.currentTarget).hasClass("jsButtonAttachmentInsertFull"):false;if($.browser.redactor){$("#"+this._wysiwygContainerID).redactor("wbbcode.insertAttachment",b,a)}},_insertAll:function(){this._fileListSelector.children("li:not(.uploadFailed)").each($.proxy(function(a,b){this._insert(null,$(b).data("objectID"))},this))},_error:function(a){this._fileListSelector.find("li").each(function(b,d){var c=$(d);if(c.children(".icon-spinner").length){c.addClass("uploadFailed").children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");c.find("div > div").append($('<small class="innerError">'+(a.responseJSON&&a.responseJSON.message?a.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+"</small>"))}})},_makeSortable:function(){var b=this._fileListSelector.children("li:not(.uploadFailed)");if(!b.length){return}b.addClass("sortableAttachment").children("img").addClass("sortableNode");if(!this._fileListSelector.hasClass("sortableList")){this._fileListSelector.addClass("sortableList");var a=this;new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:false,items:"li.sortableAttachment",toleranceElement:null,update:function(d,e){var c=[];a._fileListSelector.children("li:not(.uploadFailed)").each(function(f,g){c.push($(g).data("objectID"))});if(c.length){new WCF.Action.Proxy({autoSend:true,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:c,objectID:a._objectID,objectType:a._objectType,tmpHash:a._tmpHash}}})}}},true)}}}); })(this);
 
 // WCF.ColorPicker.js
 (function (window, undefined) {"use strict";WCF.ColorPicker=Class.extend({_bar:null,_barActive:false,_barSelector:null,_dialog:null,_didInit:false,_elementID:"",_gradient:null,_gradientActive:false,_gradientSelector:null,_hex:null,_hsv:{},_newColor:null,_oldColor:null,_rgba:{},_rgbaRegExp:null,init:function(a){this._elementID="";this._hsv={h:0,s:100,v:100};this._position={};var b=$(a);if(!b.length){console.debug("[WCF.ColorPicker] Selector does not match any element, aborting.");return}b.click($.proxy(this._open,this))},_open:function(c){if(!this._didInit){this._initColorPicker();this._didInit=true}var a=$(c.currentTarget);this._elementID=a.wcfIdentify();this._parseColor(a);var b=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);this._oldColor.css({backgroundColor:"rgba("+b.r+", "+b.g+", "+b.b+", "+(this._rgba.a.val()/100)+")"});this._dialog.wcfDialog({title:WCF.Language.get("wcf.style.colorPicker")});this._hex.focus()},_parseColor:function(b){if(b.data("hsv")&&b.data("rgb")){var d=b.data("hsv");for(var a in d){this._hsv[a]=d[a]}this._updateValues(b.data("rgb"),true,true);this._rgba.a.val(parseInt(b.data("alpha")))}else{if(this._rgbaRegExp===null){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(b.data("color"));var c=RegExp.$4;if(c.indexOf(".")===0){c="0"+c}c*=100;this._updateValues({r:RegExp.$1,g:RegExp.$2,b:RegExp.$3,a:Math.round(c)},true,true)}},_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 a=this;$(document).mouseup(function(b){if(a._barActive){a._barActive=false;a._mouseBar(b)}else{if(a._gradientActive){a._gradientActive=false;a._mouseGradient(b)}}}).mousemove(function(b){if(a._barActive){a._mouseBar(b)}else{if(a._gradientActive){a._mouseGradient(b)}}});this._initColorPickerForm()},_initColorPickerForm:function(){var c=$('<div id="colorPickerForm" />').appendTo(this._dialog);$("<small>"+WCF.Language.get("wcf.style.colorPicker.new")+"</small>").appendTo(c);var d=$('<ul class="colors" />').appendTo(c);this._newColor=$('<li class="new"><span /></li>').appendTo(d).children("span");this._oldColor=$('<li class="old"><span /></li>').appendTo(d).children("span");$("<small>"+WCF.Language.get("wcf.style.colorPicker.current")+"</small>").appendTo(c);var a=$('<ul class="rgba" />').appendTo(c);this._createInputElement("r","R",0,255).appendTo(a);this._createInputElement("g","G",0,255).appendTo(a);this._createInputElement("b","B",0,255).appendTo(a);this._createInputElement("a","a",0,100).appendTo(a);var e=$('<ul class="hex"><li><label><span>#</span></label></li></ul>').appendTo(c);this._hex=$('<input type="text" maxlength="6" />').appendTo(e.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 f=$('<div class="formSubmit" />').appendTo(this._dialog);$('<button class="buttonPrimary">'+WCF.Language.get("wcf.style.colorPicker.button.apply")+"</button>").appendTo(f).click($.proxy(this._submit,this));var b=this;this._hex.on("paste",function(){b._hex.attr("maxlength","7");setTimeout(function(){var g=b._hex.val();if(g.substring(0,1)=="#"){g=g.substr(1)}if(g.length>6){g=g.substring(0,6)}b._hex.attr("maxlength","6").val(g)},50)});c.find("input").focus(function(){this.select()})},_keyUpRGBA:function(a){if(a.which==13){this._blurRgba();this._submit()}},_keyUpHex:function(a){if(a.which==13){this._blurHex();this._submit()}},_submit:function(){var d=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);var c={};for(var b in this._hsv){c[b]=this._hsv[b]}var a=$("#"+this._elementID);a.data("hsv",c).css({backgroundColor:"rgba("+d.r+", "+d.g+", "+d.b+", "+(this._rgba.a.val()/100)+")"}).data("alpha",parseInt(this._rgba.a.val()));a.data("rgb",{r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()});$("#"+a.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(f,c,e,b){var d=$('<li class="'+f+'" />');var a=$("<label />").appendTo(d);$("<span>"+c+"</span>").appendTo(a);this._rgba[f]=$('<input type="number" value="0" min="'+e+'" max="'+b+'" step="1" />').appendTo(a);return d},_mouseDownGradient:function(a){this._gradientActive=true;this._mouseGradient(a)},_mouseGradient:function(b){var c=this._gradient.getOffsets("offset");var a=Math.max(Math.min(b.pageX-c.left,255),0);var d=Math.max(Math.min(b.pageY-c.top,255),0);this._hsv.s=Math.max(0,Math.min(1,a/255))*100;this._hsv.v=Math.max(0,Math.min(1,(255-d)/255))*100;this._updateValues(null)},_mouseDownBar:function(a){this._barActive=true;this._mouseBar(a)},_mouseBar:function(a){var b=this._bar.getOffsets("offset");var c=Math.max(Math.min(a.pageY-b.top,255),0);this._barSelector.css({top:c+"px"});this._hsv.h=Math.max(0,Math.min(359,Math.round((255-c)/255*360)));this._updateValues(null)},_blurRgba:function(){for(var a in this._rgba){var b=parseInt(this._rgba[a].val())||0;if(a==="a"){this._rgba[a].val(Math.max(0,Math.min(100,b)))}else{this._rgba[a].val(Math.max(0,Math.min(255,b)))}}this._updateValues({r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()},true,true)},_blurHex:function(){var a=this.hexToRgb(this._hex.val());if(a!==Number.NaN){this._updateValues(a,true,true)}},_updateValues:function(c,e,a){e=(e===true)?true:false;a=(a===true)?true:false;if(c===null){c=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);if(this._rgba.a.val()==0){c.a=100}}if(c.a===undefined){c.a=this._rgba.a.val()}for(var b in c){this._rgba[b].val(c[b])}this._hex.val(this.rgbToHex(c.r,c.g,c.b));if(e||a){var g=this.rgbToHsv(c.r,c.g,c.b);if(e){this._hsv.h=g.h}if(a){this._hsv.s=g.s;this._hsv.v=g.v}}var h=Math.max(0,Math.min(255,255-(this._hsv.h/360)*255));this._barSelector.css({top:h+"px"});var d=Math.max(0,Math.min(255,(this._hsv.s/100)*255));var h=Math.max(0,Math.min(255,255-((this._hsv.v/100)*255)));this._gradientSelector.css({left:(d-6)+"px",top:(h-6)+"px"});this._newColor.css({backgroundColor:"rgba("+c.r+", "+c.g+", "+c.b+", "+(c.a/100)+")"});var f=this.hsvToRgb(this._hsv.h,100,100);this._gradient.css({backgroundColor:"rgb("+f.r+", "+f.g+", "+f.b+")"})},hsvToRgb:function(d,j,g){var b={r:0,g:0,b:0};var i,a,f,e,c;i=Math.floor(d/60);a=d/60-i;j/=100;g/=100;f=g*(1-j);e=g*(1-j*a);c=g*(1-j*(1-a));if(j==0){b.r=b.g=b.b=g}else{switch(i){case 1:b.r=e;b.g=g;b.b=f;break;case 2:b.r=f;b.g=g;b.b=c;break;case 3:b.r=f;b.g=e;b.b=g;break;case 4:b.r=c;b.g=f;b.b=g;break;case 5:b.r=g;b.g=f;b.b=e;break;case 0:case 6:b.r=g;b.g=c;b.b=f;break}}return{r:Math.round(b.r*255),g:Math.round(b.g*255),b:Math.round(b.b*255)}},rgbToHsv:function(a,f,i){var j,e,c;var d,k,h;a/=255;f/=255;i/=255;d=Math.max(Math.max(a,f),i);k=Math.min(Math.min(a,f),i);h=d-k;j=0;if(d!==k){switch(d){case a:j=60*(0+(f-i)/h);break;case f:j=60*(2+(i-a)/h);break;case i:j=60*(4+(a-f)/h);break}if(j<0){j+=360}}if(d===0){e=0}else{e=h/d}c=d;return{h:Math.round(j),s:Math.round(e*100),v:Math.round(c*100)}},hexToRgb:function(a){if(/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(a)){a=a.split("");if(a[0]==="#"){a.shift()}if(a.length===3){return{r:parseInt(a[0]+""+a[0],16),g:parseInt(a[1]+""+a[1],16),b:parseInt(a[2]+""+a[2],16)}}else{return{r:parseInt(a[0]+""+a[1],16),g:parseInt(a[2]+""+a[3],16),b:parseInt(a[4]+""+a[5],16)}}}return Number.NaN},rgbToHex:function(d,c,a){return("0123456789ABCDEF".charAt((d-d%16)/16)+""+"0123456789ABCDEF".charAt(d%16))+""+("0123456789ABCDEF".charAt((c-c%16)/16)+""+"0123456789ABCDEF".charAt(c%16))+""+("0123456789ABCDEF".charAt((a-a%16)/16)+""+"0123456789ABCDEF".charAt(a%16))}}); })(this);