$(document).ready(function () { function initColor(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-color-" + modifier + "[^ ]+").exec(c); if (s) { var color = s[0].replace("c-color-" + modifier, ""); if(/^#[0-9a-fA-F]{8}$/.test(color)){ color="rgba("+ parseInt(color.substr(1,2),16)+","+ parseInt(color.substr(3,2),16)+","+ parseInt(color.substr(5,2),16)+","+ parseInt(color.substr(7,2),16)/255 +")"; }else if(/^[0-9a-fA-F]{8}$/.test(color)){ color="rgba("+ parseInt(color.substr(0,2),16)+","+ parseInt(color.substr(2,2),16)+","+ parseInt(color.substr(4,2),16)+","+ parseInt(color.substr(6,2),16)/255 +")"; }else if(/^[0-9a-fA-F]{6}$/.test(color)){ color="#"+color; } el.css("color", color); } } function clearColor(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-color-" + modifier + "[^ ]+").exec(c); if (s) { el.css("color", ""); } } function initBg(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-bg-" + modifier + "[^ ]+").exec(c); if (s) { var bg = s[0].replace("c-bg-" + modifier, "").replace(/_/g, " "); if(/^#[0-9a-fA-F]{8}$/.test(bg)){ bg="rgba("+ parseInt(bg.substr(1,2),16)+","+ parseInt(bg.substr(3,2),16)+","+ parseInt(bg.substr(5,2),16)+","+ parseInt(bg.substr(7,2),16)/255 +")"; } el.css("background", bg); } } function clearBg(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-bg-" + modifier + "[^ ]+").exec(c); if (s) { el.css("background", ""); } } function init_lh(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-lh-" + modifier + "[^ ]+").exec(c); if (s) { var height = s[0].replace("c-lh-" + modifier, ""); el.css("line-height", height); } } function clear_lh(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-lh-" + modifier + "[^ ]+").exec(c); if (s) { el.css("line-height", ""); } } function init_fs(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-fs-" + modifier + "[^ ]+").exec(c); if (s) { var size = s[0].replace("c-fs-" + modifier, ""); el.css("font-size", size); } } function clear_fs(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-fs-" + modifier + "[^ ]+").exec(c); if (s) { el.css("font-size", ""); } } function init_height(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-height-" + modifier + "[^ ]+").exec(c); if (s) { var size = s[0].replace("c-height-" + modifier, ""); el.css("height", size); } } function init_width(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-width-" + modifier + "[^ ]+").exec(c); if (s) { var size = s[0].replace("c-width-" + modifier, ""); el.css("width", size); } } function clear_height(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-height-" + modifier + "[^ ]+").exec(c); if (s) { el.css("height", ""); } } function clear_width(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-width-" + modifier + "[^ ]+").exec(c); if (s) { el.css("width", ""); } } function init_max_height(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-max-height-" + modifier + "[^ ]+").exec(c); if (s) { var size = s[0].replace("c-max-height-" + modifier, ""); el.css("max-height", size); } } function init_max_width(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-max-width-" + modifier + "[^ ]+").exec(c); if (s) { var size = s[0].replace("c-max-width-" + modifier, ""); el.css("max-width", size); } } function clear_max_height(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-max-height-" + modifier + "[^ ]+").exec(c); if (s) { el.css("max-height", ""); } } function clear_max_width(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-max-width-" + modifier + "[^ ]+").exec(c); if (s) { el.css("max-width", ""); } } function init_min_height(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-min-height-" + modifier + "[^ ]+").exec(c); if (s) { var size = s[0].replace("c-min-height-" + modifier, ""); el.css("min-height", size); } } function init_min_width(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-min-width-" + modifier + "[^ ]+").exec(c); if (s) { var size = s[0].replace("c-min-width-" + modifier, ""); el.css("min-width", size); } } function clear_min_height(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-min-height-" + modifier + "[^ ]+").exec(c); if (s) { el.css("min-height", ""); } } function clear_min_width(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-min-width-" + modifier + "[^ ]+").exec(c); if (s) { el.css("min-width", ""); } } function initMargin(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-margin-" + modifier + "[^ ]+").exec(c); if (s) { var margin = s[0].replace("c-margin-" + modifier, "").replace(/_/g, " "); el.css("margin", margin); } var c1 = el.attr("class"); var s1 = RegExp("\\bc-mr-" + modifier + "[^ ]+").exec(c1); if (s1) { var margin = s1[0].replace("c-mr-" + modifier, ""); el.css("margin-right", margin); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-ml-" + modifier + "[^ ]+").exec(c2); if (s2) { var margin = s2[0].replace("c-ml-" + modifier, ""); el.css("margin-left", margin); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-mt-" + modifier + "[^ ]+").exec(c3); if (s3) { var margin = s3[0].replace("c-mt-" + modifier, ""); el.css("margin-top", margin); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-mb-" + modifier + "[^ ]+").exec(c4); if (s4) { var margin = s4[0].replace("c-mb-" + modifier, ""); el.css("margin-bottom", margin); } } function clearMargin(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-margin-" + modifier + "[^ ]+").exec(c); if (s) { el.css("margin", ""); } var c1 = el.attr("class"); var s1 = RegExp("\\bc-mr-" + modifier + "[^ ]+").exec(c1); if (s1) { el.css("margin-right", ""); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-ml-" + modifier + "[^ ]+").exec(c2); if (s2) { el.css("margin-left", ""); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-mt-" + modifier + "[^ ]+").exec(c3); if (s3) { el.css("margin-top", ""); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-mb-" + modifier + "[^ ]+").exec(c4); if (s4) { el.css("margin-bottom", ""); } } function initPadding(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-padding-" + modifier + "[^ ]+").exec(c); if (s) { var padding = s[0].replace("c-padding-" + modifier, "").replace(/_/g, " "); el.css("padding", padding); } var c1 = el.attr("class"); var s1 = RegExp("\\bc-pr-" + modifier + "[^ ]+").exec(c1); if (s1) { var padding = s1[0].replace("c-pr-" + modifier, ""); el.css("padding-right", padding); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-pl-" + modifier + "[^ ]+").exec(c2); if (s2) { var padding = s2[0].replace("c-pl-" + modifier, ""); el.css("padding-left", padding); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-pt-" + modifier + "[^ ]+").exec(c3); if (s3) { var padding = s3[0].replace("c-pt-" + modifier, ""); el.css("padding-top", padding); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-pb-" + modifier + "[^ ]+").exec(c4); if (s4) { var padding = s4[0].replace("c-pb-" + modifier, ""); el.css("padding-bottom", padding); } } function clearPadding(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-padding-" + modifier + "[^ ]+").exec(c); if (s) { el.css("padding", ""); } var c1 = el.attr("class"); var s1 = RegExp("\\bc-pr-" + modifier + "[^ ]+").exec(c1); if (s1) { el.css("padding-right", ""); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-pl-" + modifier + "[^ ]+").exec(c2); if (s2) { el.css("padding-left", ""); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-pt-" + modifier + "[^ ]+").exec(c3); if (s3) { el.css("padding-top", ""); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-pb-" + modifier + "[^ ]+").exec(c4); if (s4) { el.css("padding-bottom", ""); } } function initBorder(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-border-" + modifier + "[^ ]+").exec(c); if (s) { var border = s[0].replace("c-border-" + modifier, "").replace(/_/g, " "); el.css("border", border); } var c1 = el.attr("class"); var s1 = RegExp("\\bc-br-" + modifier + "[^ ]+").exec(c1); if (s1) { var border = s1[0].replace("c-br-" + modifier, "").replace(/_/g, " "); el.css("border-right", border); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-bl-" + modifier + "[^ ]+").exec(c2); if (s2) { var border = s2[0].replace("c-bl-" + modifier, "").replace(/_/g, " "); el.css("border-left", border); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-bt-" + modifier + "[^ ]+").exec(c3); if (s3) { var border = s3[0].replace("c-bt-" + modifier, "").replace(/_/g, " "); el.css("border-top", border); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-bb-" + modifier + "[^ ]+").exec(c4); if (s4) { var border = s4[0].replace("c-bb-" + modifier, "").replace(/_/g, " "); el.css("border-bottom", border); } } function clearBorder(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-border-" + modifier + "[^ ]+").exec(c); if (s) { el.css("border", ""); } var c1 = el.attr("class"); var s1 = RegExp("\\bc-br-" + modifier + "[^ ]+").exec(c1); if (s1) { el.css("border-right", ""); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-bl-" + modifier + "[^ ]+").exec(c2); if (s2) { el.css("border-left", ""); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-bt-" + modifier + "[^ ]+").exec(c3); if (s3) { el.css("border-top", ""); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-bb-" + modifier + "[^ ]+").exec(c4); if (s4) { el.css("border-bottom", ""); } } function initHoverColor(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-hover-color-" + modifier + "[^ ]+").exec(c); if (s) { var color = s[0].replace("c-hover-color-" + modifier, ""); var original_color = ""; var style = el.attr("style"); var t = /(^|(?:;))(color:)([^;]+)/.exec(style); if (t) { original_color = t[3]; } var enter = function () { $(this).css("color", color); }; var leave = function () { $(this).css("color", original_color); }; var dom = el.get()[0]; dom.__c_data_style_color_original = original_color; dom.__c_data_handle_enter_color = enter; dom.__c_data_handle_leave_color = leave; el.mouseenter(dom.__c_data_handle_enter_color); el.mouseleave(dom.__c_data_handle_leave_color); } } function clearHoverColor(el, modifier) { var c = el.attr("class"); var s = RegExp("\\bc-hover-color-" + modifier + "[^ ]+").exec(c); if (s) { var dom = el.get()[0]; if (dom.__c_data_handle_enter_color) el.unbind("mouseenter", dom.__c_data_handle_enter_color); if (dom.__c_data_handle_leave_color) el.unbind("mouseleave", dom.__c_data_handle_leave_color); dom.__c_data_handle_enter_color = null; dom.__c_data_handle_leave_color = null; if (dom.__c_data_style_color_original) el.css("color", dom.__c_data_style_color_original); dom.__c_data_style_color_original = null; } } function initZIndex(el,modifier) { var c = el.attr("class"); var s = RegExp("\\bc-z-index-" + modifier + "[^ ]+").exec(c); if (s) { var z = s[0].replace("c-z-index-" + modifier, ""); el.css("z-index", z); el.css("position","relative"); } } function clearZIndex(el,modifier) { var c = el.attr("class"); var s = RegExp("\\bc-z-index-" + modifier + "[^ ]+").exec(c); if (s) { el.css("z-index", ""); } } function initRelativePosition(el,modifier){ el.css("position", "relative"); var c1 = el.attr("class"); var s1 = RegExp("\\bc-top-" + modifier + "[^ ]+").exec(c1); if (s1) { var offset = s1[0].replace("c-top-" + modifier, ""); el.css("top", offset); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-left-" + modifier + "[^ ]+").exec(c2); if (s2) { var offset = s2[0].replace("c-left-" + modifier, ""); el.css("left", offset); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-right-" + modifier + "[^ ]+").exec(c3); if (s3) { var offset = s3[0].replace("c-right-" + modifier, ""); el.css("right", offset); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-bottom-" + modifier + "[^ ]+").exec(c4); if (s4) { var offset = s4[0].replace("c-bottom-" + modifier, ""); el.css("bottom", offset); } } function clearRelativePosition(el,modifier){ var c1 = el.attr("class"); var s1 = RegExp("\\bc-top-" + modifier + "[^ ]+").exec(c1); if (s1) { el.css("top", ""); } var c2 = el.attr("class"); var s2 = RegExp("\\bc-left-" + modifier + "[^ ]+").exec(c2); if (s2) { el.css("left", ""); } var c3 = el.attr("class"); var s3 = RegExp("\\bc-right-" + modifier + "[^ ]+").exec(c3); if (s3) { el.css("right", ""); } var c4 = el.attr("class"); var s4 = RegExp("\\bc-bottom-" + modifier + "[^ ]+").exec(c4); if (s4) { el.css("bottom", ""); } } function applyGeneral() { $(".c-color").each(function () { initColor($(this), ""); }); $(".c-bg").each(function () { initBg($(this), ""); }); $(".c-lh").each(function () { init_lh($(this), ""); }); $(".c-fs").each(function () { init_fs($(this), ""); }); $(".c-height").each(function () { init_height($(this), ""); }); $(".c-width").each(function () { init_width($(this), ""); }); $(".c-margin").each(function () { initMargin($(this), ""); }); $(".c-padding").each(function () { initPadding($(this), ""); }); $(".c-border").each(function () { initBorder($(this), ""); }); $(".c-hover-color").each(function () { initHoverColor($(this),""); }); $(".c-max-height").each(function () { init_max_height($(this),""); }); $(".c-max-width").each(function () { init_max_width($(this),""); }); $(".c-min-height").each(function () { init_min_height($(this),""); }); $(".c-min-width").each(function () { init_min_width($(this),""); }); $(".c-hidden").hide(); $(".c-z-index").each(function () { initZIndex($(this),""); }); $(".c-relative").each(function () { initRelativePosition($(this),""); }); //console.log("apply general"); } function applyMobile() { $(".c-color-mobile").each(function () { initColor($(this), "mobile-"); }); $(".c-bg-mobile").each(function () { initBg($(this), "mobile-"); }); $(".c-lh-mobile").each(function () { init_lh($(this), "mobile-"); }); $(".c-fs-mobile").each(function () { init_fs($(this), "mobile-"); }); $(".c-height-mobile").each(function () { init_height($(this), "mobile-"); }); $(".c-width-mobile").each(function () { init_width($(this), "mobile-"); }); $(".c-margin-mobile").each(function () { initMargin($(this), "mobile-"); }); $(".c-padding-mobile").each(function () { initPadding($(this), "mobile-"); }); $(".c-border-mobile").each(function () { initBorder($(this), "mobile-"); }); $(".c-hover-color-mobile").each(function () { initHoverColor($(this),"mobile-"); }); $(".c-max-height-mobile").each(function () { init_max_height($(this),"mobile-"); }); $(".c-max-width-mobile").each(function () { init_max_width($(this),"mobile-"); }); $(".c-min-height-mobile").each(function () { init_min_height($(this),"mobile-"); }); $(".c-min-width-mobile").each(function () { init_min_width($(this),"mobile-"); }); $(".c-z-index-mobile").each(function () { initZIndex($(this),"mobile-"); }); $(".c-hidden-mobile").hide(); $(".c-relative-mobile").each(function () { initRelativePosition($(this),"mobile-"); }); } function applyPad() { $(".c-color-pad").each(function () { initColor($(this), "pad-"); }); $(".c-bg-pad").each(function () { initBg($(this), "pad-"); }); $(".c-lh-pad").each(function () { init_lh($(this), "pad-"); }); $(".c-fs-pad").each(function () { init_fs($(this), "pad-"); }); $(".c-height-pad").each(function () { init_height($(this), "pad-"); }); $(".c-width-pad").each(function () { init_width($(this), "pad-"); }); $(".c-margin-pad").each(function () { initMargin($(this), "pad-"); }); $(".c-padding-pad").each(function () { initPadding($(this), "pad-"); }); $(".c-border-pad").each(function () { initBorder($(this), "pad-"); }); $(".c-hover-color-pad").each(function () { initHoverColor($(this),"pad-"); }); $(".c-max-height-pad").each(function () { init_max_height($(this),"pad-"); }); $(".c-max-width-pad").each(function () { init_max_width($(this),"pad-"); }); $(".c-min-height-pad").each(function () { init_min_height($(this),"pad-"); }); $(".c-min-width-pad").each(function () { init_min_width($(this),"pad-"); }); $(".c-hidden-pad").hide(); $(".c-z-index-pad").each(function () { initZIndex($(this),"pad-"); }); $(".c-relative-pad").each(function () { initRelativePosition($(this),"pad-"); }); } function applyPC() { $(".c-color-pc").each(function () { initColor($(this), "pc-"); }); $(".c-bg-pc").each(function () { initBg($(this), "pc-"); }); $(".c-lh-pc").each(function () { init_lh($(this), "pc-"); }); $(".c-fs-pc").each(function () { init_fs($(this), "pc-"); }); $(".c-height-pc").each(function () { init_height($(this), "pc-"); }); $(".c-width-pc").each(function () { init_width($(this), "pc-"); }); $(".c-margin-pc").each(function () { initMargin($(this), "pc-"); }); $(".c-padding-pc").each(function () { initPadding($(this), "pc-"); }); $(".c-border-pc").each(function () { initBorder($(this), "pc-"); }); $(".c-hover-color-pc").each(function () { initHoverColor($(this),"pc-"); }); $(".c-max-height-pc").each(function () { init_max_height($(this),"pc-"); }); $(".c-max-width-pc").each(function () { init_max_width($(this),"pc-"); }); $(".c-min-height-pc").each(function () { init_min_height($(this),"pc-"); }); $(".c-min-width-pc").each(function () { init_min_width($(this),"pc-"); }); $(".c-hidden-pc").hide(); $(".c-z-index-pc").each(function () { initZIndex($(this),"pc"); }); $(".c-relative-pc").each(function () { initRelativePosition($(this),"pc-"); }); } function apply1280() { $(".c-color-1280").each(function () { initColor($(this), "1280-"); }); $(".c-bg-1280").each(function () { initBg($(this), "1280-"); }); $(".c-lh-1280").each(function () { init_lh($(this), "1280-"); }); $(".c-fs-1280").each(function () { init_fs($(this), "1280-"); }); $(".c-height-1280").each(function () { init_height($(this), "1280-"); }); $(".c-width-1280").each(function () { init_width($(this), "1280-"); }); $(".c-margin-1280").each(function () { initMargin($(this), "1280-"); }); $(".c-padding-1280").each(function () { initPadding($(this), "1280-"); }); $(".c-border-1280").each(function () { initBorder($(this), "1280-"); }); $(".c-hover-color-1280").each(function () { initHoverColor($(this),"1280-"); }); $(".c-max-height-1280").each(function () { init_max_height($(this),"1280-"); }); $(".c-max-width-1280").each(function () { init_max_width($(this),"1280-"); }); $(".c-min-height-1280").each(function () { init_min_height($(this),"1280-"); }); $(".c-min-width-1280").each(function () { init_min_width($(this),"1280-"); }); $(".c-hidden-1280").hide(); $(".c-z-index-1280").each(function () { initZIndex($(this),"1280"); }); $(".c-relative-1280").each(function () { initRelativePosition($(this),"1280-"); }); } function apply1440() { $(".c-color-1440").each(function () { initColor($(this), "1440-"); }); $(".c-bg-1440").each(function () { initBg($(this), "1440-"); }); $(".c-lh-1440").each(function () { init_lh($(this), "1440-"); }); $(".c-fs-1440").each(function () { init_fs($(this), "1440-"); }); $(".c-height-1440").each(function () { init_height($(this), "1440-"); }); $(".c-width-1440").each(function () { init_width($(this), "1440-"); }); $(".c-margin-1440").each(function () { initMargin($(this), "1440-"); }); $(".c-padding-1440").each(function () { initPadding($(this), "1440-"); }); $(".c-border-1440").each(function () { initBorder($(this), "1440-"); }); $(".c-hover-color-1440").each(function () { initHoverColor($(this),"1440-"); }); $(".c-max-height-1440").each(function () { init_max_height($(this),"1440-"); }); $(".c-max-width-1440").each(function () { init_max_width($(this),"1440-"); }); $(".c-min-height-1440").each(function () { init_min_height($(this),"1440-"); }); $(".c-min-width-1440").each(function () { init_min_width($(this),"1440-"); }); $(".c-hidden-1440").hide(); $(".c-z-index-1440").each(function () { initZIndex($(this),"1440"); }); $(".c-relative-1440").each(function () { initRelativePosition($(this),"1440-"); }); } function clearMobile() { $(".c-color-mobile").each(function () { clearColor($(this), "mobile-"); }); $(".c-bg-mobile").each(function () { clearBg($(this), "mobile-"); }); $(".c-lh-mobile").each(function () { clear_lh($(this), "mobile-"); }); $(".c-fs-mobile").each(function () { clear_fs($(this), "mobile-"); }); $(".c-height-mobile").each(function () { clear_height($(this), "mobile-"); }); $(".c-width-mobile").each(function () { clear_width($(this), "mobile-"); }); $(".c-margin-mobile").each(function () { clearMargin($(this), "mobile-"); }); $(".c-padding-mobile").each(function () { clearPadding($(this), "mobile-"); }); $(".c-border-mobile").each(function () { clearBorder($(this), "mobile-"); }); $(".c-hover-color-mobile").each(function () { clearHoverColor($(this),"mobile-"); }); $(".c-max-height-mobile").each(function () { clear_max_height($(this),"mobile-"); }); $(".c-max-width-mobile").each(function () { clear_max_width($(this),"mobile-"); }); $(".c-min-height-mobile").each(function () { clear_min_height($(this),"mobile-"); }); $(".c-min-width-mobile").each(function () { clear_min_width($(this),"mobile-"); }); $(".c-hidden-mobile").show(); $(".c-z-index-mobile").each(function () { clearZIndex($(this),"mobile-"); }); $(".c-relative-mobile").each(function () { clearRelativePosition($(this),"mobile-"); }); } function clearPad() { $(".c-color-pad").each(function () { clearColor($(this), "pad-"); }); $(".c-bg-pad").each(function () { clearBg($(this), "pad-"); }); $(".c-lh-pad").each(function () { clear_lh($(this), "pad-"); }); $(".c-fs-pad").each(function () { clear_fs($(this), "pad-"); }); $(".c-height-pad").each(function () { clear_height($(this), "pad-"); }); $(".c-width-pad").each(function () { clear_width($(this), "pad-"); }); $(".c-margin-pad").each(function () { clearMargin($(this), "pad-"); }); $(".c-padding-pad").each(function () { clearPadding($(this), "pad-"); }); $(".c-border-pad").each(function () { clearBorder($(this), "pad-"); }); $(".c-hover-color-pad").each(function () { clearHoverColor($(this),"pad-"); }); $(".c-max-height-pad").each(function () { clear_max_height($(this),"pad-"); }); $(".c-max-width-pad").each(function () { clear_max_width($(this),"pad-"); }); $(".c-min-height-pad").each(function () { clear_min_height($(this),"pad-"); }); $(".c-min-width-pad").each(function () { clear_min_width($(this),"pad-"); }); $(".c-hidden-pad").show(); $(".c-z-index-pad").each(function () { clearZIndex($(this),"pad-"); }); $(".c-relative-pad").each(function () { clearRelativePosition($(this),"pad-"); }); } function clearPC() { $(".c-color-pc").each(function () { clearColor($(this), "pc-"); }); $(".c-bg-pc").each(function () { clearBg($(this), "pc-"); }); $(".c-lh-pc").each(function () { clear_lh($(this), "pc-"); }); $(".c-fs-pc").each(function () { clear_fs($(this), "pc-"); }); $(".c-height-pc").each(function () { clear_height($(this), "pc-"); }); $(".c-width-pc").each(function () { clear_width($(this), "pc-"); }); $(".c-margin-pc").each(function () { clearMargin($(this), "pc-"); }); $(".c-padding-pc").each(function () { clearPadding($(this), "pc-"); }); $(".c-border-pc").each(function () { clearBorder($(this), "pc-"); }); $(".c-hover-pc").each(function () { clearHoverColor($(this),"pc-"); }); $(".c-max-height-pc").each(function () { clear_max_height($(this),"pc-"); }); $(".c-max-width-pc").each(function () { clear_max_width($(this),"pc-"); }); $(".c-min-height-pc").each(function () { clear_min_height($(this),"pc-"); }); $(".c-min-width-pc").each(function () { clear_min_width($(this),"pc-"); }); $(".c-hidden-pc").show(); $(".c-z-index-pc").each(function () { clearZIndex($(this),"pc-"); }); $(".c-relative-pc").each(function () { clearRelativePosition($(this),"pc-"); }); } function clear1280() { $(".c-color-1280").each(function () { clearColor($(this), "1280-"); }); $(".c-bg-1280").each(function () { clearBg($(this), "1280-"); }); $(".c-lh-1280").each(function () { clear_lh($(this), "1280-"); }); $(".c-fs-1280").each(function () { clear_fs($(this), "1280-"); }); $(".c-height-1280").each(function () { clear_height($(this), "1280-"); }); $(".c-width-1280").each(function () { clear_width($(this), "1280-"); }); $(".c-margin-1280").each(function () { clearMargin($(this), "1280-"); }); $(".c-padding-1280").each(function () { clearPadding($(this), "1280-"); }); $(".c-border-1280").each(function () { clearBorder($(this), "1280-"); }); $(".c-hover-1280").each(function () { clearHoverColor($(this),"1280-"); }); $(".c-max-height-1280").each(function () { clear_max_height($(this),"1280-"); }); $(".c-max-width-1280").each(function () { clear_max_width($(this),"1280-"); }); $(".c-min-height-1280").each(function () { clear_min_height($(this),"1280-"); }); $(".c-min-width-1280").each(function () { clear_min_width($(this),"1280-"); }); $(".c-hidden-1280").show(); $(".c-z-index-1280").each(function () { clearZIndex($(this),"1280-"); }); $(".c-relative-1280").each(function () { clearRelativePosition($(this),"1280-"); }); } function clear1440() { $(".c-color-1440").each(function () { clearColor($(this), "1440-"); }); $(".c-bg-1440").each(function () { clearBg($(this), "1440-"); }); $(".c-lh-1440").each(function () { clear_lh($(this), "1440-"); }); $(".c-fs-1440").each(function () { clear_fs($(this), "1440-"); }); $(".c-height-1440").each(function () { clear_height($(this), "1440-"); }); $(".c-width-1440").each(function () { clear_width($(this), "1440-"); }); $(".c-margin-1440").each(function () { clearMargin($(this), "1440-"); }); $(".c-padding-1440").each(function () { clearPadding($(this), "1440-"); }); $(".c-border-1440").each(function () { clearBorder($(this), "1440-"); }); $(".c-hover-1440").each(function () { clearHoverColor($(this),"1440-"); }); $(".c-max-height-1440").each(function () { clear_max_height($(this),"1440-"); }); $(".c-max-width-1440").each(function () { clear_max_width($(this),"1440-"); }); $(".c-min-height-1440").each(function () { clear_min_height($(this),"1440-"); }); $(".c-min-width-1440").each(function () { clear_min_width($(this),"1440-"); }); $(".c-hidden-1440").show(); $(".c-z-index-1440").each(function () { clearZIndex($(this),"1440-"); }); $(".c-relative-1440").each(function () { clearRelativePosition($(this),"1440-"); }); } function applyBelow1440(){ $(".c-width-below1440").each(function () { init_width($(this), "below1440-"); }); $(".c-max-width-below1440").each(function () { init_max_width($(this),"below1440-"); }); $(".c-min-width-below1440").each(function () { init_min_width($(this),"below1440-"); }); $(".c-margin-below1440").each(function () { initMargin($(this), "below1440-"); }); $(".c-padding-below1440").each(function () { initPadding($(this), "below1440-"); }); } function applyAbove1440(){ $(".c-width-above1440").each(function () { init_width($(this), "above1440-"); }); $(".c-max-width-above1440").each(function () { init_max_width($(this),"above1440-"); }); $(".c-min-width-above1440").each(function () { init_min_width($(this),"above1440-"); }); $(".c-margin-above1440").each(function () { initMargin($(this), "above1440-"); }); $(".c-padding-above1440").each(function () { initPadding($(this), "above1440-"); }); } function clearBelow1440(){ $(".c-width-below1440").each(function () { clear_width($(this), "below1440-"); }); $(".c-max-width-below1440").each(function () { clear_max_width($(this),"below1440-"); }); $(".c-min-width-below1440").each(function () { clear_min_width($(this),"below1440-"); }); $(".c-margin-below1440").each(function () { clearMargin($(this), "below1440-"); }); $(".c-padding-below1440").each(function () { clearPadding($(this), "below1440-"); }); } function clearAbove1440(){ //console.log("clear above1440"); $(".c-width-above1440").each(function () { clear_width($(this), "above1440-"); }); $(".c-max-width-above1440").each(function () { clear_max_width($(this),"above1440-"); }); $(".c-min-width-above1440").each(function () { clear_min_width($(this),"above1440-"); }); $(".c-margin-above1440").each(function () { clearMargin($(this), "above1440-"); }); $(".c-padding-above1440").each(function () { clearPadding($(this), "above1440-"); }); } var status = null; var status2 = null; applyGeneral(); if (window.innerWidth < 768) { applyMobile(); } else if (window.innerWidth < 1024) { applyPad(); } else { applyPC(); if(window.innerWidth >= 1280){ if(window.innerWidth < 1440) { apply1280(); }else{ apply1440(); } } if(window.innerWidth <= 1440){ applyBelow1440(); }else{ applyAbove1440(); } } $(window).resize(function () { //console.log("resizing.."); // console.log("status",status); if (window.innerWidth < 768) { if (status !== "mobile") { clearPad(); clearPC(); clear1280(); clear1440(); applyMobile(); applyGeneral(); status = "mobile"; } } else if (window.innerWidth < 1024) { if (status !== "pad") { clearMobile(); clearPC(); clear1280(); clear1440(); applyPad(); applyGeneral(); status = "pad"; } } else { if(window.innerWidth < 1280){ if (status !== "pc") { clearPad(); clearMobile(); clear1280(); clear1440(); applyPC(); applyGeneral(); status = "pc"; } } else{ if(window.innerWidth < 1440) { if(status!=='1280'){ clearPad(); clearMobile(); clear1440(); applyPC(); apply1280(); applyGeneral(); status = "1280"; } }else{ if(status!=='1440'){ clearPad(); clearMobile(); applyPC(); apply1280(); apply1440(); applyGeneral(); status = "1440"; } } } if(window.innerWidth <= 1440){ if(status2 !=="b1440") { applyBelow1440(); clearAbove1440(); status2="b1440"; } }else{ if(status2 !=="a1440") { clearBelow1440(); applyAbove1440(); status2="a1440"; } } } }); }); $(document).ready(function () { $(".menu-large .menu-column>.sub-menu, .footer-menu-container .footer-menu-two-column>.sub-menu").each(function () { let list = $(this).children(); list.slice(Math.ceil(list.length/2)).addClass("menu-column-col-2"); }) });$(document).ready(function () { /*two-columns and row*/ if (window.innerWidth < 768) { $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-on-mobile)[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-on-mobile)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { $(this).children(".wp-block-column:first").css({"margin-right": w + "px"}); } }); $(".wp-block-customized-gutenberg-blocks-row:not(.stack-on-mobile)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }); } else if (window.innerWidth < 1024) { $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-below-1024):not(.stack-below-1200)[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-below-1024):not(.stack-below-1200)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { $(this).children(".wp-block-column:first").css({"margin-right": w + "px"}); } }); $(".wp-block-customized-gutenberg-blocks-row:not(.stack-below-1024):not(.stack-below-1200)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }) } else if (window.innerWidth < 1200) { $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-below-1200)[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-below-1200)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { $(this).children(".wp-block-column:first").css({"margin-right": w + "px"}); } }); $(".wp-block-customized-gutenberg-blocks-row:not(.stack-below-1200)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }) } else if (window.innerWidth < 1280) { $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-below-1280)[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column:not(.stack-below-1280)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { $(this).children(".wp-block-column:first").css({"margin-right": w + "px"}); } }); $(".wp-block-customized-gutenberg-blocks-row:not(.stack-below-1280)[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }) } else { $(".wp-block-customized-gutenberg-blocks-two-column[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { $(this).children(".wp-block-column:first").css({"margin-right": w + "px"}); } }); $(".wp-block-customized-gutenberg-blocks-row[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }) } $(window).resize(function () { if (window.innerWidth < 768) { $(".wp-block-customized-gutenberg-blocks-two-column.stack-on-mobile[data-c-col-width]").each(function () { $(this).children(".wp-block-column:first").css({ "width": "", "flex-basis": "", "margin-right": 0 }); $(this).children(".wp-block-column:last").css({"width": "", "flex-basis": ""}); window._width_changed = true; }); } else if (window.innerWidth < 1024) { $(".wp-block-customized-gutenberg-blocks-two-column.stack-below-1024[data-c-col-width]").each(function () { $(this).children(".wp-block-column:first").css({ "width": "", "flex-basis": "", "margin-right": 0 }); $(this).children(".wp-block-column:last").css({"width": "", "flex-basis": ""}); window._width_changed = true; }); } else if (window.innerWidth < 1200) { $(".wp-block-customized-gutenberg-blocks-two-column.stack-below-1200[data-c-col-width]").each(function () { $(this).children(".wp-block-column:first").css({ "width": "", "flex-basis": "", "margin-right": 0 }); $(this).children(".wp-block-column:last").css({"width": "", "flex-basis": ""}); window._width_changed = true; }); } else if (window.innerWidth < 1280) { $(".wp-block-customized-gutenberg-blocks-two-column.stack-below-1280[data-c-col-width]").each(function () { $(this).children(".wp-block-column:first").css({ "width": "", "flex-basis": "", "margin-right": 0 }); $(this).children(".wp-block-column:last").css({"width": "", "flex-basis": ""}); window._width_changed = true; }); } else { if (window._width_changed) { $(".wp-block-customized-gutenberg-blocks-two-column.stack-on-mobile[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column.stack-on-mobile[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { $(this).children(".wp-block-column:first").css({"margin-right": w + "px"}); } }); $(".wp-block-customized-gutenberg-blocks-row.stack-on-mobile[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }); $(".wp-block-customized-gutenberg-blocks-two-column.stack-below-1024[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column.stack-below-1024[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { $(this).children(".wp-block-column:first").css({"margin-right": w + "px"}); } }); $(".wp-block-customized-gutenberg-blocks-row.stack-below-1024[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }); $(".wp-block-customized-gutenberg-blocks-two-column.stack-below-1200[data-c-col-width]").each(function () { var w = $(this).attr("data-c-col-width"); var r = 100 - w; $(this).children(".wp-block-column:first").css({"width": w + "%", "flex-basis": w + "%"}); $(this).children(".wp-block-column:last").css({"width": r + "%", "flex-basis": r + "%"}); }); $(".wp-block-customized-gutenberg-blocks-two-column.stack-below-1200[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }); $(".wp-block-customized-gutenberg-blocks-row.stack-below-1200[data-c-gap-width]").each(function () { var w = $(this).attr("data-c-gap-width"); if (w != 0) { if ($(this).hasClass('reversed')) { $(this).children(":not(:last)").css({"margin-left": w + "px"}); } else { $(this).children(":not(:last)").css({"margin-right": w + "px"}); } } }); } } }); /*title-collapse */ $(".wp-block-customized-gutenberg-blocks-title-collapse>.title-collapse-title").click(function () { //$(this).parent().siblings(".active").removeClass("active"); $(this).parent().toggleClass("active"); }); $(".wp-block-customized-gutenberg-blocks-image-title-collapse>.collapse-header").click(function () { $(this).parent().toggleClass("active"); }); /*editor blocks - wrapper*/ /* $(".wp-block-editor-blocks-wrapper.c-wrapper-inner-no-padding>.wrapper-inner").css("padding","0"); $(".wp-block-editor-blocks-wrapper.c-wrapper-inner-no-margin>.wrapper-inner").css("margin","0");*/ $(".wp-block-editor-blocks-wrapper.c-wrapper-inner-max-width").each(function () { var el = $(this); var c = el.attr("class"); var s = /\bc-wrapper-inner-max-width-[^ ]+/.exec(c); if (s) { var size = s[0].replace("c-wrapper-inner-max-width-", ""); el.children(".wrapper-inner").css("max-width", size); } }); /*column */ /* $(".wp-block-column.c-column-align-top").css({"display":"flex","flex-direction":"column","justify-content":"flex-start"}); $(".wp-block-column.c-column-align-bottom").css({"display":"flex","flex-direction":"column","justify-content":"flex-end"}); $(".wp-block-column.c-column-align-center").css({"display":"flex","flex-direction":"column","justify-content":"flex-center"}); $(".wp-block-column.c-column-align-space-between").css({"display":"flex","flex-direction":"column","justify-content":"flex-space-between"}); $(".wp-block-column.c-column-align-space-around").css({"display":"flex","flex-direction":"column","justify-content":"flex-space-around"}); $(".wp-block-column.c-column-align-top").css({"display":"flex","flex-direction":"column","justify-content":"flex-start"}); */ /*page title*/ (function () { var title_el = $("title.wp-block-customized-gutenberg-blocks-page-title"); if (title_el.length) { document.title = title_el.last().text(); } })(); /*feature Card in one row*/ $(".wp-block-customized-gutenberg-blocks-row").each(function () { var feature_cards = $(this).children(".wp-block-customized-gutenberg-blocks-feature-card"); if (feature_cards.length) { var title_height_max = 0; var titles = feature_cards.children(".container").children(".feature-card-title"); titles.each(function () { var h = $(this).height(); if (h > title_height_max) title_height_max = h; }); if (title_height_max > 0) titles.height(title_height_max); } }); /*cc-video*/ /*(function () { var attr_sel = (window.innerWidth < 768) ? "source-mobile" : "source-desktop"; $(".wp-block-customized-gutenberg-blocks-cc-video").each(function () { var el = $(this); var source = el.attr(attr_sel).trim(); var ratio = el.data("aspect"); var w = el.width(); var h = w * ratio; if (source) { el.html('