PluginProbe
MaxButtons – Create buttons / 7.10
MaxButtons – Create buttons v7.10
6.23 6.24 6.25 6.26 6.26.1 6.27 6.28 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.1.1 7.1.2 7.1.3 7.10 7.11 7.13 7.13.1 7.13.2 7.13.3 All 100 releases
maxbuttons / js / min / responsive.js

responsive.js in MaxButtons – Create buttons 7.10, at js/min/responsive.js

1 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 function mbResponsive(){}mbResponsive.prototype={mbAdmin:null,responsiveMap:null},mbResponsive.prototype.init=function(e){this.mbAdmin=e,0!=$("#new-button-form").length&&(this.checkAutoQuery(),$('input[name="auto_responsive"]').on("click",$.proxy(this.checkAutoQuery,this)),$(".add_media_query").on("click",$.proxy(this.addMediaQuery,this)),this.responsiveMap=JSON.parse(responsiveMap),$(document).on("click",".removebutton",$.proxy(this.removeMediaQuery,this)))},mbResponsive.prototype.checkAutoQuery=function(){$('input[name="auto_responsive"]').is(":checked")?($(".media_queries_options").hide(),$(".option-design.new-query").hide()):($(".media_queries_options").show(),$(".option-design.new-query").show())},mbResponsive.prototype.addMediaQuery=function(){this.mbAdmin.saveIndicator(!0);var e=$(".media_option_prot").children().clone(),t=$("#new_query").val(),i=$("#new_query :selected").text(),n=$("#media_desc").children("#"+t).text();$(e).data("query",t),$(e).children('input[name="media_query[]"]').val(t),$(e).children(".title").text(i),$(e).children(".description").text(n),"custom"==t&&$(e).find(".custom").removeClass("hidden");var r=$('input[name="next_media_index"]').val();$(e).find("label, select, input").each(function(){var e=$(this).attr("name"),t=$(this).attr("id"),i=$(this).data("field"),n=$(this).prop("tagName").toLowerCase();if(void 0!==t&&$(this).attr("id",t.replace("[]","["+r+"]")),void 0!==e&&$(this).attr("name",e.replace("[]","["+r+"]")),void 0!==i&&$(this).data("field",i.replace("[]","["+r+"]")),"label"==n){var o=$(this).attr("for");void 0!==o&&$(this).attr("for",o.replace("[]","["+r+"]"))}}),$(document).trigger("reinitConditionals"),r=parseInt(r),$('input[name="next_media_index"]').val(r+1),"custom"!==t&&($("#new_query :selected").prop("disabled",!0),$("#new_query :selected").prop("selected",!1)),$(".new_query_space").append(e);var o=$(".new_query_space").offset().top;$(window).scrollTop(o-100)},mbResponsive.prototype.removeMediaQuery=function(e){var t=e.target,i=$(t).parents(".media_query").data("query");$(t).parents(".media_query").fadeOut(function(){$(this).remove()}),$('#new_query option[value="'+i+'"]').prop("disabled",!1)},mbResponsive.prototype.toggleResponsivePreview=function(e){var t=$(e.target).attr("id");t=(t=t.replace("mq_preview[","")).replace("]",""),this.renderPreview(t)},mbResponsive.prototype.renderPreview=function(e){var t=["mq_container_width","mq_container_float","mq_custom_minwidth","mq_custom_minheight","mq_hide"],i=this.responsiveMap,n=this;$.each(i,function(r){var o=this.css,a='[id^="'+r+'["]',s='[id^="'+r+'_unit["]',d=$(a).eq(e),p=d.attr("id");if(p=p.replace(/\[[0-9]\]/gi,""),$.inArray(p,t)>=0)return!0;if(p.indexOf("_unit")>=0)return!0;var u=d.val(),c="";if(void 0!==i[r+"_unit"])c=$(s).eq(e).val();var m={css:o};"font-size"==o&&(m.csspart="mb-text,mb-text2"),n.mbAdmin.putCSS(m,u+c)})};