Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- setInterval(function(){
- var checkoutBtn = $("input[name='checkout']");
- if(checkoutBtn.length && !$('.opcQuickAdd').length){
- if(checkoutBtn.outerHeight()){
- var checkoutBtnHeight = checkoutBtn.outerHeight()+'px';
- var checkoutBtnWidth = checkoutBtn.outerWidth()+'px';
- var pos = checkoutBtn.offset()
- checkoutBtn.parent().append('<div class="opcQuickAdd" style="cursor:pointer !important;z-index:9999;opacity:0 !important;height:'+checkoutBtnHeight+' !important;width:'+checkoutBtnWidth+' !important;position:absolute !important;"></div>')
- $(".opcQuickAdd").offset({top:pos.top,left:pos.left})
- }
- }
- var checkoutBtn2 = $(".aod_buy_button");
- if(checkoutBtn2.length && !$('.opcQuickAdd').length){
- if(checkoutBtn2.outerHeight()){
- var checkoutBtn2Height = checkoutBtn2.outerHeight()+'px';
- var checkoutBtn2Width = checkoutBtn2.outerWidth()+'px';
- var pos = checkoutBtn2.offset()
- checkoutBtn2.parent().append('<div class="opcQuickAdd" style="cursor:pointer !important;z-index:9999;opacity:0 !important;height:'+checkoutBtn2Height+' !important;width:'+checkoutBtn2Width+' !important;position:absolute !important;"></div>')
- $(".opcQuickAdd").offset({top:pos.top,left:pos.left})
- }
- }
- //third custom checkout button
- var checkoutBtn3 = $("#satcb_bar #AddToCart-product-template");
- if(checkoutBtn3.length && !$('.opcQuickAdd3').length){
- if(checkoutBtn3.outerHeight()){
- var checkoutBtn3Height = checkoutBtn3.outerHeight()+'px';
- var checkoutBtn3Width = checkoutBtn3.outerWidth()+'px';
- var pos = checkoutBtn3.offset()
- checkoutBtn3.parent().append('<div class="opcQuickAdd3" style="cursor:pointer !important;z-index:9999;opacity:0 !important;height:'+checkoutBtn3Height+' !important;width:'+checkoutBtn3Width+' !important;position:absolute !important;"></div>')
- $(".opcQuickAdd3").offset({top:pos.top,left:pos.left})
- $(document).on('click',".opcQuickAdd3",function(e){
- e.preventDefault();
- $(".opcQuickAdd").click();
- return false;
- });
- }
- }
- //forth checkout button inside cart page
- if($("#satcb_checkout_btn").length){
- $(document).on('click',"#satcb_checkout_btn",function(e){
- e.preventDefault();
- $(".opcQuickAdd").click();
- return false;
- });
- }
- },200)
- 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 style="width:100%;display:table-cell;float:none;height:100%;vertical-align:middle;text-align:center"><img src="https://cdn.shopify.com/s/files/1/2567/3940/files/sdgghr_d1b3a97d-444d-4ca3-8eef-652efaf41593.gif?v=1575488835" style="margin:0 auto"></div><div style="margin:0 auto"></div><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></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 = "24/7 Customer Support"
- var item1Text = "We appreciate each and every customer, our little devils will be available 24/7 on Skype and Facebook messenger, you can also call us at +1 901 313 4492.";
- var item1Icon = "https://cdn.shopify.com/s/files/1/2567/3940/files/Untitled_design_1_8b98f3ca-839f-47cf-918b-de42e564077b.png?v=1575490903";
- var item2Title = "Money Back Guarantee";
- var item2Text = "If the product is not as described or wasn't shipped yet we will issue a full refund (See refund policy).";
- var item2Icon = "https://cdn.shopify.com/s/files/1/1319/2435/t/4/assets/money-back.png";
- 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