Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Jump Start 2.0-beta2 patch for slider option type
(function(b){var a={init:function(){var c=this;c.off("click.tb-widget");c.on("click.tb-widget",".widget-name-arrow, .block-widget-name-arrow",function(){var f=b(this),e="widget",d=false;if(f.hasClass("block-widget-name-arrow")){e="block-widget"}if(f.closest("."+e+"-name").hasClass(e+"-name-closed")){d=true}if(d){f.closest("."+e).find("."+e+"-content").show();f.closest("."+e).find("."+e+"-name").removeClass(e+"-name-closed");f.closest("."+e).find(".section-code").each(function(){var g=b(this).find("textarea").data("CodeMirrorInstance");if(g){g.refresh()}})}else{f.closest("."+e).find("."+e+"-content").hide();f.closest("."+e).find("."+e+"-name").addClass(e+"-name-closed")}return false});c.on("click",".tooltip-link",function(){var d=b(this).attr("title");tbc_confirm(d,{textOk:"Ok"});return false});c.on("click",".delete-me",function(){var d=b(this).attr("href");tbc_confirm(b(this).attr("title"),{confirm:true},function(e){if(e){b(d).remove()}});return false});c.find(".tb-fancy-select").each(function(){var d=b(this),e=d.find("select").val(),f=d.find('option[value="'+e+'"]').text();d.find(".textbox").text(f)})},options:function(c){return this.each(function(){var d=b(this);if(c=="setup"){d.find(".tb-fancy-select").each(function(){var f=b(this),g=f.find("select").val(),h=f.find('option[value="'+g+'"]').text();f.find(".textbox").text(h)});d.find(".custom-content-types").each(function(){var g=b(this),h=g.find("select").val(),f=g.closest(".subgroup");if(h=="external"){f.find(".page-content").show()}else{if(h=="raw"){f.find(".raw-content").show()}else{if(h=="widget_area"){f.find(".widget_area-content").show()}}}});d.find(".tabs").each(function(){var h=b(this),g=1,f=h.find(".tabs-num").val();h.find(".tab-names .tab-name").hide();h.find(".section-content").hide();while(g<=f){h.find(".tab-names .tab-name-"+g).show();h.find("#section-tab_"+g).show();g++}});d.find(".section-content").each(function(){var g=b(this),f=g.find(".column-content-types select.select-type").val();g.find(".column-content-type").hide();g.find(".column-content-type-"+f).show()});d.find(".columns").each(function(){var h=b(this),g,f=h.find(".select-col-num").val();if(f>1){h.find(".select-wrap-grid").show();h.find(".section-column_widths").show();h.closest(".widget-content").find(".column-height").show()}else{h.find(".select-wrap-grid").hide();h.find(".section-column_widths").hide();h.closest(".widget-content").find(".column-height").hide()}h.find(".section-content").hide();for(g=1;g<=f;g++){h.find(".col_"+g).show()}});d.find(".show-hide").each(function(){var f=b(this),g=f.children(".trigger").find("input");if(g.is(":checked")){f.children(".receiver").show()}else{f.find(".receiver").each(function(){b(this).find("input, textarea, select").prop("disabled",true)})}});d.find(".hide-show").each(function(){var f=b(this),g=f.children(".trigger").find("input");if(g.is(":checked")){f.children(".receiver").hide()}else{f.find(".receiver").each(function(){b(this).find("input, textarea, select").prop("disabled",true)})}});d.find(".show-hide-toggle").each(function(){var g=b(this),f=g.children(".trigger"),h="";if(f.hasClass("section-radio")){h=f.find(".of-radio:checked").val()}else{h=f.find(".of-input").val()}g.children(".receiver").each(function(){b(this).hide().find("input, textarea, select").prop("disabled",true)});g.children(".receiver-"+h).each(function(){b(this).show().find("input, textarea, select").prop("disabled",false)})});d.find(".desc-toggle").each(function(){var f=b(this),g=f.children(".trigger").find(".of-input").val();f.find(".desc-receiver .explain").hide();f.find(".desc-receiver .explain."+g).show()});d.find(".section-logo").each(function(){var f=b(this),g=f.find(".select-type select").val();f.find(".logo-item").hide();f.find("."+g).show()});d.find(".section-typography .of-typography-face").each(function(){var f=b(this),g=f.val();if(g=="google"){f.closest(".section-typography").find(".google-font").fadeIn("fast")}else{f.closest(".section-typography").find(".google-font").hide()}});d.find("#section-homepage_content").each(function(){var f=b(this).find("input:checked").val();if(f!="custom_layout"){d.find("#section-homepage_custom_layout").hide()}});d.find(".of-radio-img-img").click(function(){b(this).parent().parent().find(".of-radio-img-img").removeClass("of-radio-img-selected");b(this).addClass("of-radio-img-selected")});d.find(".of-radio-img-label").hide();d.find(".of-radio-img-img").show();d.find(".of-radio-img-radio").hide();d.find(".match-trigger .of-input").each(function(){var f=b(this);f.closest(".subgroup").find(".match .of-input").val(f.val())});d.find(".select-parallax").each(function(){var f=b(this),g=f.find(".of-background-attachment").val();if(g=="parallax"){f.find(".of-background-position").closest(".tb-fancy-select").hide();f.find(".of-background-size").closest(".tb-fancy-select").hide();f.find(".parallax").show()}else{f.find(".of-background-position").closest(".tb-fancy-select").show();f.find(".of-background-size").closest(".tb-fancy-select").show();f.find(".parallax").hide()}});if(b.isFunction(b.fn.slider)){d.find(".jquery-ui-slider").each(function(){var g=b(this),h=g.closest(".jquery-ui-slider-wrap").find(".slider-input"),f=g.data("units");g.slider({min:g.data("min"),max:g.data("max"),step:g.data("step"),value:parseInt(h.val()),create:function(j,k){g.find(".ui-slider-handle").append('<span class="display-value"><span class="display-value-text"></span><span class="display-value-arrow"></span></span>');var i=g.find(".display-value");i.css("margin-left","-"+(i.outerWidth()/2)+"px");i.find(".display-value-text").text(h.val())},slide:function(i,j){h.val(j.value+f);g.find(".display-value-text").text(j.value+f)}})})}if(b.isFunction(b.fn.wpColorPicker)){d.find(".tb-color-picker").wpColorPicker()}if(b.isFunction(b.fn.wpColorPicker)){d.find(".section-button").each(function(){var f=b(this);f.find(".color-picker").wpColorPicker();f.find(".color.bg .wp-color-result").attr("title","Background Color");f.find(".color.bg_hover .wp-color-result").attr("title","Background Hover Color");f.find(".color.border .wp-color-result").attr("title","Border Color");f.find(".color.text .wp-color-result").attr("title","Text Color");f.find(".color.text_hover .wp-color-result").attr("title","Text Hover Color");if(f.find(".include.bg input").is(":checked")){f.find(".color.bg").show()}if(f.find(".include.border input").is(":checked")){f.find(".color.border").show()}})}if(!b("body").hasClass("mobile")){d.find(".tb-tooltip-link").click(function(){b(".themeblvd-tooltip").remove();var g=b(this),f=g.data("tooltip-toggle");if(f==2){g.data("tooltip-toggle",1)}else{g.data("tooltip-toggle",2)}})}if(b.isFunction(b.fn.ThemeBlvdModal)){d.find(".tb-input-icon-link").ThemeBlvdModal({build:false,padding:true,size:"custom",on_display:function(){var h=this,g=h.$elem,f=h.$modal_window,i=g.closest(".input-wrap").find("input").val();f.find(".media-frame-content").scrollTop(0);f.find(".select-icon").removeClass("selected");f.find(".media-toolbar-secondary").find(".fa, span, img").remove();if(f.find('[data-icon="'+i+'"]').length>0){f.find('[data-icon="'+i+'"]').addClass("selected");f.find(".icon-selection").val(i);f.find(".media-toolbar-secondary").append('<i class="fa fa-'+i+' fa-2x fa-fw"></i><span>'+i+"</span>")}},on_save:function(){var f=this,g=f.$modal_window.find(".icon-selection").val();f.$elem.closest(".input-wrap").find("input").val(g)}})}if(b.isFunction(b.fn.ThemeBlvdModal)){d.find(".tb-input-post-id-link").ThemeBlvdModal({build:false,padding:true,button:"",size:"custom",on_display:function(){var h=this,g=h.$elem,f=h.$modal_window;f.find("#search-submit").off("click.tb-search-posts");f.find("#search-submit").on("click.tb-search-posts",function(){var j=b(this).closest(".post-browser-head"),i={action:"themeblvd_post_browser",data:j.find("#post-search-input").val()};j.find(".tb-loader").fadeIn(200);b.post(ajaxurl,i,function(k){f.find(".ajax-mitt").html("").append(k);j.find(".tb-loader").fadeOut(200)});return false});f.off("click.tb-select-post",".select-post");f.on("click.tb-select-post",".select-post",function(){f.find("#post-search-input").val("");f.find(".ajax-mitt").html("");g.closest(".input-wrap").find(".of-input").val(b(this).data("post-id"));h.close();return false})},on_cancel:function(){$browser=this.$modal_window;$browser.find("#post-search-input").val("");$browser.find(".ajax-mitt").html("")}})}if(b.isFunction(b.fn.ThemeBlvdModal)){d.find(".tb-texture-browser-link").ThemeBlvdModal({build:false,padding:true,size:"custom",on_display:function(){var h=this,g=h.$elem,f=h.$modal_window,i=g.closest(".controls").find(".of-input").val();f.find(".media-frame-content").scrollTop(0);f.find(".select-texture").each(function(){$a=b(this);$a.removeClass("selected");if($a.data("texture")==i){$a.addClass("selected");f.find(".texture-selection").val($a.data("texture"));f.find(".current-texture").text($a.data("texture-name"))}})},on_save:function(){var f=this,g=f.$elem.closest(".controls").find(".of-input"),h=f.$modal_window.find(".texture-selection").val();g.val(h);g.closest(".tb-fancy-select").find(".textbox").text(g.find('option[value="'+h+'"]').text())}})}if(d.find("#tb-footer-sync").is(":checked")){d.find(".standard-footer-setup").hide();d.find(".footer-template-setup").show()}else{d.find(".standard-footer-setup").show();d.find(".footer-template-setup").hide()}d.find("#tb-footer-sync").on("click",function(){if(b(this).is(":checked")){d.find(".standard-footer-setup").hide();d.find(".footer-template-setup").show()}else{d.find(".standard-footer-setup").show();d.find(".footer-template-setup").hide()}})}else{if(c=="bind"){d.on("change",".tb-fancy-select select",function(){var f=b(this),g=f.val(),h=f.find('option[value="'+g+'"]').text();f.closest(".tb-fancy-select").find(".textbox").text(h)});d.on("change",".custom-content-types select",function(){var g=b(this),h=g.val(),f=g.closest(".subgroup");if(h=="current"){f.find(".page-content").fadeOut("fast");f.find(".raw-content").fadeOut("fast");f.find(".widget_area-content").fadeOut("fast")}else{if(h=="external"){f.find(".page-content").fadeIn("fast");f.find(".raw-content").hide();f.find(".widget_area-content").hide()}else{if(h=="raw"){f.find(".raw-content").fadeIn("fast");f.find(".page-content").hide();f.find(".widget_area-content").hide()}else{if(h=="widget_area"){f.find(".widget_area-content").fadeIn("fast");f.find(".raw-content").hide();f.find(".page-content").hide()}}}}});d.on("change",".tabs .tabs-num",function(){var j=b(this),g=1,f=j.val(),h=j.closest(".tabs");h.find(".tab-names .tab-name").hide();h.find(".section-content").hide();while(g<=f){h.find(".tab-names .tab-name-"+g).show();h.find("#section-tab_"+g).show();g++}});d.on("change",".column-content-types select.select-type",function(){var g=b(this).closest(".section-content"),f=b(this).val();g.find(".column-content-type").hide();g.find(".column-content-type-"+f).show()});d.on("change",".select-col-num",function(){var h=b(this),g,f=h.val(),j=h.closest(".columns");if(f>1){j.find(".select-wrap-grid").show();j.find(".section-column_widths").show();j.closest(".widget-content").find(".column-height").show()}else{j.find(".select-wrap-grid").hide();j.find(".section-column_widths").hide();j.closest(".widget-content").find(".column-height").hide()}j.find(".section-content").hide();for(g=1;g<=f;g++){j.find(".col_"+g).show()}});d.on("click",".show-hide > .trigger input",function(){var f=b(this);if(f.is(":checked")){f.closest(".show-hide").find(".receiver").each(function(){b(this).find("input, textarea, select").prop("disabled",false)});f.closest(".show-hide").children(".receiver").fadeIn("fast")}else{f.closest(".show-hide").find(".receiver").each(function(){b(this).find("input, textarea, select").prop("disabled",true)});f.closest(".show-hide").children(".receiver").hide()}});d.on("click",".hide-show > .trigger input",function(){var f=b(this);if(f.is(":checked")){f.closest(".hide-show").find(".receiver").each(function(){b(this).find("input, textarea, select").prop("disabled",true)});f.closest(".hide-show").children(".receiver").hide()}else{f.closest(".hide-show").find(".receiver").each(function(){b(this).find("input, textarea, select").prop("disabled",false)});f.closest(".hide-show").children(".receiver").fadeIn("fast")}});d.on("change",".show-hide-toggle > .trigger select.of-input",function(){var f=b(this),h=f.val(),g=f.closest(".show-hide-toggle");g.children(".receiver").each(function(){b(this).hide().find("input, textarea, select").prop("disabled",true)});g.children(".receiver-"+h).each(function(){b(this).show().find("input, textarea, select").prop("disabled",false)})});d.on("click",".show-hide-toggle > .trigger .of-radio",function(){var f=b(this),h=f.val(),g=f.closest(".show-hide-toggle");g.children(".receiver").each(function(){b(this).hide().find("input, textarea, select").prop("disabled",true)});g.children(".receiver-"+h).each(function(){b(this).show().find("input, textarea, select").prop("disabled",false)})});d.on("change",".desc-toggle > .trigger .of-input",function(){var f=b(this),h=f.val(),g=f.closest(".desc-toggle");g.find(".desc-receiver .explain").hide();g.find(".desc-receiver .explain."+h).show()});d.on("change",".section-logo .select-type select",function(){var g=b(this),f=g.closest(".section-logo"),h=g.val();f.find(".logo-item").hide();f.find("."+h).show()});d.on("change",".section-typography .of-typography-face",function(){var f=b(this),g=f.val();if(g=="google"){f.closest(".section-typography").find(".google-font").fadeIn("fast")}else{f.closest(".section-typography").find(".google-font").hide()}});d.on("change","#section-homepage_content input:checked",function(){if(b(this).val()=="custom_layout"){d.find("#section-homepage_custom_layout").fadeIn("fast")}else{d.find("#section-homepage_custom_layout").fadeOut("fast")}});d.on("change",".match-trigger .of-input",function(){var f=b(this);f.closest(".subgroup").find(".match .of-input").val(f.val())});d.on("click",".select-categories input",function(){var f=b(this),g=f.closest(".controls");if(f.prop("checked")){if(f.hasClass("all")){g.find("input").each(function(){if(!b(this).hasClass("all")){b(this).prop("checked",false)}})}else{g.find("input.all").prop("checked",false)}}});d.on("change",".select-parallax .of-background-attachment",function(){var f=b(this).closest(".select-parallax");if(b(this).val()=="parallax"){f.find(".of-background-position").closest(".tb-fancy-select").hide();f.find(".of-background-size").closest(".tb-fancy-select").hide();f.find(".parallax").show()}else{f.find(".of-background-position").closest(".tb-fancy-select").show();f.find(".of-background-size").closest(".tb-fancy-select").show();f.find(".parallax").hide()}});if(b.isFunction(b.fn.ThemeBlvdModal)){d.find(".tb-modal-link").ThemeBlvdModal()}if(!b("body").hasClass("mobile")){d.on("mouseenter",".tb-tooltip-link",function(){var j=b(this);var h=j.data("tooltip-position"),k=j.offset().left,i=j.offset().top,l=j.data("tooltip-text"),m='<div class="themeblvd-tooltip %position%"> <div class="tooltip-inner"> %text% </div> <div class="tooltip-arrow"></div> </div>';if(!l&&j.data("tooltip-toggle")){l=j.data("tooltip-text-"+j.data("tooltip-toggle"))}if(!l){l=j.attr("title")}if(!h){h="top"}m=m.replace("%position%",h);m=m.replace("%text%",l);b("body").append(m);var n=b(".themeblvd-tooltip"),f=n.outerHeight(),g=n.outerWidth();switch(h){case"left":k=k-g-5;i=i+(0.5*j.outerHeight());i=i-f/2;break;case"right":k=k+j.outerWidth()+5;i=i+(0.5*j.outerHeight());i=i-f/2;break;case"bottom":k=k+(0.5*j.outerWidth());k=k-g/2;i=i+j.outerHeight()+2;break;case"top":default:k=k+(0.5*j.outerWidth());k=k-g/2;i=i-f-2}n.css({top:i+"px",left:k+"px"}).addClass("fade in")});d.on("mouseleave",".tb-tooltip-link",function(){b(".themeblvd-tooltip").remove()})}d.on("click",".section-button .include input",function(){var f=b(this),g="bg";if(f.closest(".include").hasClass("border")){g="border"}if(f.is(":checked")){f.closest(".section-button").find(".color."+g).show()}else{f.closest(".section-button").find(".color."+g).hide()}});if(typeof google==="object"&&typeof google.maps==="object"){d.on("click",".section-geo .geo-insert-lat-long",function(){var h=b(this),f=h.closest(".geo-generate").find(".overlay"),j=new google.maps.Geocoder(),g=h.prev(".address").val(),k="0",i="0";f.fadeIn(100);j.geocode({address:g},function(m,l){if(l==google.maps.GeocoderStatus.OK){k=m[0].geometry.location.lat();i=m[0].geometry.location.lng()}setTimeout(function(){h.closest(".controls").find(".geo-lat .geo-input").val(k);h.closest(".controls").find(".geo-long .geo-input").val(i);if(l!=google.maps.GeocoderStatus.OK){tbc_confirm(h.data("oops"),{textOk:"Ok"})}else{h.prev(".address").val("")}f.fadeOut(100)},1500)});return false})}}else{if(c=="media-uploader"){if(typeof wp!=="undefined"&&typeof wp.media!=="undefined"){themeblvd_media_uploader.init(d)}}else{if(c=="editor"){if(b.isFunction(b.fn.ThemeBlvdModal)){d.find(".tb-textarea-editor-link").ThemeBlvdModal({build:false,padding:true,height:"auto",on_load:function(){wpActiveEditor="themeblvd_editor";var h=this,i,m="themeblvd_editor",g,k,j="",l=typeof tinymce!=="undefined",f=h.$modal_window;if(h.$elem.is(".tb-block-editor-link")){k=h.$elem.closest(".block").data("field-name");g=h.$elem.closest(".block").find('textarea[name="'+k+'[content]"]')}else{g=h.$elem.closest(".textarea-wrap").find("textarea")}j=g.val();f.find(".wp-editor-area, iframe").height(300);if(f.find(".wp-editor-wrap").is(".tmce-active")){if(l){i=tinymce.get(m)}if(i){j=window.switchEditors.wpautop(j);i.setContent(j,{format:"raw"})}}else{f.find("textarea").val(j)}g.css("overflow","hidden")},on_save:function(){wpActiveEditor="content";var h=this,i,m="themeblvd_editor",k,j,g,l=typeof tinymce!=="undefined",f=h.$modal_window;if(h.$elem.is(".tb-block-editor-link")){j=h.$elem.closest(".block").data("field-name");g=h.$elem.closest(".block").find('textarea[name="'+j+'[content]"]')}else{g=h.$elem.closest(".textarea-wrap").find("textarea")}if(f.find(".wp-editor-wrap").is(".tmce-active")){if(l){i=tinymce.get(m)}if(i){k=i.getContent();k=window.switchEditors.pre_wpautop(k)}}else{k=f.find(".wp-editor-area").val()}g.val(k);g.css("overflow","visible")},on_cancel:function(){wpActiveEditor="content";this.$elem.closest(".textarea-wrap").find("textarea").css("overflow","visible")}})}}else{if(c=="code-editor"&&typeof CodeMirror!=="undefined"){if(b.isFunction(b.fn.ThemeBlvdModal)){d.find(".tb-textarea-code-link").ThemeBlvdModal({code_editor:true,size:"medium",height:"auto"})}d.find(".section-code").each(function(){var h=b(this),f=h.find("textarea"),j=f.data("code-lang"),i,g;g=f.data("CodeMirrorInstance");if(!g){if(j=="html"){i={name:"htmlmixed",scriptTypes:[{matches:/\/x-handlebars-template|\/x-mustache/i,mode:null},{matches:/(text|application)\/(x-)?vb(a|script)/i,mode:"vbscript"}]}}else{i=j}g=CodeMirror.fromTextArea(document.getElementById(f.attr("id")),{mode:i,lineNumbers:true,theme:"themeblvd",indentUnit:4,tabSize:4,indentWithTabs:true});g.on("blur",function(){f.val(g.getValue())});f.data("CodeMirrorInstance",g)}})}else{if(c=="column-widths"){themeblvd_column_widths.init(d)}else{if(c=="sortable"){var e=function(f){f.find(".delete-sortable-item").off("click");f.find(".delete-sortable-item").on("click",function(){var i=b(this),j=i.closest(".section-sortable"),h=i.closest(".item"),g=i.closest(".tb-sortable-option").data("max");tbc_confirm(i.attr("title"),{confirm:true},function(k){if(k){h.addClass("delete");window.setTimeout(function(){h.remove();if(!j.find(".item-container .item").length){j.find(".delete-sortable-items").fadeOut(200)}if(g>0&&j.find(".item-container > .item").length<g){j.find(".add-item").prop("disabled",false)}},500)}});return false});f.find(".toggle").off("click");f.find(".toggle").on("click",function(){var g=b(this);if(g.closest(".item-handle").hasClass("closed")){g.closest(".item-handle").removeClass("closed");g.closest(".item").find(".item-content").show()}else{g.closest(".item-handle").addClass("closed");g.closest(".item").find(".item-content").hide()}return false});f.find(".item-handle h3").each(function(){var h=b(this),g=h.closest(".item").find(".handle-trigger");if(g.is("select")){h.closest(".item").find(".item-handle h3").text(g.find('option[value="'+g.val()+'"]').text())}else{h.closest(".item").find(".item-handle h3").text(g.val())}});f.find(".handle-trigger").off("change");f.find(".handle-trigger").on("change",function(){var g=b(this);if(g.is("select")){g.closest(".item").find(".item-handle h3").text(g.find('option[value="'+g.val()+'"]').text())}else{g.closest(".item").find(".item-handle h3").text(g.val())}})};d.find(".tb-sortable-option").each(function(){var h=b(this),g=h.closest(".section-sortable"),f=h.data("max");g.find(".item").each(function(){e(b(this))});if(h.find(".item-container .item").length){h.find(".delete-sortable-items").show()}g.find(".item-container").sortable({handle:".item-handle"});g.find(".add-item").off("click");g.find(".add-item").on("click",function(){var k,j=b(this);var i={action:"themeblvd_add_"+h.data("type")+"_item",security:h.data("security"),data:{option_name:h.data("name"),option_id:h.data("id")}};b.post(ajaxurl,i,function(l){g.find(".item-container").append(l);k=g.find(".item").last();k.addClass("add");window.setTimeout(function(){k.removeClass("add")},500);g.find(".delete-sortable-items").fadeIn(200);e(k);k.themeblvd("options","setup");k.themeblvd("options","editor");k.themeblvd("options","code-editor");k.themeblvd("options","media-uploader");if(f>0&&h.find(".item-container > .item").length>=f){j.prop("disabled",true)}});return false});g.find(".delete-sortable-items").off("click");g.find(".delete-sortable-items").on("click",function(){var i=b(this),j=i.closest(".tb-sortable-option"),k=j.find(".item");tbc_confirm(i.attr("title"),{confirm:true},function(l){if(l){k.addClass("delete");window.setTimeout(function(){k.remove();j.find(".delete-sortable-items").fadeOut(200);j.find(".add-item").prop("disabled",false)},500)}});return false})})}}}}}}}})},widgets:function(){return this.each(function(){var c=b(this);c.find(".widget-content").hide();c.find(".widget-name").addClass("widget-name-closed");c.find(".block-content").hide();c.find(".block-handle").addClass("block-handle-closed")})},accordion:function(){return this.each(function(){var c=b(this);c.find(".element-content").hide();c.find(".element-content:first").show();c.find(".element-trigger:first").addClass("active");c.find(".element-trigger").click(function(){var d=b(this);if(!d.hasClass("active")){c.find(".element-content").hide();c.find(".element-trigger").removeClass("active");d.addClass("active");d.next(".element-content").show()}return false})})}};b.fn.themeblvd=function(c){if(a[c]){return a[c].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof c==="object"||!c){return a.init.apply(this,arguments)}else{b.error("Method "+c+" does not exist.")}}}})(jQuery);(function(a){themeblvd_media_uploader={media_frame:[],init:function(b){var c=this;b.find(".upload-button").off("click");b.find(".remove-image, .remove-file").off("click");b.find(".add-images").off("click");b.find(".upload-button").on("click",function(d){d.preventDefault();c.add_file(a(this).closest(".section-upload, .section-media"))});b.find(".remove-image, .remove-file").on("click",function(d){d.preventDefault();c.remove_file(a(this).closest(".section-upload, .section-media"))});b.find(".add-images").on("click",function(d){d.preventDefault();c.add_images(a(this),a(this).closest(".section-sortable"))})},add_file:function(f){var n=this,e=f.find("input.upload").attr("id");if(n.media_frame[e]){n.media_frame[e].open();return}var c,m=f.find(".trigger").data("type"),j=f.find(".trigger").data("title"),k=f.find(".trigger").data("select"),l=f.find(".trigger").data("class"),d=f.find(".trigger").data("send-back"),i=f.find(".trigger").data("link"),g="image",h="select",o=false,b="library";if(m=="video"){g="video"}if(m=="media"){g="";o=true}if(m=="advanced"){b="themeblvd_advanced"}c=n.media_frame[e]=wp.media.frames.file_frame=wp.media({frame:h,state:b,className:"media-frame "+l,title:j,library:{type:g},button:{text:k},multiple:o});if(m=="advanced"){c.states.add([new wp.media.controller.Library({id:"themeblvd_advanced",title:j,priority:20,toolbar:"select",filterable:"uploaded",library:wp.media.query(c.options.library),multiple:false,editable:true,displayUserSettings:false,displaySettings:true,allowLocalEdits:true})])}c.on("select",function(){var s=c.state().get("selection").first(),q=f.find(".trigger").data("remove"),r,v,u,p,t;if(m=="advanced"){r=c.$el.find('.attachment-display-settings select[name="size"]').val();v=s.attributes.sizes[r].url}else{v=s.attributes.url}if(d=="id"){f.find(".image-url").val(s.attributes.id)}else{f.find(".image-url").val(v)}if(s.attributes.type=="image"){f.find(".screenshot").empty().hide().append('<img src="'+v+'"><a class="remove-image"></a>').slideDown("fast")}if(m=="logo"){f.find(".image-width").val(s.attributes.width);f.find(".image-height").val(s.attributes.height)}if(m=="video"){f.find(".video-url").val(s.attributes.url)}if(m=="slider"){f.find(".image-id").val(s.attributes.id);f.find(".image-title").val(s.attributes.title);t=f.find(".image-title").val();if(t){f.closest(".widget").find(".slide-summary").text(t).fadeIn(200)}}if(m!="video"&&m!="media"){f.find(".upload-button").unbind().addClass("remove-file").removeClass("upload-button").val(q);f.find(".of-background-properties").slideDown();f.find(".remove-image, .remove-file").click(function(){themeblvd_media_uploader.remove_file(a(this).closest(".section-upload"))})}if(m=="media"){}if(m=="advanced"){f.find(".image-id").val(s.attributes.id);f.find(".image-title").val(s.attributes.title);f.find(".image-crop").val(r);if(i){u=c.$el.find(".attachment-display-settings .link-to").val();if(u!="none"){p=c.$el.find(".attachment-display-settings .link-to-custom").val();console.log(p);f.closest(".advanced-image-upload").find(".receive-link-url input").val(p)}}}});c.open();if(m=="advanced"){c.$el.addClass("hide-menu");c.$el.find(".attachment-display-settings label:first-of-type").remove();if(!i){console.log("hiding link options...");console.log(c.$el.find(".attachment-display-settings div.setting"));c.$el.find(".attachment-display-settings div.setting").remove()}}},remove_file:function(c){var b=this,e=c.find(".trigger").data("upload"),d=c.find(".trigger").data("type");if(d=="slider"){c.closest(".widget").find(".slide-summary").removeClass("image video").hide().text("")}c.find(".remove-image").hide();c.find(".upload").val("");c.find(".of-background-properties").hide();c.find(".screenshot").slideUp();c.find(".remove-file").addClass("upload-button").removeClass("remove-file").val(e);c.find(".upload-button").click(function(f){f.preventDefault();b.add_file(a(this).closest(".section-upload"))})},add_images:function(f,c){var b=this,d=f.attr("id");if(b.media_frame[d]){b.media_frame[d].open();return}var e=b.media_frame[d]=wp.media.frames.file_frame=wp.media({frame:"select",className:"media-frame tb-modal-hide-settings",title:f.data("title"),library:{type:"image"},button:{text:f.data("button")},multiple:"add"});e.on("select update insert",function(j){var p,h=e.state(),l=0,o=[],m,k,g=c.find(".tb-sortable-option"),n;if(typeof j!=="undefined"){p=j}else{p=h.get("selection")}p.map(function(i){m=i.toJSON();o[l]={id:m.id,title:m.title};if(m.sizes.tb_thumb){o[l]["preview"]=m.sizes.tb_thumb.url}else{o[l]["preview"]=m.sizes.full.url}l++});k={action:"themeblvd_add_"+g.data("type")+"_item",security:g.data("security"),data:{option_name:g.data("name"),option_id:g.data("id"),items:o}};a.post(ajaxurl,k,function(i){c.find(".item-container").append(i);var q=c.find(".item-container .item").slice(-o.length);q.addClass("add");window.setTimeout(function(){q.removeClass("add")},500);c.find(".delete-sortable-items").fadeIn(200);q.find(".delete-sortable-item").on("click",function(){var s=a(this),t=s.closest(".section-sortable"),r=s.closest(".item");tbc_confirm(s.attr("title"),{confirm:true},function(u){if(u){r.addClass("delete");window.setTimeout(function(){r.remove();if(!t.find(".item-container .item").length){t.find(".delete-sortable-items").fadeOut(200)}},500)}});return false});q.find(".toggle").on("click",function(){var r=a(this);if(r.closest(".item-handle").hasClass("closed")){r.closest(".item-handle").removeClass("closed");r.closest(".item").find(".item-content").show()}else{r.closest(".item-handle").addClass("closed");r.closest(".item").find(".item-content").hide()}return false});q.find(".item-handle h3").each(function(){var s=a(this),r=s.closest(".item").find(".handle-trigger");if(r.is("select")){s.closest(".item").find(".item-handle h3").text(r.find('option[value="'+r.val()+'"]').text())}else{s.closest(".item").find(".item-handle h3").text(r.val())}});q.find(".handle-trigger").on("change",function(){var r=a(this);if(r.is("select")){r.closest(".item").find(".item-handle h3").text(r.find('option[value="'+r.val()+'"]').text())}else{r.closest(".item").find(".item-handle h3").text(r.val())}});q.closest(".subgroup").find(".match-trigger .of-input").each(function(){var r=a(this);r.closest(".subgroup").find(".match .of-input").val(r.val())});q.themeblvd("options","setup")})});e.open()}}})(jQuery);(function(a){themeblvd_column_widths={init:function(b){b.find(".section-column_widths").each(function(){themeblvd_column_widths.run(a(this).closest(".subgroup.columns"))})},run:function(j){var g={10:{2:{values:[0,5,10],display:["1/2","1/2"]},3:{values:[0,3,7,10],display:["3/10","2/5","3/10"]},4:{values:[0,2,5,8,10],display:["1/5","3/10","3/10","1/5"]},5:{values:[0,2,4,6,8,10],display:["1/5","1/5","1/5","1/5","1/5"]},6:{values:[0,1,3,5,7,9,10],display:["1/10","1/5","1/5","1/5","1/5","1/10"]}},12:{2:{values:[0,6,12],display:["1/2","1/2"]},3:{values:[0,4,8,12],display:["1/3","1/3","1/3"]},4:{values:[0,3,6,9,12],display:["1/4","1/4","1/4","1/4"]},5:{values:[0,2,4,8,10,12],display:["1/6","1/6","1/3","1/6","1/6"]},6:{values:[0,2,4,6,8,10,12],display:["1/6","1/6","1/6","1/6","1/6","1/6"]}}};var d=j.find(".slider").attr("id"),b=12,f=3,m=0,n="",c=0,e=0,k=j.find(".column-width-input").val(),l=[];b=j.find(".select-grid-system").val();f=j.find(".select-col-num").val();j.find(".select-col-num").off("change.ui-slider");j.find(".select-col-num").on("change.ui-slider",themeblvd_column_widths.change);j.find(".select-grid-system").off("change.ui-slider");j.find(".select-grid-system").on("change.ui-slider",themeblvd_column_widths.change);if(f==0){return}else{if(f==1){j.find(".slider").append('<div class="column-preview col-1" style="width:100%"><span class="text">100%</span></div>');j.find(".column-width-input").val("1/1").trigger("themeblvd_update_columns");return}}if(k){k=k.split("-");f=k.length;for(var h=0;h<=f;h++){if(h===0){l[h]=0}else{if(h==f){l[h]=b}else{n=k[h-1].split("/");m+=(b*n[0])/n[1];l[h]=m}}}}else{l=g[b][f]["values"];k=g[b][f]["display"];j.find(".column-width-input").val(k.join("-")).trigger("themeblvd_update_columns")}a("#"+d).slider({range:"max",min:0,max:b,step:1,values:l,create:function(r,s){var p,t=0,q=0,o="";for(p=1;p<=f;p++){j.find(".slider").append('<div class="column-preview col-'+p+'"><span class="text">'+k[p-1]+"</span></div>");q=((l[p]-l[p-1])/b)*100;j.find(".col-"+p).css("width",q+"%");if(p>1){j.find(".col-"+p).css("left",t+"%")}t+=q}t=0;o='<div class="grid-display grid-'+b+'">';for(p=1;p<=b;p++){o+='<div class="grid-column grid-col-'+p+'"></div>'}o+="</div>";j.find(".slider").append(o);for(p=1;p<=b;p++){t+=((1/b)*100);j.find(".grid-col-"+p).css("left",t+"%")}},slide:function(F,z){var t=a(z.handle).index(),o=z.values,u=o.length;if(t==1||t==u){return false}var D=a(z.handle).closest(".column-widths-wrap"),C=D.find(".column-width-input"),w=z.value,x=o[t],H=o[t-2],B=0,p=0,y="",v="",s=0,r=0,E="",J="",I=[],q=0,A=0;if(w<=H||w>=x){return false}r=w-H;s=x-w;p=t-1;B=t;y=themeblvd_column_widths.reduce(r,b);y=y[0].toString()+"/"+y[1].toString();v=themeblvd_column_widths.reduce(s,b);v=v[0].toString()+"/"+v[1].toString();D.find('input[name="col['+p+']"]').val(y);D.find('input[name="col['+B+']"]').val(v);E=C.val();E=E.split("-");for(var G=1;G<=E.length;G++){if(G==p){J+=y}else{if(G==B){J+=v}else{J+=E[G-1]}}if(G!=E.length){J+="-"}}C.val(J).trigger("themeblvd_update_columns");I=J.split("-");for(G=1;G<=f;G++){A=((o[G]-o[G-1])/b)*100;j.find(".col-"+G).css("width",A+"%");j.find(".col-"+G+" .text").text(I[G-1]);if(G>1){j.find(".col-"+G).css("left",q+"%")}q+=A}}})},change:function(){var b=a(this),c=a("#"+b.data("slider"));if(c.data("uiSlider")){c.slider("destroy")}c.html("").closest(".column-widths-wrap").find(".column-width-input").val("");themeblvd_column_widths.run(b.closest(".subgroup.columns"))},reduce:function(c,d){var b=function b(f,e){return e?b(e,f%e):f};b=b(c,d);return[c/b,d/b]}}})(jQuery);(function(a){tbc_alert={init:function(f,d,b){var c=' <div id="tb-alert"> <div class="tb-alert-inner"> <div class="tb-alert-pad"> <div class="tb-alert-message"> <p>Replace this with message text.</p> </div> </div><!-- .tb-alert-pad (end) --> </div><!-- .tb-alert-inner (end) --> </div><!-- .tb-alert (end) -->';if(!b){b="body"}a(b).append(c);var g=a("#tb-alert"),e=a(window).height();g.addClass("tb-"+d);g.find(".tb-alert-message p").text(f);if(b=="body"){g.animate({top:(e-(e-75))+a(window).scrollTop()+"px"},100)}g.fadeIn(500,function(){setTimeout(function(){g.fadeOut(500,function(){g.remove()})},1500)})}}})(jQuery);(function(a){tbc_confirm=function(f,h,j){var d=a("body"),b=a(window),k,l,c;var e={confirm:false,verify:false,input:false,input_desc:"",textOk:"Ok",textCancel:"Cancel",textYes:"Yes",textNo:"No","class":""};if(h){for(var g in e){if(typeof h[g]=="undefined"){h[g]=e[g]}}}d.append('<div class="appriseOverlay" id="aOverlay"></div>');d.append('<div class="appriseOuter"></div>');k=a(".appriseOuter");k.append('<div class="appriseInner"></div>');l=a(".appriseInner");l.append(f);k.css("left",(b.width()-k.width())/2+b.scrollLeft()+"px");k.css("top","100px").fadeIn(200);if(h&&h["class"]){k.addClass(h["class"])}if(h&&h.input){if(typeof(h.input)=="string"){l.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" value="'+h.input+'" /></div>')}else{if(typeof(h.input)=="object"){l.append(a('<div class="aInput"></div>').append(h.input))}else{l.append('<div class="aInput"><input type="text" class="aTextbox" t="aTextbox" /></div>')}}if(h.input_desc){k.find(".aTextbox").after("<label>"+h.input_desc+"</label>")}k.find(".aTextbox").focus()}l.append('<div class="aButtons"></div>');c=a(".aButtons");if(h){if(h.confirm||h.input){c.append('<button class="button-primary" value="ok">'+h.textOk+"</button>");c.append('<button class="button-secondary" value="cancel">'+h.textCancel+"</button>")}else{if(h.verify){c.append('<button class="button-primary" value="ok">'+h.textYes+"</button>");c.append('<button class="button-secondary" value="cancel">'+h.textNo+"</button>")}else{c.append('<button class="button-primary" value="ok">'+h.textOk+"</button>")}}}else{c.append('<button class="button-primary" value="ok">Ok</button>')}a(document).keydown(function(m){if(a(".appriseOverlay").is(":visible")){if(m.keyCode==13){a('.aButtons > button[value="ok"]').click()}if(m.keyCode==27){a('.aButtons > button[value="cancel"]').click()}}});var i=a(".aTextbox").val();a(".aTextbox").keyup(function(){i=a(this).val()});c.find("button").on("click",function(){a(".appriseOverlay").remove();k.remove();if(j){var m=a(this).attr("value");if(m=="ok"){if(h){if(h.input){j(i)}else{j(true)}}else{j(true)}}else{if(m=="cancel"){j(false)}}}})}})(jQuery);jQuery(document).ready(function(a){a(".themeblvd-icon-browser").themeblvd("options","setup");a(".themeblvd-icon-browser").themeblvd("options","bind");a(".themeblvd-icon-browser .select-icon").on("click",function(){var c=a(this),b=c.closest(".themeblvd-icon-browser"),d=c.data("icon");b.find(".select-icon").removeClass("selected");c.addClass("selected");b.find(".icon-selection").val(d);b.find(".media-toolbar-secondary").find(".fa, span, img").remove();if(c.hasClass("select-image-icon")){b.find(".media-toolbar-secondary").append('<img src="'+c.find("img").attr("src")+'" /><span>'+d+"</span>")}else{b.find(".media-toolbar-secondary").append('<i class="fa fa-'+d+' fa-2x fa-fw"></i><span>'+d+"</span>")}return false});a(".themeblvd-texture-browser").themeblvd("options","setup");a(".themeblvd-texture-browser").themeblvd("options","bind");if(a.isFunction(a.fn.wpColorPicker)){a("#texture-browser-perview-color").wpColorPicker({change:function(){a(".themeblvd-texture-browser .select-texture span").css("background-color",a("#texture-browser-perview-color").val())}})}a(".themeblvd-texture-browser .wp-color-result").attr("title","Temporary Preview Color");a(".themeblvd-texture-browser .select-texture span").css("background-color",a("#texture-browser-perview-color").val());a(".themeblvd-texture-browser .select-texture").on("click",function(){var b=a(this);b.closest(".themeblvd-texture-browser").find(".select-texture").each(function(){a(this).removeClass("selected")});b.addClass("selected");b.closest(".themeblvd-texture-browser").find(".texture-selection").val(b.data("texture"));b.closest(".themeblvd-texture-browser").find(".current-texture").text(b.data("texture-name"));return false});a("#themeblvd_options_page .reset-button").click(function(){tbc_confirm("<h3>"+themeblvd.reset_title+"</h3>"+themeblvd.reset,{confirm:true},function(b){if(b){a("#themeblvd_options_page").append('<input type="hidden" name="reset" value="true" />');a("#themeblvd_options_page").submit()}});return false});a("#themeblvd_options_page .clear-button").click(function(){tbc_confirm("<h3>"+themeblvd.clear_title+"</h3>"+themeblvd.clear,{confirm:true},function(d){if(d){var c=a("#themeblvd_options_page"),b=c.find('input[name="option_page"]').val();c.attr("action","");c.append('<input type="hidden" name="themeblvd_clear_options" value="'+b+'" />');c.submit()}});return false})});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.