var ZAPB = {}; window.za_country_code="US"; window.za_state_code="OH"; window.za_ip="3.19.238.155"; ZAPB.rules = JSON.parse('[]'); ZAPB.variants = JSON.parse('[]'); ZAPB.secret_link = ""; ZAPB.lock_urls = JSON.parse('[]'); ZAPB.shop_name = 'dreambigbraveone'; ZAPB.ana_btn = '<button id="ZAPB_block_variant" class="unavailable_design" type="button"> UNAVAILABLE TO CART</button> <style> .unavailable_design{ text-align: center; width: 100%; line-height: 1.4; padding-left: 5px; padding-right: 5px; white-space: normal; margin-top: 0; margin-bottom: 10px; min-height: 44px; background: #ffffff21; color: #3a3a3a !important; border: 1px solid #3a3a3a; font-size: 14px; font-weight: 600; } .ZAPB_block_class:before { content: " "; position: absolute; top: 0; left: 0; bottom: 0; right: 0; z-index: 999999; /*cursor: not-allowed;*/ } .ZAPB_block_class { opacity: 0.5; position: relative; } </style>'; ZAPB.bar_template = '<style> .ZAPB_bar_template_content{ min-height: 40px; } .ZAPB_bar_template_content .ZAPB_bar_template{ background-repeat: no-repeat; background-size: cover; background-position: center; position: fixed; top: 0; width: 100%; z-index: 9999; align-items: center; text-align: center; background-color: #000; } .ZAPB_bar_template_content .ZAPB_bar_template p { font-size: 16px; color: #fff; } </style> <div class="ZAPB_bar_template_content"> <div class="ZAPB_bar_template"> <div class="ZAPB_bar_template"> <p style="margin: 0; padding: 5px;"></p> </div> </div> </div>'; ZAPB.display_message = JSON.parse('null'); ZAPB.custom_css = ''; window.setCookie=function(e,t,n){var o=new Date;o.setTime(o.getTime()+24*n*60*60*1e3);var i="expires="+o.toGMTString();document.cookie=e+"="+t+";"+i+";path=/"},window.getCookie=function(e){for(var t=e+"=",n=decodeURIComponent(document.cookie).split(";"),o=0;o<n.length;o++){for(var i=n[o];" "==i.charAt(0);)i=i.substring(1);if(0==i.indexOf(t))return i.substring(t.length,i.length)}return""}; var xhttp = new XMLHttpRequest; xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var resp = JSON.parse(xhttp.responseText); if(typeof(resp[window.za_ip]) !== "undefined") { ZAPB.proxy = resp[window.za_ip]['proxy']; } } }; xhttp.open("GET", "https://proxycheck.zend-apps.com/"+window.za_ip+".js", true); xhttp.send(); ZAPB.ScriptMaker=function(e,t){var a=document.createElement("script");a.type="text/javascript",a.src=e,""!=t&&(a.onload=t),document.getElementsByTagName("head")[0].appendChild(a)}; ZAPB.FindBase=function(n,r){return 1<n('a[href*="/products/"]',r.parent()).has('img[src*="/products/"] , img[src*="/no-image"]').length||50<r.parent().width()-r.width()?r:ZAPB.FindBase(n,r.parent())}; function ZAPB_CustomCss(){ jQuery('head').append("<style id='ZAPB_custom_css'>"+ZAPB.custom_css+"</style>"); } var page_u = location.href.split('/'); ZAPB.prod_handle = page_u[page_u.length - 1].split('?')[0]; var var_url = location.href.split('variant='); ZAPB.var_id = var_url[var_url.length -1]; selected_ver_id = (location.href).split('?variant='); selected_ver_id = selected_ver_id[0].split('?_pos='); window.handle = selected_ver_id[0].split(Shopify.shop+'/products/'); blocked_products_len = []; ZAPB.check_and_block_products = function(rule) { var blocked_products = []; if (rule.products.length !== 0) { jQuery.each(rule.products, function(j, k) { blocked_products.push(k.handle); blocked_products_len.push(k.handle); }); } var a, i, n, o, s, t, c; o = jQuery('a[href*="/products/"]'); t = 0; while (t < o.length) { i = o.eq(t); n = i.attr('href').split('/'); a = n[n.length - 1].split('?')[0]; s = i.parent(); try{ s = ZAPB.FindBase(jQuery, i.parent()); }catch (e) {} if(Shopify.theme.name == 'Ride'){ s = i.parents(".grid__item"); } jQuery.each(blocked_products, function(index, ele) { if (a === ele || a === encodeURI(ele)) { if(s.parents("#NavDrawer").length<1 && s.attr('id') !== "NavDrawer") { s.addClass('zapb-blocker-product'); } } }); ++t; } jQuery(".zapb-blocker-product").remove(); var prod_handle = ZAPB.prod_handle; if(page_u[page_u.length - 2] !== 'collections') { jQuery.each(blocked_products, function (i, ele) { if (prod_handle === ele || prod_handle === encodeURI(ele)) { jQuery('input[name="add"],button[name="add"]').remove(); try { location.href = location.origin + "/collections/all"; } catch (e) {} } }); } }; function countrieswise_url_block(){ blocked_urls = []; jQuery.each(ZAPB.lock_urls, function(i, ele) { var url_c_code = ele.country; if (jQuery.inArray(window.za_country_code, url_c_code.split(',')) !== -1 || jQuery.inArray("AC", url_c_code.split(',')) !== -1 ) { blocked_urls.push(ele.lock_url); } }); var locket_loc = window.location.href; var current_url = locket_loc.toString(); if(jQuery.inArray(current_url, blocked_urls) != -1) { if(current_url != 'https://'+ZAPB.shop_name+'.myshopify.com/collections/all'){ location.href = 'https://'+ZAPB.shop_name+'.myshopify.com/collections/all'; }else{ location.href = 'https://'+ZAPB.shop_name+'.myshopify.com'; } } } ZAPB.checkAndBlockVariants = function(variant) { var blocked_var = []; jQuery.each(variant, function(i, v) { var variant_id = parseInt(ZAPB.var_id); blocked_var.push(v.variant_id); }); if (typeof(meta) != "undefined" && meta.page.pageType == 'product') { if (Shopify.theme.name == "Dawn" || Shopify.theme.name == "PS Dawn" || Shopify.theme.name == "Copy of Dawn") { ZAPB.form = jQuery(document).find("form[action^='/cart/add']:last"); } else { ZAPB.form = jQuery(document).find("form[action^='/cart/add']:first"); } ZAPB.atc_btn = ZAPB.form.find(":input[name='add']:first"); v_btn = jQuery('#ZAPB_block_variant'); if(v_btn.length == 0) { jQuery(ZAPB.atc_btn).before(ZAPB.ana_btn); } if (Shopify.theme.name == "Dawn" || Shopify.theme.name == "PS Dawn" || Shopify.theme.name == "Copy of Install-me-wokiee-v-2-0-3 //// - fixed" || Shopify.theme.name == "Roterunner 4.0.6 - 0423" || Shopify.theme.name == "Vodoma Beachwear" || Shopify.theme.name == "Copy of Dawn") { current_v_id = ZAPB.form.find('input[name=id]').val(); if(current_v_id != undefined) { sel_vals = parseInt(current_v_id); } else { window.location.reload(true); } }else{ sel_vals = parseInt(ZAPB.form.find('select[name="id"] > option:selected').val()); } DefualtBlockVariants(sel_vals); function DefualtBlockVariants(sel_vals) { buy_now_sel = '.shopify-payment-button'; if(jQuery.inArray(sel_vals, blocked_var) != -1){ ZAPB.atc_btn.css('display', 'none'); jQuery('#ZAPB_block_variant').css('display', 'block'); jQuery(buy_now_sel).addClass('ZAPB_block_class'); }else{ jQuery('#ZAPB_block_variant').css('display', 'none'); jQuery(buy_now_sel).removeClass('ZAPB_block_class'); } } } }; function countrieswise_sections() { ZAPB.sections = JSON.parse('[]'); ZAPB.sections.forEach(function(ele, ind) { var sec_count = ele.country; var sections_country = sec_count.split(','); if(ele.block_type == 'state' && typeof(ele.block_type)){ current_country = ele.states.country; if (za_country_code == current_country) { var s_s_code = ele.states.state; if (jQuery.inArray(window.za_state_code, s_s_code.split(',')) !== -1) { section_display(ele); } } }else{ if(sections_country.indexOf(window.za_country_code) != -1 || sections_country.indexOf("AC") != -1 ) { section_display(ele); } } }); function section_display(ele) { var display = ele.display_type; if(display == 'hide'){ classes1 = ele.section_class; sec_content1 = classes1.split(','); sec_content1.forEach(function(e, i) { jQuery('head').append("<style>"+e+"{display:none !important;}</style>"); }); }else{ classes2 = ele.section_class; sec_content2 = classes2.split(','); sec_content2.forEach(function(e, i) { jQuery('head').append("<style>"+e+"{display:block !important;}</style>"); }); } }} function ZAPB_DisplayMessage() { if(typeof(ZAPB.display_message) != "undefined" && ZAPB.display_message !== null) { if(typeof(ZAPB.display_message['status']) != "undefined" && ZAPB.display_message['status'] == 1) { setTimeout(function() { if(blocked_products_len.length != 0){ jQuery('body').prepend(ZAPB.bar_template); } }, 1000); } } } function ZAPB_Warning(){ ZAPB.warning_messages = JSON.parse('[]'); ZAPB.warning_template = '<style> .zapb-warning-is-visible{ visibility: hidden; display: none; } .warning-pb-modal-content{ border-radius: 1.25rem; position: relative; display: flex; flex-direction: column; width: 100%; pointer-events: auto; background-color: #fff; background-clip: padding-box; border: 1px solid rgba(0, 0, 0, 0.2); border-radius: 0.3rem; outline: 0; } #warning_popup_overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(82, 82, 82, 0.77); filter:alpha(opacity=70); z-index: 100001; } .warning_pb_popup_content a{ display: block; text-decoration: none; } .warning_pb_popup{ width: 100%; margin: 0 auto; display: block; position: fixed; z-index: 100001; } .warning_pb_popup_content{ min-width: 32rem; width: 32rem; min-height: 150px; margin: 100px auto; position: relative; z-index: 103; border-radius: 1.25rem; box-shadow: 0 2px 5px #747474; } .warning_pb_popup_bg { background: #ffffff; } @media (max-width: 767px) { .warning_pb_popup_content{ min-width: 300px; width: 300px; } } .close_btn_style { position: absolute; top: 0; right: 0; margin: 14px; padding: 5px; box-sizing: content-box; width: 1em; height: 1em; padding: 0.25em 0.25em; color: #000; border: 0; border-radius: 0.75rem; opacity: 1; background-color: #d90000; clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%); } .warning-pb-modal-body-content { padding: 1.875rem; position: relative; flex: 1 1 auto; padding: 1rem; text-align: center; } .warning-pb-modal-body-content .warn_toggle { border: 0; cursor: pointer; padding: 10px 20px; text-transform: capitalize; border-radius: 40px; margin: 5px; box-shadow: 2px 2px 9px #33333354; min-width: 80px; font-size: 16px; transition: all 0.6s; } .warning_pb_modal-header-style{ padding: 1em 1em 0em 1em; } .warning_pb_heading-style h3{ margin-bottom: 10px; } .warning_pb_modal-header img{ width: 80px; } .warning_pb_modal-header .warning_pb-modal-heading{ font-size: 24px; color: #050101; } .warning_pb_modal_body .warn_msg{ font-size: 16px; color: #4d4d4d; } .warning_pb_modal_body button.warn_toggle_ok{ color: #ffffff; background-color: #000000; } .warning_pb_modal_body button.warn_toggle_ok:hover{ background-color: #008209; } .warning_pb_modal_body button.warn_toggle_cancel{ color: #ffffff; background-color: #000000; } .warning_pb_modal_body button.warn_toggle_cancel:hover{ background-color: #d60700; } .warning-pb-modal-body-content.pb-my-2{ margin: 10px 0px; } </style> <div id="warning_popup_overlay" class="zapb-warning-is-visible"> <div class="warning_pb_popup zapb-warning-is-visible"> <div class="warning_pb_popup_content warning-pb-modal-content warning_pb_popup_bg"> <div class="warning-pb-modal-body-content"> <div class="warning_pb_modal-header warning_pb_modal-header-style"> <img src="https://geoip-product-blocker.zend-apps.com/img/warnings/3.png" class="" alt="Warning Icon" style="display: initial;"> <h3 class="warning_pb-modal-heading">Product Warning</h3> </div> <div class="warning_pb_modal_body"> <p class="warn_msg"></p> <button type="button" class="prod_warning_close warn_toggle warn_toggle_cancel">Cancel</button> <button type="button" class="warn_toggle warn_toggle_ok">Confirm</button> </div> </div> <a href="javascript:void(0)" class="close_btn_style prod_warning_close"></a> </div> </div> </div> '; ZAPB.warning_type = 'popup'; function Show_Product_Warning_Popup() { jQuery(document).find('.warn_toggle_ok').on('click', function() { jQuery(document).find('.warning_pb_popup, #warning_popup_overlay').toggleClass('zapb-warning-is-visible'); var allow_checkout = '0'; if(allow_checkout == 1) { if(jQuery(ZAPB.clicked_btn).hasClass('ZAPB_cloned_buy_now') == true) { jQuery('.ZAPB_original_buy_now').trigger('click'); } else { jQuery(ZAPB.clicked_btn).trigger('click'); } } else { jQuery(".warning_pb_popup_content .prod_warning_close").trigger('click'); } ZAPB.is_btn_clicked = false; jQuery(document).find('.warning_pb_popup, #warning_popup_overlay').addClass('zapb-warning-is-visible'); }); } function ZAPB_Product_Warning_init(){ ZAPB.is_btn_clicked = false; ZAPB.clicked_btn = false; var form_init = "form[action^='/cart/add']:last"; var form_btn = ":input[type='submit']"; jQuery(document).on("click", form_init+" .ZAPB_cloned_buy_now, "+form_init+" "+form_btn, function(e) { ZAPB.clicked_btn = $(this); jQuery(document).find('.warning_pb_popup, #warning_popup_overlay').toggleClass('zapb-warning-is-visible'); if(ZAPB.is_btn_clicked == false) { e.preventDefault(); ZAPB.is_btn_clicked = true; } }); var zend_clone_btn_checker = setInterval(function(){ if(jQuery("form[action^='/cart/add']:last .ZAPB_cloned_buy_now").length <= 0) { CloneBuyNowButton(); clearInterval(zend_clone_btn_checker); } }, 800); } function CloneBuyNowButton(){ var buy_button = jQuery("form[action^='/cart/add']:last").find(".shopify-payment-button__button"); if(buy_button.length > 0) { var clone_button = buy_button.clone(); buy_button.addClass("ZAPB_original_buy_now"); buy_button.css('display','none'); clone_button.addClass('ZAPB_cloned_buy_now'); clone_button.css('display','block'); buy_button.after(clone_button); } } var WarningIntervalStart = setInterval(function(){ var page_type = meta.page.pageType; if(typeof(meta) != "undefined" && meta.page.pageType == 'product'){ jQuery.each(ZAPB.warning_messages, function(i, ele) { if(ele.block_type == 'state' && typeof(ele.block_type)){ current_country = ele.states.country; if(window.za_country_code == current_country){ var s_code = ele.states.state; if (jQuery.inArray(window.za_state_code, s_code.split(', ')) !== -1) { checkWarning(ele.warnings); } } }else{ var c_code = ele.country; if (jQuery.inArray(window.za_country_code, c_code.split(',')) !== -1 || jQuery.inArray("AC", c_code.split(',')) !== -1) { checkWarning(ele.warnings); } } }); function checkWarning(warning){ jQuery.each(warning, function(ind, data){ if(data.handle == window.handle[1] || encodeURI(data.handle) === window.handle[1]){ if(jQuery('.warning_pb_modal_body .warn_msg').length <= 0){ if(ZAPB.warning_type == 'popup'){ jQuery('body').append(ZAPB.warning_template); }else{ var descform = "form[action^='/cart/add']:last"; jQuery(descform).append(ZAPB.warning_template); } jQuery(".warning_pb_modal_body .warn_msg").append(data.war_msg); var show_warn_once = '0'; if(show_warn_once == 1){ if(window.getCookie("ZAPB_show_warn_once") == "") { document.cookie = "ZAPB_show_warn_once=true"; ZAPB_Product_Warning_init(); } }else{ ZAPB_Product_Warning_init(); } } Show_Product_Warning_Popup(); jQuery(".warning_pb_popup_content .prod_warning_close" ).click(function() { jQuery(".warning_pb_popup, #warning_popup_overlay").addClass("zapb-warning-is-visible"); ZAPB.is_btn_clicked = false }); } }); } } if(page_type){ clearInterval(WarningIntervalStart); } }, 500); } var ZAPB_ready = function(){ ZAPB.checkAllConditions = function() { jQuery.each(ZAPB.rules, function(i, ele) { if (ZAPB.proxy==='yes' && ele.vpn_block==1){ ZAPB.check_and_block_products(ele); }else{ var block_type = ele.block_type; if (block_type == 'state') { current_country = ele.states.country; if (za_country_code == current_country) { var s_code = ele.states.state; if (jQuery.inArray(window.za_state_code, s_code.split(', ')) !== -1) { ZAPB.check_and_block_products(ele); } } } var c_code = ele.country; if (jQuery.inArray(window.za_country_code, c_code.split(',')) !== -1 || jQuery.inArray("AC", c_code.split(',')) !== -1) { ZAPB.check_and_block_products(ele); } } }); }; ZAPB.checkAllVariantCondition = function() { blocked_variants = []; jQuery.each(ZAPB.variants, function(i, ele) { if (ZAPB.proxy==='yes' && ele.vpn_block==1){ jQuery.each(ele.variants, function(i, variant) { blocked_variants.push(variant); }); }else{ var block_type1 = ele.block_type; if (block_type1 == 'state'){ current_country1 = ele.states.country; if (za_country_code == current_country1) { var v_s_code = ele.states.state; if (jQuery.inArray(window.za_state_code, v_s_code.split(',')) !== -1) { jQuery.each(ele.variants, function(i, variant) { blocked_variants.push(variant); }); } } } var var_c_code = ele.country; if(jQuery.inArray(window.za_country_code, var_c_code.split(',')) !== -1 || jQuery.inArray("AC", var_c_code.split(',')) !== -1 ){ jQuery.each(ele.variants, function(i, variant) { blocked_variants.push(variant); }); } } }); ZAPB.checkAndBlockVariants(blocked_variants); }; let searchParams2 = new URLSearchParams(window.location.search); if (searchParams2.has('zend-secret-code') == true){ window.param2 = searchParams2.get('zend-secret-code'); } window.par1 = ZAPB.secret_link; if (typeof window.param2 !== 'undefined') { window.par2 = window.btoa(String(parseInt(window.param2))); } if (window.par1 == window.par2) { var prod = window.par1; if(prod != 'undefined'){ window.setCookie('product_blocker_cookie', prod, 1); } }else{ var cookie_value = window.getCookie('product_blocker_cookie'); if(!cookie_value){ ZAPB_CustomCss(); setInterval(function(){ZAPB.checkAllConditions()},1e3); countrieswise_url_block(); countrieswise_sections(); ZAPB_DisplayMessage(); ZAPB_Warning(); setInterval(function(){ZAPB.checkAllVariantCondition()},800); } } }; "undefined"==typeof jQuery?ZAPB.ScriptMaker("//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js",ZAPB_ready):ZAPB_ready(); 