(function(){ var loadScript = function(url, callback){ var script = document.createElement("script"); script.type = "text/javascript"; if (script.readyState){ script.onreadystatechange = function(){ if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; callback(); } }; } else { script.onload = function(){ callback(); }; } script.src = url; document.getElementsByTagName("head")[0].appendChild(script); }; var fix = function($){
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
var myObserver = new MutationObserver(mutationHandler);
var obsConfig = { childList: true, characterData: true, attributes: false, subtree: true };
var is_updating = false;
window.customer_ip = "194.210.235.5";
var ev = new CustomEvent("ExemptifyLoaded");
function mutationHandler (mutationRecords)
{
//console.log(mutationRecords);
myObserver.disconnect();
setTimeout(function(){ checkAuth(); }, 300 );
}
function reconnectMutationHandler()
{
myObserver.observe (document, obsConfig);
}
var m4u_url = 'https://www.modules4u.biz/shopify/exemptify/';
var txts,text,vat;
var passive_mode = false;
var show_original_price = true;
var brackets = false;
var inc_vat_first = true;
var price_sep = (false) ? '
' : ' | ';
var no_line_break = 0;
var init_delay = 0;
if (typeof m4u_ptxt !== 'undefined')
ptxt = m4u_ptxt;
else
ptxt = 'inc VAT';
if(ptxt=='')
ptxt = '\u0020';
function setCookie()
{
document.cookie = "exemptify=authorized; path=/;";
}
function delCookie()
{
document.cookie = "exemptify=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
}
function getCookie()
{
var name = "exemptify=";
var ca = document.cookie.split(';');
for(var i = 0; i < ca.length; i++)
{
var c = ca[i].trim();
if(c.indexOf("exemptify=authorized")==0)
return true;
}
return false;
}
var cartDrawerArr = [
/* smile */
'#cart-box'
];
var drawersel = cartDrawerArr.join();
var selArr = [
/* Boundless */
'.product-item__price-wrapper,.product__price--reg.js-price,.js-price,.product-item__price--reg,.product__price--reg.on-sale',
/*Jumpstart & Minimal*/
'.grid-link__meta,.product-single__price,.cbb-price-digits,div.grid__item.one-third.text-right > span,.product-single__sale-price,.cart__subtotal-price,.grid-link__org_price',
/*Venture*/
'.product-card__price,.cart__item-total,.cart__subtotal,.product-card__regular-price,.dualPrice',
/*Simple*/
'.product__price,td[data-label="Price"] > span,.cart__table-cell--line-price > span,.product__price--on-sale,.sh-price-varies',
/*Classic*/
'.grid-link__meta > strong,div.grid__item.one-third > span',
/*Pop*/
'span#productPrice,.cart__original-price',
/*Brooklyn*/
'.cart__price,.grid-product__price,.ajaxcart__subtotal,.options-additional-item,.tb-cart-total-price,.tb-cart-price,.tb-ajaxcart__price',
/*Supply*/
'div.product-item--price small, div.grid-item.one-third.medium-down--one-third.medium-down--text-left.text-right small,span#bk-cart-subtotal-price small,.cart-original-price',
/*Label*/
'p.price,sspan[itemprop="price"],span.feature-copy,div.recolizePrice',
/*Classic*/
'span.money,.grid__item.large--one-fifth.large--display-table-cell.medium--two-thirds>strong',
/*Parallax*/
'span.price > span,span.current_price,p.subtotal_amount>strong,p.price_total,strong.price,span.was_price,span.snize-price',
/*Supply BOLD*/
'.medium-down--one-third.text-right>span.h2,span.h1.cart-subtotal--price,span.h1.cart-subtotal--price > small,.medium-down--one-third.text-right>span.h2>span.money,#productPrice-product-template > span,td[data-label=Price] span,td[data-label=Total] span,span.cart__subtotal span',
/*Debut*/
'.product-price__price,#ComparePrice-product-template,#ProductPrice-product-template,#ProductPrice-product-pre-order-template,.cart__price-wrapper.cart-flex-item,.text-right.small--hide>div,.price-item,.cart__price-wrapper,.cart__row>.text-right,.cart-subtotal__price,dd[data-cart-item-regular-price],span[data-cart-item-regular-price],.predictive-search-item__price',
/*Palo Alto*/
'h2#ProductPrice>span,h2#ProductPrice,span.h3.price,h3.cart__subtotal.price>span,s.reduced-price',
/*Canopy*/
'div.price.ftc>span.amount,div.product-price,div.cart-summary-subtotal>span.amount,span.price.ftc,div.price>h5,div.half.column.align-right>h2',
/*Dividio Widget*/
'.divido-widget-launcher>a',
/*InstantSearch*/
'.isp_price_compare_at_price_exist,.isp_section_header,.ui-autocomplete.ui-front.ui-menu.ui-widget.ui-widget-contentx.ui-corner-all',
/* RonDorff */
'.category__price,.js-article-price,.bag__counter__price',
/* Store984 */
'.so-cart-item-line-price,.so-cart-original-total',
/* Symmetry */
'span.price,h2.price-area>span.price,h2.price-area>span.current-price,div.line-total,h2.subtotal.h1-style',
/* Basel */
'.price>del,.price>ins,#old-product-price,#product-price,div.product-grid-item > span.price,span#product-price,span.shopify-Price-amount.amount',
/* Lorenza */
'.title.gridJustify span',
/* Sunrise*/
'span.price-money',
/* Taskhusy */
'#bk-cart-subtotal-price',
/* Split */
'#CartTotal > span,div.content>span.price',
/* CBT */
'td.product-price,td[data-label=Price]>strong,td.cart-line-price,p.cart-totals-accent>span',
/* Testament */
'.product-price,.prod-price,.cart-price,.cart-total,#basket-right>h4,.onsale,.was',
/* Shoptimized */
'.booster-cart-item-line-price,.wh-original-cart-total,.ls-message-param.money',
/* Custom*/
'.price_min,.price_max,.exemptify_h2',
/* Yourstore */
'.price-box > span,.shopping-cart-table__product-price,#subtotal>td,#grandtotal>td',
/* Embrava */
'h2.price,td.price,span.total>strong',
/* Narrative */
'.product__current-price,.card__price,.cart-item__price,.cart-footer__subtotal,.card__price--sale,.card__price--regular',
/* Gemini */
'.product-price--current,.product-info__price--current,td[data-label=Price],td[data-label=Total],.cart__total__value',
/* Elextron */
'.nt-product-item-price,td[data-label="Total"]>span,span#CartCost',
/* Buildify */
'.bdf-img-box-price > span',
/*Gecko*/
'.product-info>span.price,td.product-subtotal',
/* Prestige */
'.Price,.Price>span,button.Cart__Checkout>span,span.Cart__Total span,.ProductItem__PriceList',
/* Unero */
'.price-new > .amount,.product-subtotal > .amount',
/* Free shipping threshold */
'.content_threshold>strong>span.amount',
/* Hulkapps */
'.original_price,.ajaxcart__price,.discounted_price,.hulkapps-cart-original-total,.hulkapps-cart-total,.hulkapps-cart-item-price,.hulkapps-cart-item-line-price',
/* General */
'.product-price-wrap,.subtotal',
/* Ella */
'.regular-product span,.old-price,.special-price,.special-price>span,.total-price span,.fox-cart-item-line-price,.accessory-price',
/* Omega */
'div.price,span.compare-price,div.product--price span',
/* Ella */
'div.cart-collateral>span.price,p.total>span.price,.prices>.price,.info>.price',
/* Loft */
'p.product-price,.js-prod-price,.js-cart-item-price',
/* Impulse */
'.grid-product__price--original,.product__price-savings,.product-price__sale,.tb-product-compare-price',
/* Turbo */
'.price>.money,.item-pricing,.sale',
/* Kagami */
'.product-meta__price,.product-item__price,.mini-cart__total-price,.cart-item__subtotal,.cart__total,.mini-cart-item__line-price',
/* Empire */
'.money,.price--main>span',
/* Frontpage */
'.field-price,.total,.itemprice,.saw-cart-original-total',
/* Takoon */
'.price__value,.cart-menu__total-text',
/* Tony Templates */
'.full-total-js,.cart-total>span:not(.cart-qty),.new-price',
/* Venue */
'.hidePrice',
/* Pipeline */
'.buttonPrice',
/* California */
'h3.price',
/* Modular */
'.product-normal-price,.cart-product-total-price,.popover-item-price',
/* Streamline */
'.sale-price',
/* Request for Quote */
'.sc-shopify-qs-product-price',
/* Warehouse */
'.line-item__price,.cart-recap__price-line-price',
/* Legend*/
'.total-price',
/* Creative Monster */
'.cart-item-price,.cart-item-total',
/* Revolution Slider */
'.tdf-cart-item-p-p',
/* Buy Button */
'.shopify-buy__product__actual-price,.shopify-buy__cart-item__price,.shopify-buy__cart__subtotal__price',
'.ajaxcart__product-price',
/* Bold bundles */
'.bdl-product-price',
/* SWYM */
'.swym-price',
/* Boost Commerce */
'.bc-sf-filter-product-item-regular-price',
/* Shogun */
'.shg-product-price',
/* BCPO */
'.bcpo-cart-item-price,.bcpo-cart-item-line-price,.bcpo-cart-original-total',
/* Infinite Options */
'#calculated_option_total',
/* Bold Options */
'.hulkapps-cart-original-total>span',
/* Dynamic Product Options */
/* MW Options */
'.value-price',
'.price-notice',
/* Geolizr */
'.geolizr-currency',
/* Dummy */
'#dummy',
/* Exemptify */
'.exemptify_price',
/* Showcase */
'.showcase-grid,.showcase-grid-item,.showcase-grid-items,.theme-money',
/* Saso Cart*/
'.saso-cart-item-price,.saso-cart-item-line-price',
/* BC Filter */
'.bc-sf-product-regular-price',
/* Recharge */
'.rc_price_onetime,.rc_price',
/* Upsell */
'.rk-widget-card-price-money,.upsell-price-value',
/* Wiser Product Recommendations */
'.ws-card__price',
/* pagefly */
'.sc-pcLzI',
/* EcomSolid */
'.total_price_product,.number_total',
/* Boost PFS */
'.boost-pfs-search-suggestion-product-regular-price'
];
var sel = selArr.join();
window.exemptify_price_classes = sel;
function checkAuth()
{
if(is_updating)
return;
if(!getCookie())
m4uRequest(m4u_url+'exemptify.php','POST',{'action' : 'check_auth','shop':'glitzysecrets.myshopify.com'});
else
walkElems();
reconnectMutationHandler();
}
function m4uRequest(path,method,vals)
{
$.ajax({
url : path,
type : method,
crossDomain: true,
data : vals,
dataType:'json',
success : function(data)
{
setCookie();
walkElems();
},
error : function(request,error)
{ console.log('UNAUTHORIZED');$(sel).show(); }
});
}
function walkElems()
{
console.log('Exemptify triggered');
fixSup();
iterateContainerNodes();
fixItemprop();
}
window.ExemptifyTriggerUpdate = function()
{
checkAuth();
};
function fixSup()
{
var e = $('span[aria-hidden="true"] > sup,small[aria-hidden="true"] > sup');
e.each(function(){
var t = $(this).text();
$(this).replaceWith('.'+t);
});
$('span[aria-hidden="true"] > sup').replaceWith('.'+e.text());
}
function fixPrice(node)
{
ptxt = htmlentities(ptxt);
rate = (20/100)+1;
var matcher1;
var matcher2;
matcher_dot = /\d{1,3}(,\d{3})*(\.\d{1,2})?/;
matcher_comma = /\d{1,3}(\.\d{3})*(,\d{1,2})?/;
matcher_dot_simple = /(\d)*(\.)(\d{1,2})/;
matcher_comma_simple = /(\d)*(,)(\d{1,2})/;
var txt =node.data;
var txt_old = '';
var match=null;
var match_dot = txt.match(matcher_dot);
var match_comma = txt.match(matcher_comma);
var match_dot_simple = txt.match(matcher_dot_simple);
var match_comma_simple = txt.match(matcher_comma_simple);
if(match_dot!=null)
match_dot=match_dot[0];
if(match_comma!=null)
match_comma=match_comma[0];
if(match_dot_simple!=null)
match_dot_simple=match_dot_simple[0];
if(match_comma_simple!=null)
match_comma_simple=match_comma_simple[0];
/* no price > show original node, remove clone and exit */
if(match_dot==null && match_comma==null && match_dot_simple==null && match_comma_simple==null)
{
$(node.parentNode).show();
$(node.parentNode).next().remove();
return;
}
if(match_dot_simple==null)
match_dot_simple='';
if(match_comma_simple==null)
match_comma_simple='';
if(match_dot_simple.length > match_dot.length)
match_dot = match_dot_simple;
if(match_comma_simple.length > match_comma.length)
match_comma = match_comma_simple;
var dec_sep='.';
var group_sep =',';
match= match_dot;
if(match_comma.length > match_dot.length)
{
dec_sep=',';
group_sep ='.';
match =match_comma;
}
var price = match;
txt_old = txt;
var price_normalized = '';
if(dec_sep=='.')
price_normalized = price.replace(/,/g,'');
else
price_normalized = price.replace(/\./g,'');
price_normalized = price_normalized.replace(/,/g,'.');
var price_new = 0;
price_new = (price_normalized*rate).toFixed(2);
if(2 == 0 && 0 == 0)
price_new += '.00';
price_new = price_new.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
if(isNaN(price_normalized))
return;
if(dec_sep==',')
{
price_new = price_new.replace(/,/g,'#');
price_new = price_new.replace(/\./g,',');
price_new = price_new.replace(/#/g,'.');
}
txt = txt.replace(price, price_new);
if(show_original_price)
{
var expost = '';
if (m4u_ex_vat_postfix_txt != null)
expost = ' ' + m4u_ex_vat_postfix_txt;
var exp = txt_old + expost;
var incp = txt + ' '+ptxt;
if(brackets)
exp = '('+ exp + ')';
exp = ''+exp+'';
incp = ''+txt + ' '+ptxt+'';
if(inc_vat_first)
txt= incp + price_sep + exp;
else
txt= exp + price_sep + incp;
}
else
txt +=' '+ptxt;
if(no_line_break!=1)
txt += '
';
$(node.parentNode).next().html(txt);
}
function iterateContainerNodes()
{
is_updating = true;
var nodes_processed = {};
var j=0;
var start = Date.now();
$(sel).each(function(){
if( $(this).hasClass('exemptify_ignore') )
return;
var n = $(this).get();
for(var i=0;i=0)
return;
$(price_node).hide();
$(price_node).attr('style', 'display:none !important');
if($(price_node).parents('option').length==1)
$(clone).remove();
return node;
}
function fixItemprop()
{
var m = (20/100)+1;
function calcPrice(net)
{
return (net*m).toFixed(2);
}
$('[itemprop="price"][content]').each(function(){
var p = $(this).attr('content');
$(this).attr('content',calcPrice(p));
});
$('[itemprop="price"][value]').each(function(){
var p = $(this).attr('value');
$(this).attr('value',calcPrice(p));
});
}
function htmlentities(str)
{
str = str.replace('ö', 'ö');
str = str.replace('Ö', 'Ö');
str = str.replace('ä', 'ä');
str = str.replace('Ä', 'Ä');
str = str.replace('ü', 'ü');
str = str.replace('Ü', 'Ü');
return str;
}
$(document).ready(function(){
document.dispatchEvent(ev);
document.addEventListener('theme:loading:end',function(){
window.ExemptifyTriggerUpdate();
});
document.documentElement.addEventListener('cart:refresh',function(){
window.ExemptifyTriggerUpdate();
});
$('section[data-section-id="product-template"]').on('variant:changed',function(){
window.ExemptifyTriggerUpdate();
});
if(!passive_mode)
{
if(init_delay>0)
setTimeout(function(){checkAuth();},init_delay);
else
checkAuth();
reconnectMutationHandler();
}
$('a.quick-buy,a.sca-qv-button,#addToCartText-product-template').click(function()
{
checkAuth();
});
});
};if ((typeof jQuery === 'undefined') || (parseFloat(jQuery.fn.jquery) < 1.7)) {loadScript("//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js", function(){ jQuery191 = jQuery.noConflict(true);fix(jQuery191);});} else {fix(jQuery);}})();