/* * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ jQuery.cookie = function(b, j, m) { if (typeof j != "undefined") { m = m || {}; if (j === null) { j = ""; m.expires = -1 } var e = ""; if (m.expires && (typeof m.expires == "number" || m.expires.toUTCString)) { var f; if (typeof m.expires == "number") { f = new Date(); f.setTime(f.getTime() + (m.expires * 24 * 60 * 60 * 1000)) } else { f = m.expires } e = "; expires=" + f.toUTCString() } var l = m.path ? "; path=" + (m.path) : ""; var g = m.domain ? "; domain=" + (m.domain) : ""; var a = m.secure ? "; secure" : ""; document.cookie = [b, "=", encodeURIComponent(j), e, l, g, a].join("") } else { var d = null; if (document.cookie && document.cookie != "") { var k = document.cookie.split(";"); for (var h = 0; h < k.length; h++) { var c = jQuery.trim(k[h]); if (c.substring(0, b.length + 1) == (b + "=")) { d = decodeURIComponent(c.substring(b.length + 1)); break } } } return d } }; /* * Currency tools * * Copyright (c) 2014 Caroline Schnapp (mllegeorgesand@gmail.com) * Licensed under the MIT license: * http://www.opensource.org/licenses/mit-license.php * */ var mlvedaCurrencyintervalflag = true; var mlvedaCurrencyinterval = setInterval(function () { if (typeof window.Currency !== "undefined" && mlvedaCurrencyintervalflag) { clearInterval(mlvedaCurrencyinterval); mlvedaCurrencyintervalflag = false; function mlvedaCookieInitialize() { jQuery.cookie = function(b, j, m) { if (typeof j != "undefined") { m = m || {}; if (j === null) { j = ""; m.expires = -1 } var e = ""; if (m.expires && (typeof m.expires == "number" || m.expires.toUTCString)) { var f; if (typeof m.expires == "number") { f = new Date(); f.setTime(f.getTime() + (m.expires * 24 * 60 * 60 * 1000)) } else { f = m.expires } e = "; expires=" + f.toUTCString() } var l = m.path ? "; path=" + (m.path) : ""; var g = m.domain ? "; domain=" + (m.domain) : ""; var a = m.secure ? "; secure" : ""; document.cookie = [b, "=", encodeURIComponent(j), e, l, g, a].join("") } else { var d = null; if (document.cookie && document.cookie != "") { var k = document.cookie.split(";"); for (var h = 0; h < k.length; h++) { var c = jQuery.trim(k[h]); if (c.substring(0, b.length + 1) == (b + "=")) { d = decodeURIComponent(c.substring(b.length + 1)); break } } } return d } if (typeof jQuery.cookie === "undefined") { } ; } } Currency.cookie = {configuration: {path: "/", domain: window.location.hostname}, name: "acscurrency", write: function(a) { if (typeof jQuery.cookie === "undefined") { mlvedaCookieInitialize(); } jQuery.cookie(this.name, a, this.configuration) }, read: function() { if (typeof jQuery.cookie === "undefined") { mlvedaCookieInitialize(); } return jQuery.cookie(this.name) }, destroy: function() { if (typeof jQuery.cookie === "undefined") { mlvedaCookieInitialize(); } jQuery.cookie(this.name, null, this.configuration) }}; Currency.moneyFormats = {USD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} USD"}, EUR: {money_format: "€{{amount}}", money_with_currency_format: "€{{amount}} EUR"}, GBP: {money_format: "£{{amount}}", money_with_currency_format: "£{{amount}} GBP"}, CAD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} CAD"}, ALL: {money_format: "Lek {{amount}}", money_with_currency_format: "Lek {{amount}} ALL"}, DZD: {money_format: "DA {{amount}}", money_with_currency_format: "DA {{amount}} DZD"}, AOA: {money_format: "Kz{{amount}}", money_with_currency_format: "Kz{{amount}} AOA"}, ARS: {money_format: "${{amount_with_comma_separator}}", money_with_currency_format: "${{amount_with_comma_separator}} ARS"}, AMD: {money_format: "{{amount}} AMD", money_with_currency_format: "{{amount}} AMD"}, AWG: {money_format: "Afl{{amount}}", money_with_currency_format: "Afl{{amount}} AWG"}, AUD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} AUD"}, BBD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} Bds"}, AZN: {money_format: "m.{{amount}}", money_with_currency_format: "m.{{amount}} AZN"}, BDT: {money_format: "Tk {{amount}}", money_with_currency_format: "Tk {{amount}} BDT"}, BSD: {money_format: "BS${{amount}}", money_with_currency_format: "BS${{amount}} BSD"}, BHD: {money_format: "{{amount}}0 BD", money_with_currency_format: "{{amount}}0 BHD"}, BYR: {money_format: "Br {{amount}}", money_with_currency_format: "Br {{amount}} BYR"}, BZD: {money_format: "BZ${{amount}}", money_with_currency_format: "BZ${{amount}} BZD"}, BTN: {money_format: "Nu {{amount}}", money_with_currency_format: "Nu {{amount}} BTN"}, BAM: {money_format: "KM {{amount_with_comma_separator}}", money_with_currency_format: "KM {{amount_with_comma_separator}} BAM"}, BRL: {money_format: "R$ {{amount_with_comma_separator}}", money_with_currency_format: "R$ {{amount_with_comma_separator}} BRL"}, BOB: {money_format: "Bs{{amount_with_comma_separator}}", money_with_currency_format: "Bs{{amount_with_comma_separator}} BOB"}, BWP: {money_format: "P{{amount}}", money_with_currency_format: "P{{amount}} BWP"}, BND: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} BND"}, BGN: {money_format: "{{amount}} лв", money_with_currency_format: "{{amount}} лв BGN"}, MMK: {money_format: "K{{amount}}", money_with_currency_format: "K{{amount}} MMK"}, KHR: {money_format: "KHR{{amount}}", money_with_currency_format: "KHR{{amount}}"}, KYD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} KYD"}, XAF: {money_format: "FCFA{{amount}}", money_with_currency_format: "FCFA{{amount}} XAF"}, CLP: {money_format: "${{amount_no_decimals}}", money_with_currency_format: "${{amount_no_decimals}} CLP"}, CNY: {money_format: "¥{{amount}}", money_with_currency_format: "¥{{amount}} CNY"}, COP: {money_format: "${{amount_with_comma_separator}}", money_with_currency_format: "${{amount_with_comma_separator}} COP"}, CRC: {money_format: "₡ {{amount_with_comma_separator}}", money_with_currency_format: "₡ {{amount_with_comma_separator}} CRC"}, HRK: {money_format: "{{amount_with_comma_separator}} kn", money_with_currency_format: "{{amount_with_comma_separator}} kn HRK"}, CZK: {money_format: "{{amount_with_comma_separator}} Kč", money_with_currency_format: "{{amount_with_comma_separator}} Kč"}, DKK: {money_format: "{{amount_with_comma_separator}}", money_with_currency_format: "kr.{{amount_with_comma_separator}}"}, DOP: {money_format: "RD$ {{amount_with_comma_separator}}", money_with_currency_format: "RD$ {{amount_with_comma_separator}}"}, XCD: {money_format: "${{amount}}", money_with_currency_format: "EC${{amount}}"}, EGP: {money_format: "LE {{amount}}", money_with_currency_format: "LE {{amount}} EGP"}, ETB: {money_format: "Br{{amount}}", money_with_currency_format: "Br{{amount}} ETB"}, XPF: {money_format: "{{amount_no_decimals_with_comma_separator}} XPF", money_with_currency_format: "{{amount_no_decimals_with_comma_separator}} XPF"}, FJD: {money_format: "${{amount}}", money_with_currency_format: "FJ${{amount}}"}, GMD: {money_format: "D {{amount}}", money_with_currency_format: "D {{amount}} GMD"}, GHS: {money_format: "GH₵{{amount}}", money_with_currency_format: "GH₵{{amount}}"}, GTQ: {money_format: "Q{{amount}}", money_with_currency_format: "{{amount}} GTQ"}, GYD: {money_format: "G${{amount}}", money_with_currency_format: "${{amount}} GYD"}, GEL: {money_format: "{{amount}} GEL", money_with_currency_format: "{{amount}} GEL"}, HNL: {money_format: "L {{amount}}", money_with_currency_format: "L {{amount}} HNL"}, HKD: {money_format: "${{amount}}", money_with_currency_format: "HK${{amount}}"}, HUF: {money_format: "{{amount_no_decimals_with_comma_separator}}", money_with_currency_format: "{{amount_no_decimals_with_comma_separator}} Ft"}, ISK: {money_format: "{{amount_no_decimals}} kr", money_with_currency_format: "{{amount_no_decimals}} kr ISK"}, INR: {money_format: "₹ {{amount}}", money_with_currency_format: "₹ {{amount}}"}, IDR: {money_format: "{{amount_with_comma_separator}}", money_with_currency_format: "Rp {{amount_with_comma_separator}}"}, ILS: {money_format: "{{amount}} NIS", money_with_currency_format: "{{amount}} NIS"}, JMD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} JMD"}, JPY: {money_format: "¥{{amount_no_decimals}}", money_with_currency_format: "¥{{amount_no_decimals}} JPY"}, JEP: {money_format: "£{{amount}}", money_with_currency_format: "£{{amount}} JEP"}, JOD: {money_format: "{{amount}}0 JD", money_with_currency_format: "{{amount}}0 JOD"}, KZT: {money_format: "{{amount}} KZT", money_with_currency_format: "{{amount}} KZT"}, KES: {money_format: "KSh{{amount}}", money_with_currency_format: "KSh{{amount}}"}, KWD: {money_format: "{{amount}}0 KD", money_with_currency_format: "{{amount}}0 KWD"}, KGS: {money_format: "лв{{amount}}", money_with_currency_format: "лв{{amount}}"}, LVL: {money_format: "Ls {{amount}}", money_with_currency_format: "Ls {{amount}} LVL"}, LBP: {money_format: "L£{{amount}}", money_with_currency_format: "L£{{amount}} LBP"}, LTL: {money_format: "{{amount}} Lt", money_with_currency_format: "{{amount}} Lt"}, MGA: {money_format: "Ar {{amount}}", money_with_currency_format: "Ar {{amount}} MGA"}, MKD: {money_format: "ден {{amount}}", money_with_currency_format: "ден {{amount}} MKD"}, MOP: {money_format: "MOP${{amount}}", money_with_currency_format: "MOP${{amount}}"}, MVR: {money_format: "Rf{{amount}}", money_with_currency_format: "Rf{{amount}} MRf"}, MXN: {money_format: "$ {{amount}}", money_with_currency_format: "$ {{amount}} MXN"}, MYR: {money_format: "RM{{amount}} MYR", money_with_currency_format: "RM{{amount}} MYR"}, MUR: {money_format: "Rs {{amount}}", money_with_currency_format: "Rs {{amount}} MUR"}, MDL: {money_format: "{{amount}} MDL", money_with_currency_format: "{{amount}} MDL"}, MAD: {money_format: "{{amount}} dh", money_with_currency_format: "Dh {{amount}} MAD"}, MNT: {money_format: "{{amount_no_decimals}} ₮", money_with_currency_format: "{{amount_no_decimals}} MNT"}, MZN: {money_format: "{{amount}} Mt", money_with_currency_format: "Mt {{amount}} MZN"}, NAD: {money_format: "N${{amount}}", money_with_currency_format: "N${{amount}} NAD"}, NPR: {money_format: "Rs{{amount}}", money_with_currency_format: "Rs{{amount}} NPR"}, ANG: {money_format: "ƒ{{amount}}", money_with_currency_format: "{{amount}} NAƒ"}, NZD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} NZD"}, NIO: {money_format: "C${{amount}}", money_with_currency_format: "C${{amount}} NIO"}, NGN: {money_format: "₦{{amount}}", money_with_currency_format: "₦{{amount}} NGN"}, NOK: {money_format: "kr {{amount_with_comma_separator}}", money_with_currency_format: "kr {{amount_with_comma_separator}} NOK"}, OMR: {money_format: "{{amount_with_comma_separator}}0 OMR", money_with_currency_format: "{{amount_with_comma_separator}}0 OMR"}, PKR: {money_format: "Rs.{{amount}}", money_with_currency_format: "Rs.{{amount}} PKR"}, PGK: {money_format: "K {{amount}}", money_with_currency_format: "K {{amount}} PGK"}, PYG: {money_format: "Gs. {{amount_no_decimals_with_comma_separator}}", money_with_currency_format: "Gs. {{amount_no_decimals_with_comma_separator}} PYG"}, PEN: {money_format: "S/. {{amount}}", money_with_currency_format: "S/. {{amount}} PEN"}, PHP: {money_format: "₱{{amount}}", money_with_currency_format: "₱{{amount}} PHP"}, PLN: {money_format: "{{amount_with_comma_separator}} zl", money_with_currency_format: "{{amount_with_comma_separator}} zl PLN"}, QAR: {money_format: "QAR {{amount_with_comma_separator}}", money_with_currency_format: "QAR {{amount_with_comma_separator}}"}, RON: {money_format: "{{amount_with_comma_separator}} lei", money_with_currency_format: "{{amount_with_comma_separator}} lei RON"}, RUB: {money_format: "руб{{amount_with_comma_separator}}", money_with_currency_format: "руб{{amount_with_comma_separator}} RUB"}, RWF: {money_format: "{{amount_no_decimals}} RF", money_with_currency_format: "{{amount_no_decimals}} RWF"}, WST: {money_format: "WS$ {{amount}}", money_with_currency_format: "WS$ {{amount}} WST"}, SAR: {money_format: "{{amount}} SR", money_with_currency_format: "{{amount}} SAR"}, STD: {money_format: "Db {{amount}}", money_with_currency_format: "Db {{amount}} STD"}, RSD: {money_format: "{{amount}} RSD", money_with_currency_format: "{{amount}} RSD"}, SCR: {money_format: "Rs {{amount}}", money_with_currency_format: "Rs {{amount}} SCR"}, SGD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} SGD"}, SYP: {money_format: "S£{{amount}}", money_with_currency_format: "S£{{amount}} SYP"}, ZAR: {money_format: "R {{amount}}", money_with_currency_format: "R {{amount}} ZAR"}, KRW: {money_format: "₩{{amount_no_decimals}}", money_with_currency_format: "₩{{amount_no_decimals}} KRW"}, LKR: {money_format: "Rs {{amount}}", money_with_currency_format: "Rs {{amount}} LKR"}, SEK: {money_format: "{{amount_no_decimals}} kr", money_with_currency_format: "{{amount_no_decimals}} kr SEK"}, CHF: {money_format: "SFr. {{amount}}", money_with_currency_format: "SFr. {{amount}} CHF"}, TWD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} TWD"}, THB: {money_format: "{{amount}} ฿", money_with_currency_format: "{{amount}} ฿ THB"}, TZS: {money_format: "{{amount}} TZS", money_with_currency_format: "{{amount}} TZS"}, TTD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} TTD"}, TND: {money_format: "{{amount}}0", money_with_currency_format: "{{amount}}0 DT"}, TRY: {money_format: "{{amount}}TL", money_with_currency_format: "{{amount}}TL"}, UGX: {money_format: "Ush {{amount_no_decimals}}", money_with_currency_format: "Ush {{amount_no_decimals}} UGX"}, UAH: {money_format: "₴{{amount}}", money_with_currency_format: "₴{{amount}} UAH"}, AED: {money_format: "Dhs. {{amount}}", money_with_currency_format: "Dhs. {{amount}} AED"}, UYU: {money_format: "${{amount_with_comma_separator}}", money_with_currency_format: "${{amount_with_comma_separator}} UYU"}, VUV: {money_format: "${{amount}}", money_with_currency_format: "${{amount}}VT"}, VEF: {money_format: "Bs. {{amount_with_comma_separator}}", money_with_currency_format: "Bs. {{amount_with_comma_separator}} VEF"}, VND: {money_format: "{{amount_no_decimals_with_comma_separator}}₫", money_with_currency_format: "{{amount_no_decimals_with_comma_separator}} VND"}, XBT: {money_format: "{{amount_no_decimals}} BTC", money_with_currency_format: "{{amount_no_decimals}} BTC"}, XOF: {money_format: "CFA{{amount}}", money_with_currency_format: "CFA{{amount}} XOF"}, ZMW: {money_format: "K{{amount_no_decimals_with_comma_separator}}", money_with_currency_format: "ZMW{{amount_no_decimals_with_comma_separator}}"}, AFN: {money_format: "{{amount}} ؋", money_with_currency_format: "{{amount}} AFN"}, BIF: {money_format: "FBu {{amount}}", money_with_currency_format: "{{amount}} BIF"}, BMD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} BMD"}, CDF: {money_format: "FC {{amount}}", money_with_currency_format: "{{amount}} CDF"}, CVE: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} CVE"}, DJF: {money_format: "{{amount}} فرنك‎‎", money_with_currency_format: "{{amount}} DJF"}, ERN: {money_format: "Nfk {{amount}}", money_with_currency_format: "{{amount}} ERN"}, GNF: {money_format: "FG {{amount}}", money_with_currency_format: "{{amount}} GNF"}, IQD: {money_format: "{{amount}} د.ع", money_with_currency_format: "{{amount}} IQD"}, IRR: {money_format: "{{amount}} ﷼", money_with_currency_format: "{{amount}} IRR"}, KMF: {money_format: "CF {{amount}}", money_with_currency_format: "{{amount}} KMF"}, LRD: {money_format: "${{amount}}", money_with_currency_format: "${{amount}} LRD"}, LYD: {money_format: "{{amount}} ل.د", money_with_currency_format: "{{amount}} LYD"}, PAB: {money_format: "B/. {{amount}}", money_with_currency_format: "{{amount}} PAB"}, SDG: {money_format: "{{amount}} ج.س", money_with_currency_format: "{{amount}} SDG"}, SOS: {money_format: "Sh.So. {{amount}}", money_with_currency_format: "Sh.So. {{amount}}"}, TOP: {money_format: "T${{amount}}", money_with_currency_format: "T${{amount}}"}, UZS: {money_format: "{{amount}} UZS", money_with_currency_format: "{{amount}} UZS"}}; Currency.formatMoney = function(b, g) { if (typeof Shopify.formatMoney === "function") { return Shopify.formatMoney(b, g) } if (typeof b == "string") { b = b.replace(".", "") } var f = ""; var e = /\{\{\s*(\w+)\s*\}\}/; var a = g || "${{amount}}"; function c(h, i) { return(typeof h == "undefined" ? i : h) } function d(m, k, l, j) { k = c(k, 2); l = c(l, ","); j = c(j, "."); if (isNaN(m) || m == null) { return 0 } m = (m / 100).toFixed(k); var n = m.split("."), i = n[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1" + l), h = n[1] ? (j + n[1]) : ""; return i + h } switch (a.match(e)[1]) { case"amount": f = d(b, 2); break; case"amount_no_decimals": f = d(b, 0); break; case"amount_with_comma_separator": f = d(b, 2, ".", ","); break; case"amount_no_decimals_with_comma_separator": f = d(b, 0, ".", ","); break } return a.replace(e, f) }; Currency.currentCurrency = ""; Currency.format = "money_with_currency_format"; Currency.convertAll = function(c, b, a, d) { jQuery(a || "span.money").each(function(index1) { if (jQuery(this).attr("data-currency") === b) { return } if (jQuery(this).attr("data-currency-" + b)) { jQuery(this).html(jQuery(this).attr("data-currency-" + b)); var mycurprice = jQuery(this).attr("data-currency-" + b); if (jQuery("span").hasClass("mlvedamoney")) { var mlvedamyprice = jQuery(this).attr("data-currency-"+window.mlvedaShopCurrency); jQuery('span.mlvedamoney').each(function(index2) { if (index1 == index2) { jQuery(this).html(mlvedamyprice); } }); if (mycurprice === mlvedamyprice) { jQuery(this).css('display', 'none'); } else { jQuery(this).css('display', ''); } } } else { var e = 0; var f = Currency.moneyFormats[c][d || Currency.format] || "{{amount}}"; var g = Currency.moneyFormats[b][d || Currency.format] || "{{amount}}"; if (f.indexOf("amount_no_decimals") !== -1) { e = Currency.convert(parseInt(jQuery(this).html().replace(/[^0-9]/g, ""), 10) * 100, c, b) } else { if (c === "JOD" || c == "KWD" || c == "BHD") { e = Currency.convert(parseInt(jQuery(this).html().replace(/[^0-9]/g, ""), 10) / 10, c, b) } else { e = Currency.convert(parseInt(jQuery(this).html().replace(/[^0-9]/g, ""), 10), c, b) } } var h = Currency.formatMoney(e, g); if (jQuery("span").hasClass("mlvedamoney")) { var mlvedamyprice = jQuery(this).attr("data-currency-"+window.mlvedaShopCurrency); jQuery('span.mlvedamoney').each(function(index2) { if (index1 === index2) { jQuery(this).html(mlvedamyprice); } }); if (mlvedamyprice === h) { jQuery(this).css('display', 'none'); } else { jQuery(this).css('display', ''); } } jQuery(this).html(h); jQuery(this).attr("data-currency-" + b, h) } jQuery(this).attr("data-currency", b) }); this.currentCurrency = b; this.cookie.write(b) }; var abcd = jQuery.ajax({ url: "//www.mlveda.com/MultiCurrency/getUserCurrency?rnd="+Math.floor((Math.random() * 10000000000) + 1), type: "GET", dataType: "text", success: function(response) { if (response === "") { window.mlvedadefaultcurrency = window.mlvedaShopCurrency; } else { var temp_currency = response.split(" "); window.temp_currency_array = temp_currency; if (window.supported_currencies.search(temp_currency[0]) !== -1) { window.mlvedadefaultcurrency = temp_currency[0]; } else { if (temp_currency[1] !== null) { if (window.supported_currencies.search(temp_currency[1]) !== -1 && temp_currency[1] !== "") { window.mlvedadefaultcurrency = temp_currency[1]; } else { window.mlvedadefaultcurrency = window.mlvedaShopCurrency; } } else { window.mlvedadefaultcurrency = window.mlvedaShopCurrency; } } } var mlvedaintervalflag = true; var mlvedainterval = setInterval(function () { console.log("mlvedaload status..." + typeof mlvedaload + "Currency status..." + typeof Currency + "window.Currency status..." + typeof window.Currency); if(typeof mlvedaload !== "undefined" && mlvedaintervalflag) { clearInterval(mlvedainterval); mlvedaintervalflag = false; mlvedaload(); jQuery(".pick_currency").css("display",""); } },500); //$('#currencies option:contains('+window.mlvedadefaultcurrency+')').prop('selected', true); } } ); } });