Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.53 KB | None | 0 0
  1. setInterval(function(){
  2. var checkoutBtn = $("input[name='checkout']");
  3. if(checkoutBtn.length && !$('.opcQuickAdd').length){
  4. if(checkoutBtn.outerHeight()){
  5. var checkoutBtnHeight = checkoutBtn.outerHeight()+'px';
  6. var checkoutBtnWidth = checkoutBtn.outerWidth()+'px';
  7. var pos = checkoutBtn.offset()
  8. 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>')
  9. $(".opcQuickAdd").offset({top:pos.top,left:pos.left})
  10. }
  11. }
  12.  
  13. var checkoutBtn2 = $(".aod_buy_button");
  14. if(checkoutBtn2.length && !$('.opcQuickAdd').length){
  15. if(checkoutBtn2.outerHeight()){
  16. var checkoutBtn2Height = checkoutBtn2.outerHeight()+'px';
  17. var checkoutBtn2Width = checkoutBtn2.outerWidth()+'px';
  18. var pos = checkoutBtn2.offset()
  19. 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>')
  20. $(".opcQuickAdd").offset({top:pos.top,left:pos.left})
  21. }
  22. }
  23.  
  24. //third custom checkout button
  25. var checkoutBtn3 = $("#satcb_bar #AddToCart-product-template");
  26. if(checkoutBtn3.length && !$('.opcQuickAdd3').length){
  27. if(checkoutBtn3.outerHeight()){
  28. var checkoutBtn3Height = checkoutBtn3.outerHeight()+'px';
  29. var checkoutBtn3Width = checkoutBtn3.outerWidth()+'px';
  30. var pos = checkoutBtn3.offset()
  31. 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>')
  32. $(".opcQuickAdd3").offset({top:pos.top,left:pos.left})
  33. $(document).on('click',".opcQuickAdd3",function(e){
  34. e.preventDefault();
  35. $(".opcQuickAdd").click();
  36. return false;
  37. });
  38. }
  39. }
  40. //forth checkout button inside cart page
  41. if($("#satcb_checkout_btn").length){
  42. $(document).on('click',"#satcb_checkout_btn",function(e){
  43. e.preventDefault();
  44. $(".opcQuickAdd").click();
  45. return false;
  46. });
  47. }
  48.  
  49. },200)
  50.  
  51. function createCookie(a, b, c) {
  52. if (c) {
  53. var d = new Date;
  54. d.setTime(d.getTime() + c * 60 * 1e3);
  55. var e = "; expires=" + d.toUTCString()
  56. } else var e = "";
  57. document.cookie = a + "=" + b + e + "; path=/"
  58. }
  59.  
  60. function readCookie(a) {
  61. for (var b = a + "=", c = document.cookie.split(";"), d = 0; d < c.length; d++) {
  62. for (var e = c[d];
  63. " " == e.charAt(0);) e = e.substring(1, e.length);
  64. if (0 == e.indexOf(b)) return e.substring(b.length, e.length)
  65. }
  66. return null
  67. }
  68.  
  69. function eraseCookie(a) {
  70. createCookie(a, "", -1)
  71. }
  72.  
  73. function crtmedir(a) {
  74. var b = document.createDocumentFragment(),
  75. c = document.createElement("div");
  76. for (c.innerHTML = a; c.firstChild;) b.appendChild(c.firstChild);
  77. return b
  78. }
  79.  
  80. function startTimer(start, duration, display) {
  81. var diff, minutes, seconds;
  82.  
  83. function timer() {
  84. diff = duration - (((Date.now() - start) / 1000) | 0);
  85. minutes = (diff / 60) | 0;
  86. seconds = (diff % 60) | 0;
  87. minutes = minutes < 10 ? "0" + minutes : minutes;
  88. seconds = seconds < 10 ? "0" + seconds : seconds;
  89. display.textContent = minutes + ":" + seconds;
  90. if (diff <= 0) {
  91. clearInterval(inti);
  92. document.getElementById("countdownhere").innerHTML = "Order reservation ended.";
  93. start = Date.now() + 1000;
  94. }
  95. };
  96. timer();
  97. var inti = setInterval(timer, 1000);
  98. }
  99. 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>');
  100. setInterval(function(){
  101. if(document.querySelector(".mb_opc .step__sections") && !document.querySelector("#countdownholder")){
  102. document.getElementsByClassName('main__header')[0].appendChild(pdm);
  103. var dolzina = 10;
  104. var ten = 60 * dolzina;
  105. var starttime = Date.now();
  106. var xcnt = readCookie('prtcntdwn');
  107. if (xcnt) {
  108. if (starttime < xcnt) {
  109. ten = (xcnt - starttime) / 1000;
  110. } else {
  111. eraseCookie('ptcntdwn');
  112. createCookie('prtcntdwn', Date.now() + (ten * 1000), ten + 1);
  113. }
  114. } else {
  115. createCookie('prtcntdwn', Date.now() + (ten * 1000), ten + 1);
  116. }
  117. display = document.querySelector('#time');
  118. startTimer(starttime, ten, display);
  119. };
  120. },2000);
  121.  
  122. function showCouponField(){
  123. document.querySelector(".sidebar__content input[name='checkout[reduction_code]']").closest('.field').style.display = '';
  124. document.querySelector(".discountMinimize").style.display = 'none';
  125. }
  126.  
  127. function showSecondAddress(){
  128. document.querySelector("div[data-address-field='address2'] input").style.display = '';
  129. document.querySelector("div[data-address-field='address2'] label").style.display = '';
  130. document.querySelector(".addressMinimize").style.display = 'none';
  131. }
  132.  
  133. setInterval(function(){
  134. if(!document.querySelector(".discountMinimize") && $("#checkout_reduction_code:visible").length && !$(".order-summary-toggle:visible").length){
  135. document.querySelector(".sidebar__content input[name='checkout[reduction_code]']").closest('.field').style.display = 'none';
  136. $(".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;">&#43;</span><span style="display:inline-block;">Discount code?</span></p>');
  137. }
  138.  
  139. if(!document.querySelector(".addressMinimize") && $("#checkout_shipping_address_address2:visible").length && !$(".order-summary-toggle:visible").length){
  140. document.querySelector("div[data-address-field='address2'] input").style.display = 'none';
  141. document.querySelector("div[data-address-field='address2'] label").style.display = 'none';
  142. $("#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;">&#43;</span><span style="display:inline-block;">Address line 2</span></p>');
  143. }
  144.  
  145. if($(".section--shipping-address").length && !$(".merged").length){
  146. $("div[data-section='customer-information']").find('.fieldset').prependTo('.section--shipping-address .section__content')
  147. $(".fieldset").css('clear','both')
  148. $("div[data-section='customer-information']").addClass('merged')
  149. $("#checkout_remember_me").closest('.checkbox-wrapper').replaceWith($("div[data-buyer-accepts-marketing]"))
  150. $(".section--contact-information").parent().remove()
  151. }
  152.  
  153. },500);
  154.  
  155. (function () {
  156. var title = "Why choose us?";
  157. var item1Title = "24/7 Customer Support"
  158. 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.";
  159. var item1Icon = "https://cdn.shopify.com/s/files/1/2567/3940/files/Untitled_design_1_8b98f3ca-839f-47cf-918b-de42e564077b.png?v=1575490903";
  160. var item2Title = "Money Back Guarantee";
  161. var item2Text = "If the product is not as described or wasn't shipped yet we will issue a full refund (See refund policy).";
  162. var item2Icon = "https://cdn.shopify.com/s/files/1/1319/2435/t/4/assets/money-back.png";
  163.  
  164. var sidebarWait = setInterval(function(){
  165. if($(".sidebar__content .order-summary__sections").length && !$("#booster1").length){
  166. clearInterval(sidebarWait)
  167. $(".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>')
  168. 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;}'
  169. var boosterCss = document.getElementById('booster1Title')
  170. style = document.createElement('style');
  171. boosterCss.appendChild(style);
  172. style.type = 'text/css';
  173. style.appendChild(document.createTextNode(css));
  174. }
  175. },200)
  176. }());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement