EJV1_configCart(1); /* Client Side - For handling cookies, window messaging, and opening cart */ function EJCartV3(params){ this.params = { standalone: false, events: { onload: null, onclose: null, onopen: null, onProceedToPayment: null, onThankYou: null, }, //themeColor: "49, 152, 223", theme: null, language: null, layout: "overlay", behavior: "normal", customLanguage: [], } if(typeof params === "undefined"); else { if(params.standalone == true) this.params.standalone = true if(params.language) this.params.language = params.language if(params.customLanguage) this.params.customLanguage = params.customLanguage if(params.theme) this.params.theme = params.theme if(params.themeColor){ if(params.themeColor.indexOf("rgb(") == -1); else this.params.themeColor = params.themeColor.replace("rgb(", "").replace(")", "") } if(params.layout) if(["overlay", "sidebar"].indexOf(params.layout) != -1) this.params.layout = params.layout if(params.behavior) if(["normal", "minimal"].indexOf(params.behavior) != -1) this.params.behavior = params.behavior if(typeof params.onload === "function") this.params.events.onload = params.onload if(typeof params.onclose === "function") this.params.events.onclose = params.onclose if(typeof params.onopen === "function") this.params.events.onopen = params.onopen if(typeof params.onProceedToPayment === "function") this.params.events.onProceedToPayment = params.onProceedToPayment if(typeof params.onThankYou === "function") this.params.events.onThankYou = params.onThankYou } this.MetaData = { facebook: {}, gtag_js: {}, analytics_js: {}, ga_js: {}, } this.clientId = null this.cartIframeElement = null this.loaderElement = null this.historyState = [] this.isMobile = false if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) this.isMobile = true /* if (navigator.appVersion.toLowerCase().indexOf("mobile") != -1 || navigator.appVersion.toLowerCase().indexOf("mini") != -1 || navigator.appVersion.toLowerCase().indexOf("msie 4.") != -1 || navigator.appVersion.toLowerCase().indexOf("msie 5.") != -1 || navigator.appVersion.toLowerCase().indexOf("msie 6.") != -1 || navigator.appVersion.toLowerCase().indexOf("msie 7.") != -1 || navigator.appVersion.toLowerCase().indexOf("msie 8.") != -1 || navigator.appVersion.toLowerCase().indexOf("msie 9.") != -1 || navigator.appVersion.toLowerCase().indexOf("msie 10.") != -1) this.isMobile = true */ this.host = { source: window.location.href, secure: (window.location.protocol == "https:" ? true : false), } this.isIE = ( ( (window.navigator.userAgent.toLowerCase().indexOf("msie ") > 0 ) || (window.navigator.userAgent.toLowerCase().indexOf("Trident/") > 0 ) || (window.navigator.userAgent.toLowerCase().indexOf("Edge/") > 0 ) ) ? true : false ) this.isFacebookBrowser = false; if(window.navigator.userAgent){ if((window.navigator.userAgent.indexOf("FBAN") > -1) || (window.navigator.userAgent.indexOf("FBAV") > -1)) this.isFacebookBrowser = true; }else if(window.navigator.vendor){ if((window.navigator.vendor.indexOf("FBAN") > -1) || (window.navigator.vendor.indexOf("FBAV") > -1)) this.isFacebookBrowser = true; }else if(window.opera){ if((window.opera.indexOf("FBAN") > -1) || (window.opera.indexOf("FBAV") > -1)) this.isFacebookBrowser = true; } this.dev = true // window messaging related code this.eventMethod = window.addEventListener ? "addEventListener" : "attachEvent"; this.eventer = window[this.eventMethod]; this.messageEvent = this.eventMethod == "attachEvent" ? "onmessage" : "message"; this.scrollElement = null this.isCartOpen = false this.log= function(message){ if(this.dev) console.info(message) } this.grabAnalyticCodes = function(){ try{ if(window.dataLayer){ //gtag might be present for(var i = 0; i < window.dataLayer.length; i++){ if(window.dataLayer[i][0] == "config"){ if (window.dataLayer[i][1].substr(0,3)=='UA-' || window.dataLayer[i][1].substr(0,3)=='AW-') { this.MetaData.gtag_js._value = window.dataLayer[i][1]; break; } } } if(!this.MetaData.gtag_js){ if(window._gaq){ //tag manager support this.MetaData.ga_js._value = window._gat.bb } } }else if(window.ga){ //analytics.js this.MetaData.analytics_js._value = { "trackingId" : window.ga.P[0].b.data.values[':trackingId'], "source" : window.ga.P[0].b.data.values[':cookieDomain'] } }else if(window._gaq){ //ga.js this.MetaData.ga_js._value = window._gat.bb } if(window.fbq){ this.MetaData.facebook._value = window.fbq.getState(); this.MetaData.facebook._value = this.MetaData.facebook._value.pixels[0] if(this.MetaData.facebook._value){ this.MetaData.facebook._value = this.MetaData.facebook._value.id; } } if(this.MetaData.gtag_js != null){ gtag('config', this.MetaData.gtag_js._value, {'linker': { 'domains': ['.e-junkie.com','www.e-junkie.com', '.fatfreecartpro.com','www.fatfreecartpro.com', '.fatfreecart.com','www.fatfreecart.com'], 'decorate_forms': true, 'decorateForms': true } }); this.MetaData.gtag_js._params = ga.getAll()[0].get("linkerParam") return true; } if(this.MetaData.analytics_js != null){ ga('require', 'linker'); ga('create', this.MetaData.analytics_js._value.trackingId, 'auto', {allowLinker: true}); ga('linker:autoLink', ['.'+this.MetaData.analytics_js._value.source, '.e-junkie.com']); ga('linker:decorate', ['.'+this.MetaData.analytics_js._value.source, '.e-junkie.com']); ga('linker:autoLink', ['.'+this.MetaData.analytics_js._value.source, '.fatfreecartpro.com']); ga('linker:decorate', ['.'+this.MetaData.analytics_js._value.source, '.fatfreecartpro.com']); ga('linker:autoLink', ['.'+this.MetaData.analytics_js._value.source, '.fatfreecart.com']); ga('linker:decorate', ['.'+this.MetaData.analytics_js._value.source, '.fatfreecart.com']); ga(function(tracker) { this.MetaData.analytics_js._params = tracker.get('linkerParam'); }); return true; } if(this.MetaData.ga_js != null){ _gaq.push(['_setDomainName', 'e-junkie.com']); _gaq.push(['_setAllowLinker', true]); //backward comptability this.MetaData.ga_js._params = '&_ejoga_params='+encodeURIComponent(_gat._getTrackerByName()._getLinkerUrl('')); return true; } }catch(e){ this.log(e) } return true; } this.escapeHTML = function(text){ var map = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }; return text.replace(/[&<>"']/g, function(m) { return map[m]; }); } this.setCookie = function(key, value){ var CookiesValidity = 10 //days var t = new Date(); t.setTime(t.getTime()); var e = new Date(t.getTime() + (CookiesValidity * 24 * 60 * 60 * 1000)); var d = document.domain; document.cookie = key + "=" + encodeURIComponent(value) + ";expires=" + e.toGMTString() + ";path=/;domain=" + d + ";" } this.getCookie = function(key){ var b = key + "="; var d = document.cookie.split(';'); for (var i = 0; i < d.length; i++) { var c = d[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(b) == 0) return c.substring(b.length, c.length) } return null; } this.findParentForm = function(element){ if (element.action && (element.action.indexOf("gb.php") != -1 || element.action.indexOf("gb2.php") != -1 || element.action.indexOf("gbv3.php") != -1)){ return (element); } else { if (element.parentNode) { return this.findParentForm(element.parentNode) } else { return false } } } this.extractURLFromForm = function(source){ var url = ""; var selectTags = source.getElementsByTagName('select'); for(var i = 0; i < selectTags.length; i++) url += "&"+selectTags[i].name+"="+encodeURIComponent(selectTags[i].value); var inputTags = source.getElementsByTagName('input'); for(var i = 0; i < inputTags.length; i++){ if (inputTags[i].value) { if (inputTags[i].type == 'radio' && inputTags[i].checked != true) continue; url += "&"+inputTags[i].name+"="+encodeURIComponent(inputTags[i].value); } } if(source.action.indexOf("?") == -1) return source.action+"?"+url else return source.action+url } this.getURLFromSource = function(source){ if(source.href) return source.href else{ source = this.findParentForm(source) if(source.action) return this.extractURLFromForm(source) else { return null } } } this.prepareURL = function(url){ var client_id; var url_has_zipcode = false; var url_has_country = false; var qs = url.split("?")[1]; qs = qs.replace(/\;/g,"&"); qs = qs.split('&'); // get all the basic details from the url array for(var i=0; i < qs.length; i++){ var c = qs[i]; if (c.substring(0,3)=='cl='){ client_id=c.substring(3); this.clientId = client_id } if (c.substring(0,7)=='zipcode') url_has_zipcode = true; if (c.substring(0,10)=='to_country') url_has_country = true; } //get all cookies var cart_id = this.getCookie('cart_id'+client_id); var cart_md5 = this.getCookie('cart_md5'+client_id); var cart_currency = this.getCookie('cart_currency'+client_id); var to_country = this.getCookie('to_country'+client_id); var zipcode = this.getCookie('zipcode'+client_id); if(url.indexOf("?") == -1) url = url + "?" url = url + '&cart_md5=' + cart_md5 + '&cart_id=' + cart_id + '&cart_currency=' + cart_currency; if(!url_has_country && to_country) url = url + '&to_country=' + to_country; if(!url_has_zipcode && zipcode) url = url + '&zipcode=' + zipcode; // backward compatibility in backend var cartMetaData = {} if(this.MetaData.gtag_js){ cartMetaData.gtag = this.MetaData.gtag_js._value; url = url + "&"+this.MetaData.gtag_js._params } if(this.MetaData.analytics_js._value){ cartMetaData.aga = this.MetaData.analytics_js._value; url = url + "&"+this.MetaData.analytics_js._params } if(this.MetaData.ga_js._value){ cartMetaData.oga = this.MetaData.ga_js._value; url = url + "&"+this.MetaData.ga_js._params } if(this.MetaData.facebook._value){ cartMetaData.fbp = this.MetaData.facebook._value; } url = url + '&cart_metadata='+encodeURIComponent(JSON.stringify(cartMetaData)) url = url + "&initialize" return url } this.closeCart = function(){ this.isCartOpen = false; this.cartIframeElement.style.display = "none"; this.cartIframeElement.src = "//about:blank"; this.enablePageScroll(); this.updateHash("") if(this.params.standalone){ try { var histlen = history.length; var opener = null; var hist = false; if(window.opener=='undefined' || window.opener==null) { opener=false; } else { opener=true; } // safari starts from 1 if (navigator.appVersion.toLowerCase().indexOf("safari")!=-1 || navigator.userAgent.toLowerCase().indexOf("firefox")!=-1) { histlen-=1; } if (histlen>0 && !opener) { hist=true; } else { hist=false; } if (hist) { history.back(); } else { window.close(); } } catch (err) { window.close(); } //window.close() } } this.handleStateChange = function(){ if(this.isMobile && !this.params.standalone){ if(typeof window.history.pushState === "undefined") var state = window.location.hash.replace("#", "") else{ this.historyState.pop() var state = this.historyState[this.historyState.length-1] } if(!state) var state = "" switch(state){ case "#EJCart": if(this.clientId){ this.isCartOpen = false this.openCart("https://www.e-junkie.com/ecom/gbv3.php?ejc=2&c=cart&cl="+self.clientId) }else this.closeCart() break; case "#EJCC": break; case "": this.closeCart(); break; } } return; } this.updateHash = function(v){ if(this.isMobile){ if(typeof window.history.pushState === "undefined"){ //go old school, hashbangs if(window.location.hash == v) return; window.location.hash = v; }else{ //use history api var url = window.location.href.split("#")[0] if(v == ""){ this.historyState = [] window.history.replaceState(null, null, url) return; } url = url + v if(window.history.length <= 2){ window.history.pushState(null, null, url) this.historyState.push(v) }else{ if(this.historyState.indexOf(v) == -1) this.historyState.push(v) else this.historyState = this.historyState.splice(0, this.historyState.indexOf(v)+1) window.history.replaceState(null, null, url) } } } return; } this.showCart = function(){ if(!this.params.standalone){ this.cartIframeElement.style.display = "block"; this.updateHash("#EJCart") } else this.cartIframeElement.style.display = "none"; this.disablePageScroll(); } this.getCartJSON = function(clientId, cb, url){ if(typeof cb === "function"); else return; if(isNaN(clientId) && !url) return; var cbToken = +new Date() if(!url){ this.clientId = clientId url = "https://www.e-junkie.com/ecom/gbv3.php?c=cart&ejc=2&cl="+clientId //url = this.prepareURL(url) } url = this.prepareURL(url) url = url+"&json&cb="+cbToken var s = document.createElement("script"); s.src = url s.type = "text/javascript" s.onload = function(){ cb(window["EJResponseJSON_"+cbToken]); } document.getElementsByTagName("head")[0].appendChild(s) return; } this.openCart = function(source){ //if(this.isCartOpen) return true; this.grabAnalyticCodes() var url = null; if(typeof source == "string") url = source else if(typeof source == "object") url = this.getURLFromSource(source) if(url); else return false; if(this.params.behavior == "minimal" && url.indexOf("ejc=2") != -1 && url.indexOf("i=") != -1 && !this.isCartOpen){ self.toggleSnackBar(true, "Adding Product to Cart", true) this.getCartJSON(null, function(res){ if(res.Cart.Errors.length == 0){ var h = "Product added to Cart
View Cart" self.toggleSnackBar(true, h, false) self.setCookie("cart_id"+res.Client.client_id, res.Cart.Metadata.id) self.setCookie("cart_md5"+res.Client.client_id, res.Cart.Metadata.md5) self.setCookie("cart_currency"+res.Client.client_id, res.Cart.Metadata.currency) if(res.Cart.Metadata.shipping.zipcode) self.setCookie("zipcode"+res.Client.client_id, res.Cart.Metadata.shipping.zipcode) if(res.Cart.Metadata.shipping.country) self.setCookie("to_country"+res.Client.client_id, res.Cart.Metadata.shipping.country) }else{ var h = "Failed to add product!
"+res.Cart.Errors[0] self.toggleSnackBar(true, h, false) } }, url) return true; } self.toggleSnackBar(false) this.isCartOpen = true; url = this.prepareURL(url) if(this.params) url = url + "&pref=" + encodeURIComponent(JSON.stringify({ language: this.params.language, theme: this.params.theme, themeColor: this.params.themeColor, customLanguage: this.params.customLanguage, layout: (window.innerWidth <= 700 ? "overlay" : this.params.layout), })) //temp purpose url = url.replace("gb.php", "gbv3.php") url = url.replace("gb2.php", "gbv3.php") if(url.indexOf("c=single") != -1){ window.location.href = url this.isCartOpen = false; return true; } // check if the url has `single` or `cc` and if the page is `https://` load the cc page in the page itself or else load inside an iframe if(!this.host.secure){ if(url.indexOf("c=cc") != -1){ window.location.href = url this.isCartOpen = false; return true; } } this.toggleLoader(true) this.cartIframeElement.src = url return true } this.toggleLoader = function(x, y){ if(typeof y === "undefined") y = false if(this.params.layout != "overlay") y = false if(x){ this.loaderElement.style.display = "block"; if(!y) this.cartIframeElement.style.display = "none"; }else{ this.loaderElement.style.display = "none"; if(!this.params.standalone) this.cartIframeElement.style.display = "block"; } } this.toggleSnackBar = function(s, h, l){ if(s) this.snackbarElement.style.display = "block"; else this.snackbarElement.style.display = "none"; if(h) this.snackbarElement.querySelector(".EJSnackBarV3-Content").innerHTML = h if(l) this.snackbarElement.querySelector(".EJSnackBarV3-Loader").style.opacity = "1" else this.snackbarElement.querySelector(".EJSnackBarV3-Loader").style.opacity = "0" } this.disablePageScroll = function(element){ if(this.params.layout != "overlay") return; if(this.scrollElement) return; var possibleValues = ["scroll", "visible", "auto"] // store body or html scroll property changed, to toggle it when cart is closed if(possibleValues.indexOf(window.getComputedStyle(document.querySelector("html")).getPropertyValue("overflow-y").toLowerCase()) != -1 ){ this.scrollElement = "html" document.querySelector("html").style.overflowY = "hidden"; }else if(possibleValues.indexOf(window.getComputedStyle(document.querySelector("body")).getPropertyValue("overflow-y").toLowerCase()) != -1){ this.scrollElement = "body" document.body.style.overflowY = "hidden" } return false; } this.enablePageScroll = function(){ if(this.params.layout != "overlay") return; if(this.scrollElement){ if(this.scrollElement == "html") document.querySelector("html").style.overflowY = "scroll"; else document.body.style.overflowY = "scroll" this.scrollElement = null } } this.loadURL = function(url, type){ if(this.params.standalone) window.location.href = url else if(type == "standalone"){ this.toggleLoader(true) window.location.href = url }else{ this.toggleLoader(true) if(url.indexOf("rp.php") != -1) url = url + "&nobanner=true&standalone=true" this.cartIframeElement.src = url } } this.scrollTo = function(x){ window.scroll(null, x) } this.sendMessage = function(data){ var EJCartMessage = { data: data, src: "cart", } window.postMessage({"EJCartMessage": EJCartMessage}, "*") return true; } this.handleMessages = function(payload){ switch (payload.data.event){ case "Proceed Payment": var type = null; if(payload.data.data.processor == "Paypal") type = "standalone" if(payload.data.data.processor == "Paypal Credit") type = "standalone" if(!this.host.secure) type = "standalone" if(typeof EJCart.params.events.onProceedToPayment === "function"){ var self = this EJCart.params.events.onProceedToPayment(payload.data.data, function(res){ if(res){ if(self.params.standalone || type == "standalone") self.loadURL(payload.data.data.url, type) else self.loadURL(payload.data.data.url+"&initialize", type) }else return; }) }else{ if(this.params.standalone || type == "standalone") this.loadURL(payload.data.data.url, type) else this.loadURL(payload.data.data.url+"&initialize", type) } break; case "Cart Loaded": this.showCart(); this.toggleLoader(false); if(payload.data.data){ this.setCookie("cart_id"+payload.data.data.Client.client_id, payload.data.data.Cart.Metadata.id) this.setCookie("cart_md5"+payload.data.data.Client.client_id, payload.data.data.Cart.Metadata.md5) this.setCookie("cart_currency"+payload.data.data.Client.client_id, payload.data.data.Cart.Metadata.currency) if(payload.data.data.Cart.Metadata.shipping.zipcode) this.setCookie("zipcode"+payload.data.data.Client.client_id, payload.data.data.Cart.Metadata.shipping.zipcode) if(payload.data.data.Cart.Metadata.shipping.country) this.setCookie("to_country"+payload.data.data.Client.client_id, payload.data.data.Cart.Metadata.shipping.country) } if(this.params.events.onload) this.params.events.onload(payload.data.data) break; case "Cart Updating": this.toggleLoader(true, true); break; case "Close Cart": this.closeCart(); if(this.params.events.onclose) this.params.events.onclose() break; case "Load URL": this.loadURL(payload.data.data.url, payload.data.data.type); break; case "CC Loaded": this.updateHash("#EJCC") this.disablePageScroll(); this.toggleLoader(false); this.scrollTo(0); break; case "Window Resize": this.cartIframeElement.style.height = (payload.data.data+30)+"px" this.loaderElement.style.height = (payload.data.data+30)+"px" break; case "URL Loaded": this.toggleLoader(false); this.scrollTo(0); break; case "Scroll": this.scrollTo(payload.data.data); break; } return true; } var self = this // bind window messaging event and keyboard event window.addEventListener(this.messageEvent, function(e){ try{ if(typeof e.data == "object"){ var payload = e.data.EJCartMessage if(payload == null) return false; if(payload.src != "cart-inline" && payload.src != "cart-cc") return false; self.handleMessages(payload) return true } return false; }catch(err){ self.log(err); } },false); window.addEventListener("keyup", function(e){ if(e.keyCode == 27) { self.closeCart() } }, false); window.addEventListener("hashchange", function(e){ if(self.params.standalone) return; self.handleStateChange() }, false); var layoutClassName = "EJOverlayV3" if(this.params.layout == "overlay") layoutClassName = "EJOverlayV3" else if(this.params.layout == "sidebar") layoutClassName = "EJSideBarV3" //cart iframe this.cartIframeElement = document.createElement("iframe"); this.cartIframeElement.className = "EJIframeV3 "+layoutClassName this.cartIframeElement.src = "//about:blank" document.body.appendChild(this.cartIframeElement) //loader iframe this.loaderElement = document.createElement("div"); this.loaderElement.className = "EJLoaderV3 "+layoutClassName document.body.appendChild(this.loaderElement) //this.loaderElement.innerHTML = '
' this.loaderElement.innerHTML = '
' //snackbar this.snackbarElement = document.createElement("div"); this.snackbarElement.className = "EJSnackBarV3" this.snackbarElement.innerHTML = '
' document.body.appendChild(this.snackbarElement) this.log("Cart Object Initialized"); } function EJEJC_lc(source){ if(typeof EJCart === "undefined" || !EJCart){ //EJCart = new EJCartV3(window.EJConfig); return; } if(EJCart.openCart(source)){ return false }else{ return true; } } function EJEJC_frm(ele){ EJEJC_lc(ele); return false; } //add style tag with styles first var EJStyleEle = document.createElement("style"); EJStyleEle.type = "text/css" EJStyleEle.innerHTML = ".EJLoaderV3, .EJIframeV3{position: fixed;top: 0;bottom: 0;height: 100%;display: none;z-index: 99999;border:none;padding:0px;}.EJIframeV3.EJSideBarV3{ position: absolute;}.EJLoaderV3{background: rgba(0,0,0,0.7);}.EJLoaderV3 div{width: 15vh;height: 15vh;background: transparent;border-radius: 100px;animation: EJLoaderV3 1.2s infinite linear;margin: 0 auto;margin-top: 25vh;}.EJOverlayV3{left: 0;right: 0;width: 100%;}.EJSideBarV3{right: 0;width: 400px;}@media(max-width: 700px){.EJSideBarV3{ width: 100% !important; left: 0; right: 0; max-height: 100%; margin: 0 auto; margin-left: 0px;} }@media(min-width: 700px){.EJSideBarV3 { border-radius: 5px !important; height: 400px; width: 380px; margin-right: 10px; margin-top: 10px;} .EJSideBarV3 div{ margin-top: 15vh; width: 10vh; height: 10vh;}.EJLoaderV3.EJSideBarV3{ box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); background: rgba(255, 255, 255, 0.5); width: 360px; margin-left: 10px; margin-right: 20px; }}@keyframes EJLoaderV3{0% { transform: rotate(0deg); }25% { transform: rotate(90deg); }50% { transform: rotate(180deg); }100% { transform: rotate(360deg); }}.EJSnackBarV3{display: none;width: 300px;position: fixed;background: #253e4a;border-radius: 3px;padding: 5px 10px;box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);bottom: 20px;right: 20px;}.EJSnackBarV3 close{width: 10px;height: 10px;cursor: pointer;display: inline-block;vertical-align: top;margin-left: 10px;}.EJSnackBarV3-Loader {width: 20px;height: 20px;background: transparent;display: inline-block;border: 2px solid #fff;border-radius: 100%;border-top: 2px solid rgba(255,255,255,0.4);animation: EJLoaderV3 1.2s infinite linear;vertical-align: middle;}.EJSnackBarV3-Content{ display: inline-block;width: calc(100% - 40px);margin: 0 auto;color: white;font-size: 15px;text-align: center;padding: 0px 10px;vertical-align: middle;font-family: inherit;}.EJSnackBarV3-Content a{ color: white !important;font-weight: bold;}" EJStyleEle.innerHTML = ".EJLoaderV3, .EJIframeV3{position: fixed;top: 0;bottom: 0;height: 100%;display: none;z-index: 99999;border:none;padding:0px;}.EJLoaderV3{background: rgba(0,0,0,0.7);}.EJLoaderV3 div{width: 15vh;height: 15vh;background: transparent;border-radius: 100px;margin: 0 auto;margin-top: 25vh;}.EJLoaderV3 div:before {position: absolute;width: 15vh;height: 15vh;animation: EJLoaderV3 1.2s infinite linear;content: '';border-radius: 100%;border: 1vh solid transparent;border-top: 1vh solid rgba(49, 152, 223, 1);margin: 0 auto;margin-left: -1vh;margin-top: -1vh;}.EJOverlayV3{left: 0;right: 0;width: 100%;}.EJSideBarV3{right: 0;width: 400px;}@media(max-width: 700px){.EJSideBarV3{width: 100% !important;left: 0;right: 0;max-height: 100%;margin: 0 auto;margin-left: 0px;}}@media(min-width: 700px){.EJSideBarV3 {border-radius: 5px !important;height: 400px;width: 380px;margin-right: 10px;margin-top: 10px;}.EJLoaderV3.EJSideBarV3{box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);background: rgba(255, 255, 255, 0.5); }.EJSideBarV3 div{margin-top: 15vh;width: 10vh;height: 10vh;}}@keyframes EJLoaderV3{0% { transform: rotate(0deg); }25% { transform: rotate(90deg); }50% { transform: rotate(180deg); }100% { transform: rotate(360deg); }}.EJSnackBarV3{display: none;width: 300px;position: fixed;background: #253e4a;border-radius: 3px;padding: 5px 10px;box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);bottom: 20px;right: 20px;}.EJSnackBarV3 close{width: 10px;height: 10px;cursor: pointer;display: inline-block;vertical-align: top;margin-left: 10px;}.EJSnackBarV3-Loader {width: 20px;height: 20px;background: transparent;display: inline-block;border: 2px solid #fff;border-radius: 100%;border-top: 2px solid rgba(255,255,255,0.4);animation: EJLoaderV3 1.2s infinite linear;vertical-align: middle;}.EJSnackBarV3-Content{display: inline-block;width: calc(100% - 40px);margin: 0 auto;color: white;font-size: 15px;text-align: center;padding: 0px 10px;vertical-align: middle;font-family: inherit;}.EJSnackBarV3-Content a{color: white !important;font-weight: bold;}" document.querySelector("head").appendChild(EJStyleEle) try{ jQuery(document).ready(function() { ejejc_jQuery('a.ej_ejc_ithkbx').click(function() { return EJEJC_ilc(this) }); ejejc_jQuery('input.ej_ejc_ithkbx').click(function() { return EJEJC_ilc(this.parentNode) }); ejejc_jQuery('a.ej_ejc_jthkbx').click(function() { return EJEJC_jlc(this) }); ejejc_jQuery('input.ej_ejc_jthkbx').click(function() { return EJEJC_jlc(this.parentNode) }); ejejc_jQuery('a.ec_ejc_thkbx,input.ec_ejc_thkbx').each(function(i) { if (ejejc_jQuery(this).attr("href")) { if (!ejejc_jQuery(this).attr("onClick")) { ejejc_jQuery(this).click(function() { return EJEJC_lc(this) }) } } else { if (!ejejc_jQuery(this).attr("onClick")) { ejejc_jQuery(this).click(function() { return EJEJC_lc(this.parentNode) }) } if (this.parentNode && !ejejc_jQuery(this).attr("onClick")) { if (ejejc_jQuery(this.parentNode).attr("action")) { if (!ejejc_jQuery(this.parentNode).attr("onSubmit")) { ejejc_jQuery(this.parentNode).submit(function() { return EJEJC_lc(this) }) } } } } }); }); }catch(e){} function EJEJC_multiAdd2(arr){ EJEJC_multiAdd(arr) } function EJEJC_multiAdd(arr, pos){ EJCart.toggleLoader(true) if(typeof pos === "undefined") pos = 0 if(pos == arr.length-1){ EJCart.openCart(arr[pos]) return true; }else{ EJCart.getCartJSON(null, function(res){ if(res.Cart.Errors.length == 0){ EJCart.setCookie("cart_id"+res.Client.client_id, res.Cart.Metadata.id) EJCart.setCookie("cart_md5"+res.Client.client_id, res.Cart.Metadata.md5) EJCart.setCookie("cart_currency"+res.Client.client_id, res.Cart.Metadata.currency) if(res.Cart.Metadata.shipping.zipcode) EJCart.setCookie("zipcode"+res.Client.client_id, res.Cart.Metadata.shipping.zipcode) if(res.Cart.Metadata.shipping.country) EJCart.setCookie("to_country"+res.Client.client_id, res.Cart.Metadata.shipping.country) EJEJC_multiAdd(arr, ++pos) } }, arr[pos]) } } if(document.body) var EJCart = new EJCartV3(window.EJConfig) else var EJCart = null if(EJCart == null){ if(window.addEventListener){ window.addEventListener("DOMContentLoaded", function() { EJCart = new EJCartV3(window.EJConfig); }, false); }else if(window.attachEvent){ window.attachEvent('onreadystatechange', function(){ EJCart = new EJCartV3(window.EJConfig); }); }else { EJCart = new EJCartV3(window.EJConfig); } }