// ***************************
// js.compressed/colorpicker.min.js
// ***************************
/**
 *
 * Color picker
 * Author: Stefan Petre www.eyecon.ro
 *
 * Dual licensed under the MIT and GPL licenses
 *
 */
(function(B){var A=function(){var v={},C,q=65,V,s='<div class="colorpicker"><div class="colorpicker_color"><div><div></div></div></div><div class="colorpicker_hue"><div></div></div><div class="colorpicker_new_color"></div><div class="colorpicker_current_color"></div><div class="colorpicker_hex"><input type="text" maxlength="6" size="6" /></div><div class="colorpicker_rgb_r colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_g colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_rgb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_h colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_s colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_hsb_b colorpicker_field"><input type="text" maxlength="3" size="3" /><span></span></div><div class="colorpicker_cancel"></div><div class="colorpicker_submit"></div></div>',e={eventName:"click",onShow:function(){},onBeforeShow:function(){},onHide:function(){},onChange:function(){},onSubmit:function(){},color:"ff0000",livePreview:true,flat:false},m=function(w,y){var x=J(w);B(y).data("colorpicker").fields.eq(1).val(x.r).end().eq(2).val(x.g).end().eq(3).val(x.b).end()},W=function(w,x){B(x).data("colorpicker").fields.eq(4).val(w.h).end().eq(5).val(w.s).end().eq(6).val(w.b).end()},G=function(w,x){B(x).data("colorpicker").fields.eq(0).val(u(w)).end()},M=function(w,x){B(x).data("colorpicker").selector.css("backgroundColor","#"+u({h:w.h,s:100,b:100}));B(x).data("colorpicker").selectorIndic.css({left:parseInt(150*w.s/100,10),top:parseInt(150*(100-w.b)/100,10)})},j=function(w,x){B(x).data("colorpicker").hue.css("top",parseInt(150-150*w.h/360,10))},H=function(w,x){B(x).data("colorpicker").currentColor.css("backgroundColor","#"+u(w))},h=function(w,x){B(x).data("colorpicker").newColor.css("backgroundColor","#"+u(w))},P=function(w){var y=w.charCode||w.keyCode||-1;if((y>q&&y<=90)||y==32){return false}var x=B(this).parent().parent();if(x.data("colorpicker").livePreview===true){E.apply(this)}},E=function(x){var y=B(this).parent().parent(),w;if(this.parentNode.className.indexOf("_hex")>0){y.data("colorpicker").color=w=N(b(this.value))}else{if(this.parentNode.className.indexOf("_hsb")>0){y.data("colorpicker").color=w=F({h:parseInt(y.data("colorpicker").fields.eq(4).val(),10),s:parseInt(y.data("colorpicker").fields.eq(5).val(),10),b:parseInt(y.data("colorpicker").fields.eq(6).val(),10)})}else{y.data("colorpicker").color=w=I(o({r:parseInt(y.data("colorpicker").fields.eq(1).val(),10),g:parseInt(y.data("colorpicker").fields.eq(2).val(),10),b:parseInt(y.data("colorpicker").fields.eq(3).val(),10)}))}}if(x){m(w,y.get(0));G(w,y.get(0));W(w,y.get(0))}M(w,y.get(0));j(w,y.get(0));h(w,y.get(0));y.data("colorpicker").onChange.apply(y,[w,u(w),J(w)])},Q=function(w){var x=B(this).parent().parent();x.data("colorpicker").fields.parent().removeClass("colorpicker_focus")},n=function(){q=this.parentNode.className.indexOf("_hex")>0?70:65;B(this).parent().parent().data("colorpicker").fields.parent().removeClass("colorpicker_focus");B(this).parent().addClass("colorpicker_focus")},l=function(w){var y=B(this).parent().find("input").focus();var x={el:B(this).parent().addClass("colorpicker_slider"),max:this.parentNode.className.indexOf("_hsb_h")>0?360:(this.parentNode.className.indexOf("_hsb")>0?100:255),y:w.pageY,field:y,val:parseInt(y.val(),10),preview:B(this).parent().parent().data("colorpicker").livePreview};B(document).bind("mouseup",x,U);B(document).bind("mousemove",x,p)},p=function(w){w.data.field.val(Math.max(0,Math.min(w.data.max,parseInt(w.data.val+w.pageY-w.data.y,10))));if(w.data.preview){E.apply(w.data.field.get(0),[true])}return false},U=function(w){E.apply(w.data.field.get(0),[true]);w.data.el.removeClass("colorpicker_slider").find("input").focus();B(document).unbind("mouseup",U);B(document).unbind("mousemove",p);return false},Y=function(w){var x={cal:B(this).parent(),y:B(this).offset().top};x.preview=x.cal.data("colorpicker").livePreview;B(document).bind("mouseup",x,T);B(document).bind("mousemove",x,K)},K=function(w){E.apply(w.data.cal.data("colorpicker").fields.eq(4).val(parseInt(360*(150-Math.max(0,Math.min(150,(w.pageY-w.data.y))))/150,10)).get(0),[w.data.preview]);return false},T=function(w){m(w.data.cal.data("colorpicker").color,w.data.cal.get(0));G(w.data.cal.data("colorpicker").color,w.data.cal.get(0));B(document).unbind("mouseup",T);B(document).unbind("mousemove",K);return false},Z=function(w){var x={cal:B(this).parent(),pos:B(this).offset()};x.preview=x.cal.data("colorpicker").livePreview;B(document).bind("mouseup",x,d);B(document).bind("mousemove",x,S);w.data=x;S(w)},O={x:-1,y:-1},S=function(w){if(O.x==w.pageX&&O.y==w.pageY){return }O.x=w.pageX;O.y=w.pageY;E.apply(w.data.cal.data("colorpicker").fields.eq(6).val(parseInt(100*(150-Math.max(0,Math.min(150,(w.pageY-w.data.pos.top))))/150,10)).end().eq(5).val(parseInt(100*(Math.max(0,Math.min(150,(w.pageX-w.data.pos.left))))/150,10)).get(0),[w.data.preview]);return false},d=function(w){m(w.data.cal.data("colorpicker").color,w.data.cal.get(0));G(w.data.cal.data("colorpicker").color,w.data.cal.get(0));B(document).unbind("mouseup",d);B(document).unbind("mousemove",S);return false},X=function(w){B(this).addClass("colorpicker_focus")},t=function(w){B(this).removeClass("colorpicker_focus")},L=function(w){B(this).addClass("colorpicker_focus")},a=function(w){B(this).removeClass("colorpicker_focus")},R=function(x){var y=B(this).parent();var w=y.data("colorpicker").color;y.data("colorpicker").origColor=w;H(w,y.get(0));y.data("colorpicker").onSubmit(w,u(w),J(w),y.data("colorpicker").el);B(y.data("colorpicker").el).ColorPickerHide()},g=function(w){var AA=B("#"+B(this).data("colorpickerId"));AA.data("colorpicker").onBeforeShow.apply(this,[AA.get(0)]);var AB=B(this).offset();var z=c();var y=AB.top+this.offsetHeight;var x=AB.left;if(y+176>z.t+z.h){y-=this.offsetHeight+176}if(x+356>z.l+z.w){x-=356}AA.css({left:x+"px",top:y+"px"});if(AA.data("colorpicker").onShow.apply(this,[AA.get(0)])!=false){AA.show()}B(document).bind("mousedown",{cal:AA},r);return false},r=function(w){if(!k(w.data.cal.get(0),w.target,w.data.cal.get(0))){if(w.data.cal.data("colorpicker").onHide.apply(this,[w.data.cal.get(0)])!=false){w.data.cal.hide()}B(document).unbind("mousedown",r)}},k=function(y,x,w){if(y==x){return true}if(y.contains){return y.contains(x)}if(y.compareDocumentPosition){return !!(y.compareDocumentPosition(x)&16)}var z=x.parentNode;while(z&&z!=w){if(z==y){return true}z=z.parentNode}return false},c=function(){var w=document.compatMode=="CSS1Compat";return{l:window.pageXOffset||(w?document.documentElement.scrollLeft:document.body.scrollLeft),t:window.pageYOffset||(w?document.documentElement.scrollTop:document.body.scrollTop),w:window.innerWidth||(w?document.documentElement.clientWidth:document.body.clientWidth),h:window.innerHeight||(w?document.documentElement.clientHeight:document.body.clientHeight)}},F=function(w){return{h:Math.min(360,Math.max(0,w.h)),s:Math.min(100,Math.max(0,w.s)),b:Math.min(100,Math.max(0,w.b))}},o=function(w){return{r:Math.min(255,Math.max(0,w.r)),g:Math.min(255,Math.max(0,w.g)),b:Math.min(255,Math.max(0,w.b))}},b=function(y){var w=6-y.length;if(w>0){var z=[];for(var x=0;x<w;x++){z.push("0")}z.push(y);y=z.join("")}return y},D=function(w){var w=parseInt(((w.indexOf("#")>-1)?w.substring(1):w),16);return{r:w>>16,g:(w&65280)>>8,b:(w&255)}},N=function(w){return I(D(w))},I=function(y){var x={h:0,s:0,b:0};var z=Math.min(y.r,y.g,y.b);var w=Math.max(y.r,y.g,y.b);var AA=w-z;x.b=w;if(w!=0){}x.s=w!=0?255*AA/w:0;if(x.s!=0){if(y.r==w){x.h=(y.g-y.b)/AA}else{if(y.g==w){x.h=2+(y.b-y.r)/AA}else{x.h=4+(y.r-y.g)/AA}}}else{x.h=-1}x.h*=60;if(x.h<0){x.h+=360}x.s*=100/255;x.b*=100/255;return x},J=function(w){var y={};var AC=Math.round(w.h);var AB=Math.round(w.s*255/100);var x=Math.round(w.b*255/100);if(AB==0){y.r=y.g=y.b=x}else{var AD=x;var AA=(255-AB)*x/255;var z=(AD-AA)*(AC%60)/60;if(AC==360){AC=0}if(AC<60){y.r=AD;y.b=AA;y.g=AA+z}else{if(AC<120){y.g=AD;y.b=AA;y.r=AD-z}else{if(AC<180){y.g=AD;y.r=AA;y.b=AA+z}else{if(AC<240){y.b=AD;y.r=AA;y.g=AD-z}else{if(AC<300){y.b=AD;y.g=AA;y.r=AA+z}else{if(AC<360){y.r=AD;y.g=AA;y.b=AD-z}else{y.r=0;y.g=0;y.b=0}}}}}}}return{r:Math.round(y.r),g:Math.round(y.g),b:Math.round(y.b)}},f=function(w){var x=[w.r.toString(16),w.g.toString(16),w.b.toString(16)];B.each(x,function(y,z){if(z.length==1){x[y]="0"+z}});return x.join("")},u=function(w){return f(J(w))},i=function(){var x=B(this).parent();var w=x.data("colorpicker").origColor;x.data("colorpicker").color=w;m(w,x.get(0));G(w,x.get(0));W(w,x.get(0));M(w,x.get(0));j(w,x.get(0));h(w,x.get(0));x.data("colorpicker").onChange.apply(x,[w,u(w),J(w)])};return{init:function(w){w=B.extend({},e,w||{});if(typeof w.color=="string"){if(w.color.indexOf("rgb(")!=-1){var x=w.color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);w.color=I({r:parseInt(x[1]),g:parseInt(x[2]),b:parseInt(x[3])})}else{w.color=N(w.color)}}else{if(w.color.r!=undefined&&w.color.g!=undefined&&w.color.b!=undefined){w.color=I(w.color)}else{if(w.color.h!=undefined&&w.color.s!=undefined&&w.color.b!=undefined){w.color=F(w.color)}else{return this}}}return this.each(function(){if(!B(this).data("colorpickerId")){var y=B.extend({},w);y.origColor=w.color;var AA="collorpicker_"+parseInt(Math.random()*1000);B(this).data("colorpickerId",AA);var z=B(s).attr("id",AA);if(y.flat){z.appendTo(this).show()}else{z.appendTo(document.body)}y.fields=z.find("input").bind("keyup",P).bind("change",E).bind("blur",Q).bind("focus",n);z.find("span").bind("mousedown",l).end().find(">div.colorpicker_current_color").bind("click",i);y.selector=z.find("div.colorpicker_color").bind("mousedown",Z);y.selectorIndic=y.selector.find("div div");y.el=this;y.hue=z.find("div.colorpicker_hue div");z.find("div.colorpicker_hue").bind("mousedown",Y);y.newColor=z.find("div.colorpicker_new_color");y.currentColor=z.find("div.colorpicker_current_color");z.data("colorpicker",y);z.find("div.colorpicker_submit").bind("mouseenter",X).bind("mouseleave",t).bind("click",R);z.find("div.colorpicker_cancel").bind("mouseenter",L).bind("mouseleave",a).bind("click",function(){var AB=B(this).parent();i.apply(this);B(AB.data("colorpicker").el).ColorPickerHide()});m(y.color,z.get(0));W(y.color,z.get(0));G(y.color,z.get(0));j(y.color,z.get(0));M(y.color,z.get(0));H(y.color,z.get(0));h(y.color,z.get(0));if(y.flat){z.css({position:"relative",display:"block"})}else{B(this).bind(y.eventName,g)}}})},showPicker:function(){return this.each(function(){if(B(this).data("colorpickerId")){g.apply(this)}})},hidePicker:function(){return this.each(function(){if(B(this).data("colorpickerId")){B("#"+B(this).data("colorpickerId")).hide()}})},setColor:function(w){if(typeof w=="string"){if(w.indexOf("rgb(")!=-1){var x=w.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);w=I({r:parseInt(x[1]),g:parseInt(x[2]),b:parseInt(x[3])})}else{w=N(w)}}else{if(w.r!=undefined&&w.g!=undefined&&w.b!=undefined){w=I(w)}else{if(w.h!=undefined&&w.s!=undefined&&w.b!=undefined){w=F(w)}else{return this}}}return this.each(function(){if(B(this).data("colorpickerId")){var y=B("#"+B(this).data("colorpickerId"));y.data("colorpicker").color=w;y.data("colorpicker").origColor=w;m(w,y.get(0));W(w,y.get(0));G(w,y.get(0));j(w,y.get(0));M(w,y.get(0));H(w,y.get(0));h(w,y.get(0))}})},getColor:function(){if(B(this).data("colorpickerId")){var x=B("#"+B(this).data("colorpickerId"));var w=x.data("colorpicker").color;var y=J(w);return{rgb:y,hex:f(y),hsb:w}}}}}();B.fn.extend({ColorPicker:A.init,ColorPickerHide:A.hidePicker,ColorPickerShow:A.showPicker,ColorPickerSetColor:A.setColor,ColorPickerGetColor:A.getColor})})(jQuery);;

// ***************************
// js.compressed/vbColorPicker.js
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.5.2
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2019 MH Sub I, LLC dba vBulletin. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
var vBulletin_ColorPicker=function(A,C){$("<link>").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=$('<span class="'+(C.triggerClass?C.triggerClass:"colorPickerTrigger")+'"></span>').insertBefore(D);F.css("backgroundColor",D.val());var G=F.css("backgroundColor");D.off("keyup").on("keyup",function(){var H=/^[0-9a-f]{3}(?:[0-9a-f]{3})?$/i;if(H.test(D.val())){D.val("#"+D.val())}F.css("backgroundColor",D.val());F.ColorPickerSetColor(F.css("backgroundColor"));if(C.onChange){var I=F.ColorPickerGetColor();C.onChange.call(D,"#"+I.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
// ***************************
/*=======================================================================*\
|| ###################################################################### ||
|| # vBulletin 5.5.2
|| # ------------------------------------------------------------------ # ||
|| # Copyright 2000-2019 MH Sub I, LLC dba vBulletin. All Rights Reserved.  # ||
|| # This file may not be redistributed in whole or significant part.   # ||
|| # ----------------- VBULLETIN IS NOT FREE SOFTWARE ----------------- # ||
|| # http://www.vbulletin.com | http://www.vbulletin.com/license.html   # ||
|| ###################################################################### ||
\*========================================================================*/
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-active a"],profcustom_navbar_border_active:[".profileTabs .widget-tabs-nav li.ui-tabs-active a"],profcustom_navbar_text_color_active:[".profileTabs .widget-tabs-nav li.ui-tabs-active a"],profcustom_navbar_background:[".profileTabs .widget-tabs-nav li.ui-state-default:not(.ui-state-active) a"],profcustom_navbar_border:[".profileTabs .widget-tabs-nav li.ui-state-default:not(.ui-state-active) a"],profcustom_navbar_text_color:[".profileTabs .widget-tabs-nav li.ui-state-default:not(.ui-state-active) 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");form.find(".js-upload-progress").removeClass("h-hide");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"){vBulletin.error("profile_style_customizations",B.errors)}else{vBulletin.error("profile_style_customizations",B.errors[0][0])}}else{if(B.imageUrl){setBackgroundImage(A,B.imageUrl)}else{vBulletin.error("profile_style_customizations","unable_to_upload_file")}}}else{vBulletin.error("profile_style_customizations","invalid_server_response_please_try_again")}},fail:function(C){var D="error_uploading_image";var B="error";if(C&&C.files.length>0){switch(C.files[0].error){case"acceptFileTypes":D="invalid_image_allowed_filetypes_are";B="warning";break}}vBulletin.alert("upload",D,B,function(){$editProfilePhotoDlg.find(".fileText").val("");$editProfilePhotoDlg.find(".browse-option").focus()})},complete:function(){form.find(".js-upload-progress").addClass("h-hide")}})}}};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<selectors.length;i++){$(selectors[i]).css("background-repeat",repeat)}}};var clearBgImage=function(A){ident=$(A.target).attr("data");if(typeof (cssMappings[ident])!="undefined"){selectors=cssMappings[ident];addNewSetting(ident,"image","none");for(i=0;i<selectors.length;i++){$(selectors[i]).css("background-image","none")}}};var clearBgColor=function(B){$element=$(B.target);ident=$element.attr("data");checked=$element.is(":checked");if(typeof (cssMappings[ident])!="undefined"){selectors=cssMappings[ident];if(checked){addNewSetting(ident,"color","transparent");val="transparent"}else{val="none";var A=$('input.colorPicker[name="'+ident+'"]').val();if(typeof A=="string"&&A.indexOf("#")===0){val=A}addNewSetting(ident,"color",val)}for(i=0;i<selectors.length;i++){$(selectors[i]).css("background-color",val)}}};var setBackgroundImage=function(C,A,F){var E,B;if(typeof F!=="undefined"){E=F;B=A}else{E=$(C.target).attr("data");var D=A.indexOf("?")==-1?"?":"&";B='url("'+A+D+"random="+Math.random()+'")'}if(typeof (cssMappings[E])!="undefined"){selectors=cssMappings[E];addNewSetting(E,"image",B);for(i=0;i<selectors.length;i++){$(selectors[i]).css("background-image",B)}}};var makeServerRequest=function(C,B,A,E){window.vBulletin.loadingIndicator.show();var D=$.post(vBulletin.getAjaxBaseurl()+C,B,function(F){if(F&&F.error){if($.isArray(F.error)){$.each(F.error,function(H,I){F.error[H]=vBulletin.phrase.get(I)});var G=F.error.join("<br />")}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(){vBulletin.error("profile_style_customizations","error_saving_customizations")}).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 rgb2hex(A){A=A.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);return"#"+hex(A[1])+hex(A[2])+hex(A[3])}function rgba2hex(B){B=B.match(/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d+)\)$/);var A={};if(B[4]==0){A.transparent=true}else{if(B[4]==1){A.transparent=false}else{return false}}A.hex="#"+hex(B[1])+hex(B[2])+hex(B[3]);return A}function hex(A){var B=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");return isNaN(A)?"00":B[(A-A%16)/16]+B[A%16]}function setCurrentBgValues(F){var G=F.attr("data");if(typeof cssMappings[G]!="undefined"){selector=cssMappings[G][0];var C=$(selector),A={},H="";A.color=C.css("background-color");A.image=C.css("background-image");A.repeat=C.css("background-repeat");if((typeof A.image!="undefined")&&(A.image!="none")){var B=A.image.lastIndexOf("/")+1,J=A.image.length,I=J-B-2;H=A.image.substr(B,I);F.find(".fileText").val(H);if(A.repeat!=""){F.find(".ProfCustomBgRepeatType").val(A.repeat)}}else{if(A.color=="transparent"){F.find(".rdProfCustomBgColorClear").prop("checked",true)}else{if(typeof A.color=="string"){var E=A.color;if(E.indexOf("rgba")===0){var D=rgba2hex(E);if(D){E=D.hex;F.find(".rdProfCustomBgColorClear").prop("checked",D.transparent)}}else{if(E.indexOf("rgb")===0){E=rgb2hex(E)}}F.find('input[name="'+G+'"].colorPicker').val(E)}}}if(H!=""){F.find(".rdProfCustomBgTypeImage").trigger("click")}else{F.find(".rdProfCustomBgTypeColor").trigger("click")}}}(function(A){var B=[".profileEditContent"];if(!vBulletin.pageHasSelectors(B)){return false}A(document).ready(function(){var C=0;A(".profile_custom_edit .profileTabs").tabs({activate:function(E,D){A().add(D.oldTab).add(D.newTab).find(".b-icon").toggleClass("b-icon--active")},});A(".profCustomBackgroundEdit").each(function(E){C++;content=A(".profCustomBgTemplate").clone();var D=A(this);A(content).removeClass("h-hide profCustomBgTemplate");A(content).css("display","block");D.append(content);D.find(".colorPicker").attr("data",D.attr("data"));D.find(".colorPicker").attr("name",D.attr("data"));D.find(".colorPicker").removeClass("template");D.find(".rdProfCustomBgTypeColor, .rdProfCustomBgTypeImage").off("click").on("click",toggleBgType);D.find(".rdProfCustomBgTypeColor, .rdProfCustomBgTypeImage").prop("name","profCustomBgType"+C);D.find(".rdProfCustomFile, .rdProfCustomUrl, .rdProfCustomBgImageNone").off("click").on("click",toggleImgSource);D.find(".rdProfCustomFile, .rdProfCustomUrl, .rdProfCustomBgImageNone").attr("name","profCustomBgSrc"+C);D.find(".profCustomBgImageFile, .profCustomBgImageUrl, .rdProfCustomBgColorClear, .rdProfCustomBgImageNone, .ProfCustomBgRepeatType, .profCustomUploadUrl").attr("data",A(this).attr("data"));setCurrentBgValues(D);A(this).find(".profCustomBgImageFile").fileupload({url:vBulletin.getAjaxBaseurl()+"/uploader/upload-file",type:"POST",dataType:"json",add:function(G,F){D.find(".js-upload-progress").removeClass("h-hide");F.submit()},done:function(G,F){if(F){if(F.result.errors){if(typeof (F.result.errors[0])=="undefined"){vBulletin.error("profile_style_customizations",F.result.errors)}else{vBulletin.error("profile_style_customizations",F.result.errors[0][0])}}else{if(F.result.imageUrl){D.find(".profile-img-option-container .profile-img-option-field input.fileText").val(F.result.filename);setBackgroundImage(G,F.result.imageUrl)}else{vBulletin.error("profile_style_customizations","unable_to_upload_file")}}}else{vBulletin.error("profile_style_customizations","invalid_server_response_please_try_again")}},fail:function(I,G){var H="error_uploading_image";var F="error";if(G&&G.files.length>0){switch(G.files[0].error){case"acceptFileTypes":H="invalid_image_allowed_filetypes_are";F="warning";break}}vBulletin.alert("upload",H,F,function(){$editProfilePhotoDlg.find(".fileText").val("");$editProfilePhotoDlg.find(".browse-option").focus()})},always:function(){D.find(".js-upload-progress").addClass("h-hide")}})});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)){vBulletin.error("profile_customization","there_are_no_changes_to_save");return }var D=newSettings;newSettings={};makeServerRequest("/profile/save-stylevar",{stylevars:D,userid:pageData.userid},vBulletin.phrase.get("saving")+"...",function(E){vBulletin.alert("profile_customization","usercss_saved")})});A(".profCustomRevert").off("click").on("click",function(){var D=[],E=0;if(A.isEmptyObject(newSettings)){vBulletin.error("profile_customization","there_are_no_changes_to_revert");return }A.each(newSettings,function(F,G){D[E]=F;E++});makeServerRequest("/profile/revert-stylevars",{stylevars:D,userid:pageData.userid},"Reverting...",function(F){revertChanges(F)});newSettings={}});A(".profCustomDefault").off("click").on("click",function(){var D=[],E=0;if(!A.isEmptyObject(newSettings)){A.each(newSettings,function(F,G){D[E]=F;E++})}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:D,userid:pageData.userid},vBulletin.phrase.get("reverting")+"...",function(F){window.location.reload()});newSettings={}}})});A(".profCustomApplyAll").off("click").on("click",function(){makeServerRequest("/profile/save-default",{stylevars:newSettings,userid:pageData.userid},"Saving...",function(D){vBulletin.alert("profile_customization","style_applied_as_site_default")})});A(".profCustomCancel").off("click").on("click",function(){A(".profile_custom_edit").addClass("h-hide")})})})(jQuery);;

