Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function createCookie(a, b, c) {
- if (c) {
- var d = new Date;
- d.setTime(d.getTime() + c * 60 * 1e3);
- var e = "; expires=" + d.toUTCString()
- } else var e = "";
- document.cookie = a + "=" + b + e + "; path=/"
- }
- function readCookie(a) {
- for (var b = a + "=", c = document.cookie.split(";"), d = 0; d < c.length; d++) {
- for (var e = c[d];
- " " == e.charAt(0);) e = e.substring(1, e.length);
- if (0 == e.indexOf(b)) return e.substring(b.length, e.length)
- }
- return null
- }
- function eraseCookie(a) {
- createCookie(a, "", -1)
- }
- function crtmedir(a) {
- var b = document.createDocumentFragment(),
- c = document.createElement("div");
- for (c.innerHTML = a; c.firstChild;) b.appendChild(c.firstChild);
- return b
- }
- function startTimer(start, duration, display) {
- var diff, minutes, seconds;
- function timer() {
- diff = duration - (((Date.now() - start) / 1000) | 0);
- minutes = (diff / 60) | 0;
- seconds = (diff % 60) | 0;
- minutes = minutes < 10 ? "0" + minutes : minutes;
- seconds = seconds < 10 ? "0" + seconds : seconds;
- display.textContent = minutes + ":" + seconds;
- if (diff <= 0) {
- clearInterval(inti);
- document.getElementById("countdownhere").innerHTML = "Order reservation ended.";
- start = Date.now() + 1000;
- }
- };
- timer();
- var inti = setInterval(timer, 1000);
- }
- var pdm = crtmedir('<div class="countdownholder"><div id="countdownhere" style="display:block;background:#fff5d2;padding:10px 20px;border:1px solid #e3df74;font-size:14px;color:#2c2c2c;font-weight:bold;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px; margin:20px 0px">Your order is reserved for <span id="time"></span> minutes!</div><div style="display:table;width:100%"><div style="width:33.3%;display:table-cell;float:none;height:100%;vertical-align:middle;text-align:center"><img src="https://cdn.shopify.com/s/files/1/1319/2435/t/3/assets/mcafeesecured.png" style="margin:0 auto"></div><div style="width:33.3%;display:table-cell;float:none;height:100%;vertical-align:middle;text-align:center"><img src="https://cdn.shopify.com/s/files/1/1319/2435/t/3/assets/paypalverified.png" style="margin:0 auto"></div><div style="width:33.3%;display:table-cell;float:none;height:100%;vertical-align:middle;text-align:center"><img src="https://cdn.shopify.com/s/files/1/1319/2435/t/3/assets/scanalert.png" style="margin:0 auto"></div></div></div>');
- setInterval(function(){
- if(document.querySelector(".mb_opc .step__sections") && !document.querySelector("#countdownholder")){
- document.getElementsByClassName('main__header')[0].appendChild(pdm);
- var dolzina = 10;
- var ten = 60 * dolzina;
- var starttime = Date.now();
- var xcnt = readCookie('prtcntdwn');
- if (xcnt) {
- if (starttime < xcnt) {
- ten = (xcnt - starttime) / 1000;
- } else {
- eraseCookie('ptcntdwn');
- createCookie('prtcntdwn', Date.now() + (ten * 1000), ten + 1);
- }
- } else {
- createCookie('prtcntdwn', Date.now() + (ten * 1000), ten + 1);
- }
- display = document.querySelector('#time');
- startTimer(starttime, ten, display);
- };
- },2000);
- function showCouponField(){
- document.querySelector(".sidebar__content input[name='checkout[reduction_code]']").closest('.field').style.display = '';
- document.querySelector(".discountMinimize").style.display = 'none';
- }
- function showSecondAddress(){
- document.querySelector("div[data-address-field='address2'] input").style.display = '';
- document.querySelector("div[data-address-field='address2'] label").style.display = '';
- document.querySelector(".addressMinimize").style.display = 'none';
- }
- setInterval(function(){
- if(!document.querySelector(".discountMinimize") && $$("#checkout_reduction_code:visible").length && !$$(".order-summary-toggle:visible").length){
- document.querySelector(".sidebar__content input[name='checkout[reduction_code]']").closest('.field').style.display = 'none';
- $$(".sidebar__content input[name='checkout[reduction_code]']").closest('.fieldset').append('<p class="discountMinimize" onclick="showCouponField()" style="cursor:pointer;"><span style="display:inline-block;margin-right:3px;width: 10px;height: 10px;border: 1px solid grey;border-radius: 50%;font-size: 13px;line-height: 10px;text-align: center;background: #484848;color: white;">+</span><span style="display:inline-block;">Discount code?</span></p>');
- }
- if(!document.querySelector(".addressMinimize") && $$("#checkout_shipping_address_address2:visible").length && !$$(".order-summary-toggle:visible").length){
- document.querySelector("div[data-address-field='address2'] input").style.display = 'none';
- document.querySelector("div[data-address-field='address2'] label").style.display = 'none';
- $$("#checkout_shipping_address_address2").closest('.field__input-wrapper').append('<p class="addressMinimize" onclick="showSecondAddress()" style="cursor:pointer;"><span style="display:inline-block;margin-right:3px;width: 10px;height: 10px;border: 1px solid grey;border-radius: 50%;font-size: 13px;line-height: 10px;text-align: center;background: #484848;color: white;">+</span><span style="display:inline-block;">Address line 2</span></p>');
- }
- if($$(".section--shipping-address").length && !$$(".merged").length){
- $$("div[data-section='customer-information']").find('.fieldset').prependTo('.section--shipping-address .section__content')
- $$(".fieldset").css('clear','both')
- $$("div[data-section='customer-information']").addClass('merged')
- $$("#checkout_remember_me").closest('.checkbox-wrapper').replaceWith($$("div[data-buyer-accepts-marketing]"))
- $$(".section--contact-information").parent().remove()
- }
- },500);
- (function () {
- var title = "Why choose us?";
- var item1Title = "100% Satisfaction Guarantee"
- var item1Text = "If you're not satisfied with the products, we will replace or refund without any questions asked.";
- var item1Icon = "https://cdn.shopify.com/s/files/1/0052/2377/6291/files/guarantee.png?22";
- var item2Title = "Over 10,000+ Satisfied Customers";
- var item2Text = "We are a US based company and ship in 1-2 days.";
- var item2Icon = "https://cdn.shopify.com/s/files/1/0052/2377/6291/files/shipping.png?22";
- var sidebarWait = setInterval(function(){
- if($$(".sidebar__content .order-summary__sections").length && !$$("#booster1").length){
- clearInterval(sidebarWait)
- $$(".order-summary__sections").append('<div id="booster1"><div id="booster1Title"><span>'+title+'</span></div><div class="booster1Item"><img src="'+item1Icon+'" /><div><h4>'+item1Title+'</h4><p>'+item1Text+'</p></div></div><div class="booster1Item"><img src="'+item2Icon+'" /><div><h4>'+item2Title+'</h4><p>'+item2Text+'</p></div></div></div>')
- var css = '#booster1Title{margin-top:25px;overflow:hidden;text-align:center;font-size:16px}#booster1Title span{position:relative;}#booster1Title span:before,#booster1Title span:after {content: "";position: absolute;height: 5px;border-bottom: 1px solid;border-top: 1px solid;top: 8px;width: 600px;}#booster1Title span:before {right: 100%;margin-right: 15px;}#booster1Title span:after{left: 100%;margin-left: 15px;}.booster1Item{margin-top:30px;font-size:15px;}.booster1Item p{line-height:1.2;}.booster1Item h4{font-weight:bold;}.booster1Item img{width:13%;float:left;}.booster1Item div{width:75%;margin-left:25%}.booster1Item::after{content:"";clear:both;height:0;display:block;}'
- var boosterCss = document.getElementById('booster1Title')
- style = document.createElement('style');
- boosterCss.appendChild(style);
- style.type = 'text/css';
- style.appendChild(document.createTextNode(css));
- }
- },200)
- }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement