/*=======================================================================*\ || ###################################################################### || || # vBulletin 5.1.9 || # ------------------------------------------------------------------ # || || # Copyright 2000-2015 vBulletin Solutions Inc. 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,["cancel","changed_extra_css_warning","error_loading_css","error_setting_theme","loading_themes","no_preview_available","revert","revert_extra_css_warning","save_and_continue","success","there_are_no_themes_installed","confirm_action"]);window.vBulletin.options=window.vBulletin.options||{};window.vBulletin.options.precache=window.vBulletin.options.precache||[];window.vBulletin.options.precache=$.merge(window.vBulletin.options.precache,["styleid"]);(function(L){var J=false,K,U,S=0,Y=function(h){var g=this;vBulletin.assertUserHasAdminPermission("canusesitebuilder",g,function(){E.call(g)});return false},E=function(g,l){var k=L(this),j=L(document.body),i=!k.hasClass("selected"),h=true;if(typeof g!="undefined"){i=!!g}if(typeof l!="undefined"){h=!!l}b(!i,k);if(i){F();D();L(".js-style-panel").css("display","none").removeClass("h-hide").slideDown("400",A)}else{L(".js-style-panel").slideUp("fast",function(){if(!h){return }var m=window.location.href;if(m.indexOf("adminAction=stylePanel&")!=-1){m=m.replace("adminAction=stylePanel&","")}else{m=m.replace("?adminAction=stylePanel","")}if(m!=window.location.href){window.location.href=m}else{window.location.reload(true)}})}},B=function(g){E(false,g)},b=function(g,i){var h=function(j){this.blur();j.stopPropagation();return false};if(g){L("#main-navbar .main-nav a, #main-navbar .secondary-nav .sb-menu a").removeClass("selected").closest("li").removeClass("h-disabled");L("#main-navbar .secondary-nav li").removeClass("h-disabled");i.removeClass("selected").closest("li").removeClass("h-disabled");L(document).off("focus click mousedown","#main-navbar .h-disabled a",h)}else{L("#main-navbar .main-nav a, #main-navbar .secondary-nav .sb-menu a").removeClass("selected").closest("li").addClass("h-disabled");L("#main-navbar .secondary-nav li").addClass("h-disabled");i.addClass("selected").closest("li").removeClass("h-disabled");L(document).on("focus click mousedown","#main-navbar .h-disabled a",h)}},D=function(){},a=function(h,i){var g=L(".js-theme-selector__list:visible .js-theme-selector__theme-radio:checked").val();vBulletin.AJAX({url:vBulletin.getAjaxBaseurl()+"/ajax/api/style/setDefaultStyle",data:{styleid:g},error_phrase:"error_setting_theme",success:function(){var j=new Date();j.setDate(j.getDate()+365);L.cookie(pageData.cookie_prefix+"userstyleid",g,{path:pageData.cookie_path,domain:pageData.cookie_domain,expires:j});if(typeof i=="undefined"||i){B(true)}}});return false},T=function(g){B(false);return false},e=function(g){c(K.getValue(),null,S)},I=function(g){openConfirmDialog({title:vBulletin.phrase.get("revert"),message:vBulletin.phrase.get("revert_extra_css_warning"),iconType:"warning",onClickYes:function(h){U="";K.setValue("");c("",V,S)}});return false},P=function(g){B(true);return false},N=function(g){K.setValue(U)},C=function(k,g,l){if(!g&&k&&k.target){var g=L(k.target).closest(".js-theme-selector__theme").data("preview-url")}if(!l){var l=L(k.target).closest(".js-theme-selector__list")}var j=l.closest(".js-panel").find(".js-theme-selector__theme-preview"),i,h=j.find("> img, > p");if(j.length!=1){return }if(g){i=L("").prop("src",g)}else{i=L("
").addClass("b-theme-selector__theme-preview-message").text(vBulletin.phrase.get("no_preview_available"))}if(h.is("p")&&i.is("p")){h.fadeTo(200,"0.5",function(){L(this).fadeTo(400,1)})}else{h.css("zIndex","2");i.css("zIndex","1").hide();j.append(i);h.fadeOut({duration:300,queue:false,complete:function(){L(this).remove()}});i.fadeIn({duration:600,queue:false})}},d=function(){var g=L(this);g.closest(".js-theme-selector__list").find(".js-theme-selector__theme").removeClass("b-theme-selector__theme--selected js-theme-selector__theme--selected");g.closest(".js-theme-selector__theme").addClass("b-theme-selector__theme--selected js-theme-selector__theme--selected")},Z=function(q,l,h){var k=this,j="js-theme-selector__theme b-theme-selector__theme h-margin-right-xl",m=L('').addClass("js-theme-selector__theme-radio b-theme-selector__theme-radio h-margin-none h-margin-right-s"),o=L("").prop("title",k.title),n=L("").addClass("h-margin-s h-margin-bottom-none b-theme-selector__theme-title").text(k.title.length>30?k.title.substr(0,20)+" ...":k.title),g=L("").addClass("h-margin-s h-margin-bottom-m").prop("src",k.iconurl),i=L("").addClass("b-theme-selector__theme-thumbnail");var p=function(r){var s=new Image();s.src=r};p(k.iconurl);p(k.previewurl);if(l==k.styleid){m.prop("checked","checked");m.attr("checked","checked");C({},k.previewurl,q);j+=" js-theme-selector__theme--selected b-theme-selector__theme--selected"}i.append(g);n.prepend(m);o.append(i).append(n);L("").addClass(j).data("preview-url",(k.previewurl||"")).append(o).appendTo(q);f.call(g.get(0),2)},f=function(q){var k=L(this);k.css({maxWidth:"none",maxHeight:"none"});var j=k.outerWidth()||0,r=k.outerHeight()||0,g=j>r?"height":"width",s,m,h,n=false;if(j>0&&r>0){var p=false;if(g=="width"&&j>100){s=100/j;m=j*s;h=r*s;p=true}else{if(g=="height"&&r>100){s=100/r;m=j*s;h=r*s;p=true}else{}}if(p){k.removeClass("h-margin-s h-margin-bottom-m").css({maxWidth:m,maxHeight:h});var l=k.parent();var o=L("").addClass("b-theme-selector__image-resize-wrapper h-margin-s h-margin-bottom-m").css({width:100,height:100,overflow:"hidden"});o.append(k);l.append(o);n=true}}else{}if(!n){k.css({maxWidth:"100px",maxHeight:"100px"});if(q>0){var i=this;window.setTimeout(function(){f.call(i,--q)},100)}else{var i=this;k.off("load").on("load",function(){f.call(i,--q)})}}},H=function(h,l){var j,k=0,g=vBulletin.options.get("styleid");l.html("");if(h&&h.themes){L.each(h.themes,function(){Z.apply(this,[l,g,k]);++k})}if(!k){L("").addClass("b-theme-selector__message").text(vBulletin.phrase.get("there_are_no_themes_installed")).appendTo(l)}else{Q(l,k)}},Q=function(g,j){var h=g.find(".js-theme-selector__theme").first().outerWidth(true),i=h*j;g.width(i);g.closest(".js-theme-selector__container").tinyscrollbar({sizethumb:14,axis:"x"});G(g)},G=function(l){var h=l.find(".js-theme-selector__theme--selected");if(h.length==1){var n=l.find(".js-theme-selector__theme"),o=n.first().outerWidth(true),g=n.length,m=parseInt(h.position().left,10),q=o*g,k=l.position().left,t=Math.round(k)*-1,r=l.closest(".js-theme-selector__container"),p=r.innerWidth(),j=p+t-o,i=0;if(m