// ***************************
// js.compressed/colorpicker.min.js
// ***************************
/**
*
* Color picker
* Author: Stefan Petre www.eyecon.ro
*
* Dual licensed under the MIT and GPL licenses
*
*/
(function(a){var b=function(){var b={},c,d=65,e,f='
',g={eventName:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},color:"ff0000",livePreview:true,flat:false},h=function(b,c){var d=Q(b);a(c).data("colorpicker").fields.eq(1).val(d.r).end().eq(2).val(d.g).end().eq(3).val(d.b).end()},i=function(b,c){a(c).data("colorpicker").fields.eq(4).val(b.h).end().eq(5).val(b.s).end().eq(6).val(b.b).end()},j=function(b,c){a(c).data("colorpicker").fields.eq(0).val(S(b)).end()},k=function(b,c){a(c).data("colorpicker").selector.css("backgroundColor","#"+S({h:b.h,s:100,b:100}));a(c).data("colorpicker").selectorIndic.css({left:parseInt(150*b.s/100,10),top:parseInt(150*(100-b.b)/100,10)})},l=function(b,c){a(c).data("colorpicker").hue.css("top",parseInt(150-150*b.h/360,10))},m=function(b,c){a(c).data("colorpicker").currentColor.css("backgroundColor","#"+S(b))},n=function(b,c){a(c).data("colorpicker").newColor.css("backgroundColor","#"+S(b))},o=function(b){var c=b.charCode||b.keyCode||-1;if(c>d&&c<=90||c==32){return false}var e=a(this).parent().parent();if(e.data("colorpicker").livePreview===true){p.apply(this)}},p=function(b){var c=a(this).parent().parent(),d;if(this.parentNode.className.indexOf("_hex")>0){c.data("colorpicker").color=d=O(M(this.value))}else if(this.parentNode.className.indexOf("_hsb")>0){c.data("colorpicker").color=d=K({h:parseInt(c.data("colorpicker").fields.eq(4).val(),10),s:parseInt(c.data("colorpicker").fields.eq(5).val(),10),b:parseInt(c.data("colorpicker").fields.eq(6).val(),10)})}else{c.data("colorpicker").color=d=P(L({r:parseInt(c.data("colorpicker").fields.eq(1).val(),10),g:parseInt(c.data("colorpicker").fields.eq(2).val(),10),b:parseInt(c.data("colorpicker").fields.eq(3).val(),10)}))}if(b){h(d,c.get(0));j(d,c.get(0));i(d,c.get(0))}k(d,c.get(0));l(d,c.get(0));n(d,c.get(0));c.data("colorpicker").onChange.apply(c,[d,S(d),Q(d)])},q=function(b){var c=a(this).parent().parent();c.data("colorpicker").fields.parent().removeClass("colorpicker_focus")},r=function(){d=this.parentNode.className.indexOf("_hex")>0?70:65;a(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus");a(this).parent().addClass("colorpicker_focus")},s=function(b){var c=a(this).parent().find("input").focus();var d={el:a(this).parent().addClass("colorpicker_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:this.parentNode.className.indexOf("_hsb")>0?100:255,y:b.pageY,field:c,val:parseInt(c.val(),10),preview:a(this).parent().parent().data("colorpicker").livePreview};a(document).bind("mouseup",d,u);a(document).bind("mousemove",d,t)},t=function(a){a.data.field.val(Math.max(0,Math.min(a.data.max,parseInt(a.data.val+a.pageY-a.data.y,10))));if(a.data.preview){p.apply(a.data.field.get(0),[true])}return false},u=function(b){p.apply(b.data.field.get(0),[true]);b.data.el.removeClass("colorpicker_slider").find("input").focus();a(document).unbind("mouseup",u);a(document).unbind("mousemove",t);return false},v=function(b){var c={cal:a(this).parent(),y:a(this).offset().top};c.preview=c.cal.data("colorpicker").livePreview;a(document).bind("mouseup",c,x);a(document).bind("mousemove",c,w)},w=function(a){p.apply(a.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360*(150-Math.max(0,Math.min(150,a.pageY-a.data.y)))/150,10)).get(0),[a.data.preview]);return false},x=function(b){h(b.data.cal.data("colorpicker").color,b.data.cal.get(0));j(b.data.cal.data("colorpicker").color,b.data.cal.get(0));a(document).unbind("mouseup",x);a(document).unbind("mousemove",w);return false},y=function(b){var c={cal:a(this).parent(),pos:a(this).offset()};c.preview=c.cal.data("colorpicker").livePreview;a(document).bind("mouseup",c,A);a(document).bind("mousemove",c,z)},z=function(a){p.apply(a.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100*(150-Math.max(0,Math.min(150,a.pageY-a.data.pos.top)))/150,10)).end().eq(5).val(parseInt(100*Math.max(0,Math.min(150,a.pageX-a.data.pos.left))/150,10)).get(0),[a.data.preview]);return false},A=function(b){h(b.data.cal.data("colorpicker").color,b.data.cal.get(0));j(b.data.cal.data("colorpicker").color,b.data.cal.get(0));a(document).unbind("mouseup",A);a(document).unbind("mousemove",z);return false},B=function(b){a(this).addClass("colorpicker_focus")},C=function(b){a(this).removeClass("colorpicker_focus")},D=function(b){a(this).addClass("colorpicker_focus")},E=function(b){a(this).removeClass("colorpicker_focus")},F=function(b){var c=a(this).parent();var d=c.data("colorpicker").color;c.data("colorpicker").origColor=d;m(d,c.get(0));c.data("colorpicker").onSubmit(d,S(d),Q(d),c.data("colorpicker").el);a(c.data("colorpicker").el).ColorPickerHide()},G=function(b){var c=a("#"+a(this).data("colorpickerId"));c.data("colorpicker").onBeforeShow.apply(this,[c.get(0)]);var d=a(this).offset();var e=J();var f=d.top+this.offsetHeight;var g=d.left;if(f+176>e.t+e.h){f-=this.offsetHeight+176}if(g+356>e.l+e.w){g-=356}c.css({left:g+"px",top:f+"px"});if(c.data("colorpicker").onShow.apply(this,[c.get(0)])!=false){c.show()}a(document).bind("mousedown",{cal:c},H);return false},H=function(b){if(!I(b.data.cal.get(0),b.target,b.data.cal.get(0))){if(b.data.cal.data("colorpicker").onHide.apply(this,[b.data.cal.get(0)])!=false){b.data.cal.hide()}a(document).unbind("mousedown",H)}},I=function(a,b,c){if(a==b){return true}if(a.contains){return a.contains(b)}if(a.compareDocumentPosition){return!!(a.compareDocumentPosition(b)&16)}var d=b.parentNode;while(d&&d!=c){if(d==a)return true;d=d.parentNode}return false},J=function(){var a=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(a?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(a?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(a?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(a?document.documentElement.clientHeight:document.body.clientHeight)}},K=function(a){return{h:Math.min(360,Math.max(0,a.h)),s:Math.min(100,Math.max(0,a.s)),b:Math.min(100,Math.max(0,a.b))}},L=function(a){return{r:Math.min(255,Math.max(0,a.r)),g:Math.min(255,Math.max(0,a.g)),b:Math.min(255,Math.max(0,a.b))}},M=function(a){var b=6-a.length;if(b>0){var c=[];for(var d=0;d-1?a.substring(1):a,16);return{r:a>>16,g:(a&65280)>>8,b:a&255}},O=function(a){return P(N(a))},P=function(a){var b={h:0,s:0,b:0};var c=Math.min(a.r,a.g,a.b);var d=Math.max(a.r,a.g,a.b);var e=d-c;b.b=d;if(d!=0){}b.s=d!=0?255*e/d:0;if(b.s!=0){if(a.r==d){b.h=(a.g-a.b)/e}else if(a.g==d){b.h=2+(a.b-a.r)/e}else{b.h=4+(a.r-a.g)/e}}else{b.h=-1}b.h*=60;if(b.h<0){b.h+=360}b.s*=100/255;b.b*=100/255;return b},Q=function(a){var b={};var c=Math.round(a.h);var d=Math.round(a.s*255/100);var e=Math.round(a.b*255/100);if(d==0){b.r=b.g=b.b=e}else{var f=e;var g=(255-d)*e/255;var h=(f-g)*(c%60)/60;if(c==360)c=0;if(c<60){b.r=f;b.b=g;b.g=g+h}else if(c<120){b.g=f;b.b=g;b.r=f-h}else if(c<180){b.g=f;b.r=g;b.b=g+h}else if(c<240){b.b=f;b.r=g;b.g=f-h}else if(c<300){b.b=f;b.g=g;b.r=g+h}else if(c<360){b.r=f;b.g=g;b.b=f-h}else{b.r=0;b.g=0;b.b=0}}return{r:Math.round(b.r),g:Math.round(b.g),b:Math.round(b.b)}},R=function(b){var c=[b.r.toString(16),b.g.toString(16),b.b.toString(16)];a.each(c,function(a,b){if(b.length==1){c[a]="0"+b}});return c.join("")},S=function(a){return R(Q(a))},T=function(){var b=a(this).parent();var c=b.data("colorpicker").origColor;b.data("colorpicker").color=c;h(c,b.get(0));j(c,b.get(0));i(c,b.get(0));k(c,b.get(0));l(c,b.get(0));n(c,b.get(0));b.data("colorpicker").onChange.apply(b,[c,S(c),Q(c)])};return{init:function(b){b=a.extend({},g,b||{});if(typeof b.color=="string"){if(b.color.indexOf("rgb(")!=-1){var c=b.color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);b.color=P({r:parseInt(c[1]),g:parseInt(c[2]),b:parseInt(c[3])})}else{b.color=O(b.color)}}else if(b.color.r!=undefined&&b.color.g!=undefined&&b.color.b!=undefined){b.color=P(b.color)}else if(b.color.h!=undefined&&b.color.s!=undefined&&b.color.b!=undefined){b.color=K(b.color)}else{return this}return this.each(function(){if(!a(this).data("colorpickerId")){var c=a.extend({},b);c.origColor=b.color;var d="collorpicker_"+parseInt(Math.random()*1e3);a(this).data("colorpickerId",d);var e=a(f).attr("id",d);if(c.flat){e.appendTo(this).show()}else{e.appendTo(document.body)}c.fields=e.find("input").bind("keyup",o).bind("change",p).bind("blur",q).bind("focus",r);e.find("span").bind("mousedown",s).end().find(">div.colorpicker_current_color").bind("click",T);c.selector=e.find("div.colorpicker_color").bind("mousedown",y);c.selectorIndic=c.selector.find("div div");c.el=this;c.hue=e.find("div.colorpicker_hue div");e.find("div.colorpicker_hue").bind("mousedown",v);c.newColor=e.find("div.colorpicker_new_color");c.currentColor=e.find("div.colorpicker_current_color");e.data("colorpicker",c);e.find("div.colorpicker_submit").bind("mouseenter",B).bind("mouseleave",C).bind("click",F);e.find("div.colorpicker_cancel").bind("mouseenter",D).bind("mouseleave",E).bind("click",function(){var b=a(this).parent();T.apply(this);a(b.data("colorpicker").el).ColorPickerHide()});h(c.color,e.get(0));i(c.color,e.get(0));j(c.color,e.get(0));l(c.color,e.get(0));k(c.color,e.get(0));m(c.color,e.get(0));n(c.color,e.get(0));if(c.flat){e.css({position:"relative",display:"block"})}else{a(this).bind(c.eventName,G)}}})},showPicker:function(){return this.each(function(){if(a(this).data("colorpickerId")){G.apply(this)}})},hidePicker:function(){return this.each(function(){if(a(this).data("colorpickerId")){a("#"+a(this).data("colorpickerId")).hide()}})},setColor:function(b){if(typeof b=="string"){if(b.indexOf("rgb(")!=-1){var c=b.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);b=P({r:parseInt(c[1]),g:parseInt(c[2]),b:parseInt(c[3])})}else{b=O(b)}}else if(b.r!=undefined&&b.g!=undefined&&b.b!=undefined){b=P(b)}else if(b.h!=undefined&&b.s!=undefined&&b.b!=undefined){b=K(b)}else{return this}return this.each(function(){if(a(this).data("colorpickerId")){var c=a("#"+a(this).data("colorpickerId"));c.data("colorpicker").color=b;c.data("colorpicker").origColor=b;h(b,c.get(0));i(b,c.get(0));j(b,c.get(0));l(b,c.get(0));k(b,c.get(0));m(b,c.get(0));n(b,c.get(0))}})},getColor:function(){if(a(this).data("colorpickerId")){var b=a("#"+a(this).data("colorpickerId"));var c=b.data("colorpicker").color;var d=Q(c);return{rgb:d,hex:R(d),hsb:c}}}}}();a.fn.extend({ColorPicker:b.init,ColorPickerHide:b.hidePicker,ColorPickerShow:b.showPicker,ColorPickerSetColor:b.setColor,ColorPickerGetColor:b.getColor})})(jQuery);
// ***************************
// js.compressed/vbColorPicker.js
// ***************************
var vBulletin_ColorPicker=function(A,C){$("").appendTo("head").attr({rel:"stylesheet",type:"text/css",href:pageData.baseurl+"/js/colorpicker/css/colorpicker.css"});B();function B(){$(A).each(function(){var D=$(this);var F=$('').insertBefore(D);F.css("backgroundColor",D.val());var G=F.css("backgroundColor");D.off("keyup").on("keyup",function(){F.css("backgroundColor",D.val());F.ColorPickerSetColor(F.css("backgroundColor"));if(C.onChange){var H=F.ColorPickerGetColor();C.onChange.call(D,"#"+H.hex)}});var E={color:C.color?C.color:G,onChange:function(H,J,I){D.val("#"+J);F.css("backgroundColor","#"+J);if(C.onChange){C.onChange.call(D,"#"+J)}},onSubmit:function(H,K,I,J){$(J).val(K);D.val("#"+K);F.css("backgroundColor","#"+K);if(C.onSubmit&&typeof C.onSubmit=="function"){C.onSubmit.call(D,"#"+K)}}};if(C.fadeIn){E.onShow=function(H){$(H).fadeIn(C.fadeSpeed?C.fadeSpeed:500);if(C.onShow){C.onShow.call(H)}return false}}if(C.fadeOut){E.onHide=function(H){$(H).fadeIn(C.fadeSpeed?C.fadeSpeed:500);if(C.onHide){C.onHide.call(H)}return false}}if(!C.fadeIn&&C.onShow){E.onShow=C.onShow}if(!C.fadeOut&&C.onHide){E.onHide=C.onHide}F.ColorPicker(E)})}};;
// ***************************
// js.compressed/profile_customization.js
// ***************************
window.vBulletin=window.vBulletin||{};window.vBulletin.phrase=window.vBulletin.phrase||{};window.vBulletin.phrase.precache=window.vBulletin.phrase.precache||[];window.vBulletin.phrase.precache=$.merge(window.vBulletin.phrase.precache,["error_x","error_saving_customizations","profile_style_customizations","saving","style_applied_as_site_default","kilobytes","set_to_default","profile_theme_reset_confirmation","reverting"]);var cssMappings={profcustom_navbar_background_active:[".profileTabs .widget-tabs-nav li.ui-tabs-selected a"],profcustom_navbar_border_active:[".profileTabs .widget-tabs-nav li.ui-tabs-selected a"],profcustom_navbar_text_color_active:[".profileTabs .widget-tabs-nav li.ui-tabs-selected a"],profcustom_navbar_background:[".profileTabs .widget-tabs-nav li.ui-state-default a"],profcustom_navbar_border:[".profileTabs .widget-tabs-nav li.ui-state-default a"],profcustom_navbar_text_color:[".profileTabs .widget-tabs-nav li.ui-state-default a"],toolbar_background:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar",".forum-list-container .forum-list-header"],side_nav_divider_border:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar",".forum-list-container .forum-list-header"],profcustom_navbar_toolbar_text_color:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar",".forum-list-container .forum-list-header"],profcustom_navbarbutton_background:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.primary"],profcustom_navbarbutton_border:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.primary"],profcustom_navbarbutton_color:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.primary"],profile_button_secondary_background:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.secondary"],profcustom_navbarbuttonsecondary_border:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.secondary"],profcustom_navbarbuttonsecondary_color:[".profileTabs .conversation-toolbar-wrapper .conversation-toolbar .button.secondary"],profile_content_background:["#profileTabs","#profileTabs .conversation-list.stream-view .list-item"],profile_content_border:[".profileTabs .tab .list-container","#profileTabs .conversation-list.stream-view"],profile_content_divider_border:[".profileTabs .post-footer-wrapper .post-footer .divider"],profile_section_background:[".profileTabs .section .section-header"],profile_section_border:[".profileTabs .section .section-header"],profile_section_text_color:[".profileTabs .section .section-header"],profile_section_font:[".profileTabs .section .section-header"],profile_content_primarytext:["#profileTabs.profileTabs","#profileTabs.profileTabs .conversation-list.stream-view .list-item","#profileTabs.profileTabs .widget-content","#profileTabs.profileTabs .post-content"],profile_content_secondarytext:[".profile-widget .post-footer-wrapper .post-footer ul li",".profile-widget .conversation-list.stream-view .list-item-header .info .subscribed",".canvas-layout-container .canvas-widget .widget-content .profileTabs .post-date"],profile_content_linktext:[".profile-widget .widget-tabs.ui-tabs .ui-widget-content a",".profile-widget .widget-tabs.ui-tabs .ui-widget-content a:active",".profile-widget .widget-tabs.ui-tabs .ui-widget-content a:visited"],profile_content_font:["#profileTabs"],side_nav_background:[".profile_sidebar_content"],form_dropdown_border:[".profile_sidebar_content"],side_nav_avatar_border:[".profile-sidebar-widget .profileContainer .profile-photo-wrapper .profile-photo"],side_nav_divider_border:[".profile-sidebar-widget .profile-menulist .profile-menulist-item"],profile_userpanel_textcolor:[".profile_sidebar_content",".profile_sidebar_content .profile-menulist-item a label"],profile_userpanel_linkcolor:[".profile_sidebar_content .profile-menulist-item a .subscriptions-count, .profile_sidebar_content .profile-menulist-item a .subscriptions-count:hover, .profile_sidebar_content .profile-menulist-item a .subscriptions-count:visited"],profile_userpanel_font:[".profile_sidebar_content"],profilesidebar_button_background:[".profile_sidebar_content .button.primary"],profilesidebar_button_border:[".profile_sidebar_content .button.primary"],profilesidebar_button_text_color:[".profile_sidebar_content .button.primary"],button_primary_text_color:[".profileTabs .button.primary",".profileTabs .button.primary:hover"],button_primary_border:[".profileTabs .button.primary",".profileTabs .button.primary:hover"],profile_button_primary_background:[".profileTabs .button.primary",".profileTabs .button.primary:hover"]};var colorTypes={profcustom_navbar_background_active:3,profcustom_navbar_background:3,profile_button_primary_background:3,profile_button_secondary_background:3,toolbar_background:3,profile_content_background:3,profile_section_background:3,side_nav_background:3,profilesidebar_button_background:3,module_tab_border_active:2,module_tab_border:2,button_primary_border:2,button_secondary_border:2,side_nav_divider_border:2,profile_content_border:2,profile_section_border:2,profile_content_divider_border:2,profile_section_border:2,form_dropdown_border:2,side_nav_avatar_border:2,side_nav_divider_border:2,profilesidebar_button_border:2,profcustom_navbar_text_color_active:1,profcustom_navbar_text_color:1,button_secondary_text_color:1,profcustom_navbar_toolbar_text_color:1,profile_section_color:1,profile_section_text_color:1,profile_content_primarytext:1,profile_content_secondarytext:1,profile_content_linktext:1,profile_userpanel_textcolor:1,profile_userpanel_linkcolor:1,profilesidebar_button_text_color:1,button_primary_text_color:1,button_primary_border:2,profile_button_primary_background:3,profcustom_navbarbutton_color:1,profcustom_navbarbutton_border:2,profcustom_navbarbutton_background:3,profcustom_navbarbuttonsecondary_color:1,profcustom_navbarbuttonsecondary_border:2,profile_button_secondary_background:3};var newSettings={};var revertChanges=function(A){$.each(A,function(C,B){targetEl=$("[name="+C+"]");$.each(B,function(D,E){if(E&&E!=""){switch(D){case"color":targetEl.val(E);targetEl.trigger("keyup");break;case"image":setBackgroundImage("",E,C);break;case"family":if(targetEl.length>1){$.each(targetEl,function(G,F){if($(F).attr("data-type")=="family"){$(F).val(E);$(F).trigger("change")}})}else{targetEl.val(E);targetEl.trigger("change")}break;case"size":if(targetEl.length>1){$.each(targetEl,function(G,F){if($(F).attr("data-type")=="size"){$(F).val(E);$(F).trigger("change")}})}else{targetEl.val(E);targetEl.trigger("change")}break;case"repeat":targetEl=$("[name=repeat_type]");if(targetEl.length>1){$.each(targetEl,function(G,F){if($(F).attr("data")==C){$(F).val(E);$(F).trigger("change")}})}else{targetEl.val(E);targetEl.trigger("change")}break;default:break}}})})};var uploadFromUrl=function(A){form=$(A.target).closest(".frmBgImageUrl");if(form.length){remoteUrl=$(form).find(".profCustomBgImageUrl");if(remoteUrl&&$(remoteUrl).val()){$.ajax({url:vBulletin.getAjaxBaseurl()+"/uploader/url",data:{urlupload:remoteUrl.val()},type:"post",dataType:"json",success:function(B){if(B){if(B.errors){if(typeof (B.errors[0])=="undefined"){openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get(B.errors),iconType:"error"})}else{openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get(B.errors[0][0]),iconType:"error"})}}else{if(B.imageUrl){setBackgroundImage(A,B.imageUrl)}else{openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get("unable_to_upload_file"),iconType:"error"})}}}else{openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error"})}},fail:function(C){var D=vBulletin.phrase.get("error_uploading_image");var B="error";if(C&&C.files.length>0){switch(C.files[0].error){case"acceptFileTypes":D=vBulletin.phrase.get("invalid_image_allowed_filetypes_are");B="warning";break}}openAlertDialog({title:vBulletin.phrase.get("upload"),message:D,iconType:B,onAfterClose:function(){$editProfilePhotoDlg.find(".fileText").val("");$editProfilePhotoDlg.find(".browse-option").focus()}})}})}}};var setBgRepeat=function(A){ident=$(A.target).attr("data");repeat=A.target.value;if(typeof (cssMappings[ident])!="undefined"){selectors=cssMappings[ident];addNewSetting(ident,"repeat",repeat);if(typeof newSettings[ident]["image"]=="undefined"){newSettings[ident]["image"]=$(selectors[0]).css("background-image")}for(i=0;i")}else{var G=vBulletin.phrase.get(F.error)}openAlertDialog({title:vBulletin.phrase.get("profile_customization"),message:G,iconType:"error"});return }else{if(typeof E==="function"){E(F)}}},"json").error(function(){openAlertDialog({title:vBulletin.phrase.get("conversation"),message:vBulletin.phrase.get("error_saving_customizations"),iconType:"error"})}).complete(function(){window.vBulletin.loadingIndicator.hide()})};function addNewSetting(C,A,B){if(newSettings[C]){newSettings[C][A]=B}else{newSettings[C]={};newSettings[C][A]=B}}function toggleBgType(A){imgRadio=$(A.target).closest(".profCustomBackgroundEdit").find(".profCustomBgTypeColor");if(A.target.value=="color"){$(A.target).closest(".profCustomBackgroundEdit").find(".profCustomBgImage").addClass("h-hide");$(A.target).closest(".profCustomBackgroundEdit").find(".profCustomBgColor").removeClass("h-hide")}else{$(A.target).closest(".profCustomBackgroundEdit").find(".profCustomBgColor").addClass("h-hide");$(A.target).closest(".profCustomBackgroundEdit").find(".profCustomBgImage").removeClass("h-hide")}}function toggleImgSource(A){if(A.target.value=="file"){$(A.target).closest(".profCustomBackgroundEdit").find(".frmBgImageUrl").addClass("h-hide");$(A.target).closest(".profCustomBackgroundEdit").find(".frmBgImageFile, .ProfCustomBgRepeat").removeClass("h-hide")}else{if(A.target.value=="url"){$(A.target).closest(".profCustomBackgroundEdit").find(".frmBgImageFile").addClass("h-hide");$(A.target).closest(".profCustomBackgroundEdit").find(".frmBgImageUrl, .ProfCustomBgRepeat").removeClass("h-hide")}else{$(A.target).closest(".profCustomBackgroundEdit").find(".frmBgImageFile, .frmBgImageUrl, .ProfCustomBgRepeat").addClass("h-hide")}}}function updateColorFromComponent(A){addNewSetting($(this).attr("data"),"color",A);$(this).parent().find(".rdProfCustomBgColorClear").prop("checked",false);if(typeof (cssMappings[$(this).attr("data")])!="undefined"){selectors=cssMappings[$(this).attr("data")];for(selector in selectors){switch(colorTypes[$(this).attr("data")]){case 1:$(selectors[selector]).css("color",A);break;case 2:$(selectors[selector]).css("border-color",A);break;case 3:$(selectors[selector]).css("background-color",A);$(selectors[selector]).css("background-image","none");break}}}}function setFontFamily(A){fontname=$(A.target).find(">option:selected").text();ident=$(A.target).attr("data");addNewSetting(ident,"family",fontname);displayname=A.target.options[A.target.selectedIndex].innerHTML;$(A.target).closest(".fontselectorWrapper").find(".fontDisplay").css("font-family",fontname).html(fontname);if(typeof (cssMappings[ident])!="undefined"){selectors=cssMappings[ident];for(selector in selectors){$(selectors[selector]).css("font-family",fontname)}}}function setFontSize(A){ident=$(A.target).attr("data");$(A.target).closest(".fontselectorWrapper").find(".fontDisplay").css("font-size",A.target.value);addNewSetting(ident,"size",A.target.value);if(typeof (cssMappings[ident])!="undefined"){selectors=cssMappings[ident];for(selector in selectors){$(selectors[selector]).css("font-size",A.target.value)}}}function setCurrentBgValues(G){var F=G.attr("data");if(typeof cssMappings[F]!="undefined"){selector=cssMappings[F][0];var E=$(selector),D={},C="";D.color=E.css("background-color");D.image=E.css("background-image");D.repeat=E.css("background-repeat");if((typeof D.image!="undefined")&&(D.image!="none")){var H=D.image.lastIndexOf("/")+1,B=D.image.length,A=B-H-2;C=D.image.substr(H,A);G.find(".fileText").val(C);if(D.repeat!=""){G.find(".ProfCustomBgRepeatType").val(D.repeat)}}else{if(D.color=="transparent"){G.find(".rdProfCustomBgColorClear").prop("checked",true)}}if(C!=""){G.find(".rdProfCustomBgTypeImage").trigger("click")}else{G.find(".rdProfCustomBgTypeColor").trigger("click")}}}(function(A){var B=[".profileEditContent"];if(!vBulletin.pageHasSelectors(B)){return false}A(document).ready(function(){bgCount=0;A(".profile_custom_edit .profileTabs").tabs();A(".profCustomBackgroundEdit").each(function(D){bgCount++;content=A(".profCustomBgTemplate").clone();var C=A(this);A(content).removeClass("h-hide profCustomBgTemplate");A(content).css("display","block");C.append(content);C.find(".colorPicker").attr("data",C.attr("data"));C.find(".colorPicker").attr("name",C.attr("data"));C.find(".colorPicker").removeClass("template");C.find(".rdProfCustomBgTypeColor, .rdProfCustomBgTypeImage").off("click").on("click",toggleBgType);C.find(".rdProfCustomBgTypeColor, .rdProfCustomBgTypeImage").prop("name","profCustomBgType"+bgCount);C.find(".rdProfCustomFile, .rdProfCustomUrl, .rdProfCustomBgImageNone").off("click").on("click",toggleImgSource);C.find(".rdProfCustomFile, .rdProfCustomUrl, .rdProfCustomBgImageNone").attr("name","profCustomBgSrc"+bgCount);C.find(".profCustomBgImageFile, .profCustomBgImageUrl, .rdProfCustomBgColorClear, .rdProfCustomBgImageNone, .ProfCustomBgRepeatType, .profCustomUploadUrl").attr("data",A(this).attr("data"));setCurrentBgValues(C);A(this).find(".profCustomBgImageFile").fileupload({url:vBulletin.getAjaxBaseurl()+"/uploader/upload_file",dataType:"json",add:function(F,E){E.submit()},done:function(F,E){if(E){if(E.result.errors){if(typeof (E.result.errors[0])=="undefined"){openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get(E.result.errors),iconType:"error"})}else{openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get(E.result.errors[0][0]),iconType:"error"})}}else{if(E.result.imageUrl){C.find(".profile-img-option-container .profile-img-option-field input.fileText").val(E.result.filename);setBackgroundImage(F,E.result.imageUrl)}else{openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get("unable_to_upload_file"),iconType:"error"})}}}else{openAlertDialog({title:vBulletin.phrase.get("profile_style_customizations"),message:vBulletin.phrase.get("invalid_server_response_please_try_again"),iconType:"error"})}},fail:function(H,F){var G=vBulletin.phrase.get("error_uploading_image");var E="error";if(F&&F.files.length>0){switch(F.files[0].error){case"acceptFileTypes":G=vBulletin.phrase.get("invalid_image_allowed_filetypes_are");E="warning";break}}openAlertDialog({title:vBulletin.phrase.get("upload"),message:G,iconType:E,onAfterClose:function(){$editProfilePhotoDlg.find(".fileText").val("");$editProfilePhotoDlg.find(".browse-option").focus()}})}})});if(A("body").is(".view-mode")){vBulletin_ColorPicker(".colorPicker",{onChange:updateColorFromComponent});A(".selectCustomProfFontfamily").off("change").on("change",setFontFamily);A(".selectCustomProfFontsize").off("change").on("change",setFontSize);A(".rdProfCustomBgImageNone").off("click").on("click",clearBgImage);A(".rdProfCustomBgColorClear").off("click").on("click",clearBgColor);A(".ProfCustomBgRepeatType").off("change").on("change",setBgRepeat);A(".profCustomUploadUrl").off("click").on("click",uploadFromUrl)}A(".profCustomSave").off("click").on("click",function(){if(A.isEmptyObject(newSettings)){var D=vBulletin.phrase.get("there_are_no_changes_to_save");openAlertDialog({title:vBulletin.phrase.get("profile_customization"),message:D,iconType:"error"});return }var C=newSettings;newSettings={};makeServerRequest("/profile/save-stylevar",{stylevars:C,userid:pageData.userid},vBulletin.phrase.get("saving")+"...",function(E){openAlertDialog({title:vBulletin.phrase.get("profile_customization"),message:vBulletin.phrase.get("usercss_saved"),})})});A(".profCustomRevert").off("click").on("click",function(){var C=[],D=0;if(A.isEmptyObject(newSettings)){var E=vBulletin.phrase.get("there_are_no_changes_to_revert");openAlertDialog({title:vBulletin.phrase.get("profile_customization"),message:E,iconType:"error"});return }A.each(newSettings,function(F,G){C[D]=F;D++});makeServerRequest("/profile/revert-stylevars",{stylevars:C,userid:pageData.userid},"Reverting...",function(F){revertChanges(F)});newSettings={}});A(".profCustomDefault").off("click").on("click",function(){var C=[],D=0;if(!A.isEmptyObject(newSettings)){A.each(newSettings,function(E,F){C[D]=E;D++})}openConfirmDialog({title:vBulletin.phrase.get("set_to_default"),message:vBulletin.phrase.get("profile_theme_reset_confirmation"),iconType:"warning",onClickYes:function(){makeServerRequest("/profile/reset-default",{stylevars:C,userid:pageData.userid},vBulletin.phrase.get("reverting")+"...",function(E){window.location.reload()});newSettings={}}})});A(".profCustomApplyAll").off("click").on("click",function(){makeServerRequest("/profile/save-default",{stylevars:newSettings,userid:pageData.userid},"Saving...",function(C){openAlertDialog({title:vBulletin.phrase.get("profile_customization"),message:vBulletin.phrase.get("style_applied_as_site_default")})})});A(".profCustomCancel").off("click").on("click",function(){A(".profile_custom_edit").addClass("h-hide")})})})(jQuery);;