Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.04 KB | None | 0 0
  1. var rememberMeWait = setInterval(function(){
  2. if($(".section--remember-me").length){
  3. clearInterval(rememberMeWait)
  4. $(".section--remember-me").remove();
  5. }
  6. },200)
  7.  
  8. function createCookie(a, b, c) {
  9. if (c) {
  10. var d = new Date;
  11. d.setTime(d.getTime() + c * 60 * 1e3);
  12. var e = "; expires=" + d.toUTCString()
  13. } else var e = "";
  14. document.cookie = a + "=" + b + e + "; path=/"
  15. }
  16.  
  17. function readCookie(a) {
  18. for (var b = a + "=", c = document.cookie.split(";"), d = 0; d < c.length; d++) {
  19. for (var e = c[d];
  20. " " == e.charAt(0);) e = e.substring(1, e.length);
  21. if (0 == e.indexOf(b)) return e.substring(b.length, e.length)
  22. }
  23. return null
  24. }
  25.  
  26. function eraseCookie(a) {
  27. createCookie(a, "", -1)
  28. }
  29.  
  30. function crtmedir(a) {
  31. var b = document.createDocumentFragment(),
  32. c = document.createElement("div");
  33. for (c.innerHTML = a; c.firstChild;) b.appendChild(c.firstChild);
  34. return b
  35. }
  36.  
  37. function startTimer(start, duration, display) {
  38. var diff, minutes, seconds;
  39.  
  40. function timer() {
  41. diff = duration - (((Date.now() - start) / 1000) | 0);
  42. minutes = (diff / 60) | 0;
  43. seconds = (diff % 60) | 0;
  44. minutes = minutes < 10 ? "0" + minutes : minutes;
  45. seconds = seconds < 10 ? "0" + seconds : seconds;
  46. display.textContent = minutes + ":" + seconds;
  47. if (diff <= 0) {
  48. clearInterval(inti);
  49. document.getElementById("countdownhere").innerHTML = "Order reservation ended. You can still complete the order.";
  50. start = Date.now() + 1000;
  51. }
  52. };
  53. timer();
  54. var inti = setInterval(timer, 1000);
  55. }
  56. var pdm = crtmedir('<div class="countdownholder"><div id="countdownhere" style="display:block;background:#fff5d2;padding:10px 20px;border:1px solid #e3df74;font-size:13px;color:#2c2c2c;font-weight:bold;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px; margin:10px 0px">Your order contains highly demanded item. Your order is reserved for <span id="time"></span> minutes!</div></div>');
  57. setInterval(function(){
  58. if(document.querySelector(".mb_opc .step__sections") && !document.querySelector("#countdownholder")){
  59. document.getElementsByClassName('main__header')[0].appendChild(pdm);
  60. var dolzina = 10;
  61. var ten = 60 * dolzina;
  62. var starttime = Date.now();
  63. var xcnt = readCookie('prtcntdwn');
  64. if (xcnt) {
  65. if (starttime < xcnt) {
  66. ten = (xcnt - starttime) / 1000;
  67. } else {
  68. eraseCookie('ptcntdwn');
  69. createCookie('prtcntdwn', Date.now() + (ten * 1000), ten + 1);
  70. }
  71. } else {
  72. createCookie('prtcntdwn', Date.now() + (ten * 1000), ten + 1);
  73. }
  74. display = document.querySelector('#time');
  75. startTimer(starttime, ten, display);
  76. }
  77. },2000);
  78.  
  79.  
  80. function showCouponField(){
  81. document.querySelector(".sidebar__content input[name='checkout[reduction_code]']").closest('.field').style.display = '';
  82. document.querySelector(".discountMinimize").style.display = 'none';
  83. }
  84.  
  85. function showSecondAddress(){
  86. document.querySelector("div[data-address-field='address2'] input").style.display = '';
  87. document.querySelector("div[data-address-field='address2'] label").style.display = '';
  88. document.querySelector(".addressMinimize").style.display = 'none';
  89. }
  90.  
  91. setInterval(function(){
  92. if(!document.querySelector(".discountMinimize") && $("#checkout_reduction_code:visible").length && !$(".order-summary-toggle:visible").length){
  93. document.querySelector(".sidebar__content input[name='checkout[reduction_code]']").closest('.field').style.display = 'none';
  94. $(".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>');
  95. }
  96.  
  97. if(!document.querySelector(".addressMinimize") && $("#checkout_shipping_address_address2:visible").length && !$(".order-summary-toggle:visible").length){
  98. document.querySelector("div[data-address-field='address2'] input").style.display = 'none';
  99. document.querySelector("div[data-address-field='address2'] label").style.display = 'none';
  100. $("#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>');
  101. }
  102.  
  103. if($(".section--shipping-address").length && !$(".merged").length){
  104. $("div[data-section='customer-information']").find('.fieldset').prependTo('.section--shipping-address .section__content')
  105. $(".fieldset").css('clear','both')
  106. $("div[data-section='customer-information']").addClass('merged')
  107. $("#checkout_remember_me").closest('.checkbox-wrapper').replaceWith($("div[data-buyer-accepts-marketing]"))
  108. $(".section--contact-information").parent().remove()
  109. }
  110.  
  111. },500);
  112.  
  113.  
  114.  
  115. (function () {
  116. var title = "Why choose us?";
  117. var item1Title = "30-day Satisfaction guarantee with Money Back"
  118. var item1Text = "If you're not satisfied with your products we will issue a full refund, no questions asked.";
  119. var item1Icon = "https://cdn.shopify.com/s/files/1/1319/2435/t/4/assets/money-back.png";
  120. var item2Title = "Over 34.245 successfully shipped orders";
  121. var item2Text = "We made as much happy customers as many orders we shipped. You simply have to join our big family.";
  122. var item2Icon = "https://cdn.shopify.com/s/files/1/1319/2435/t/4/assets/mail-truck.png";
  123.  
  124. var sidebarWait = setInterval(function(){
  125. if($(".sidebar__content .order-summary__sections").length && !$("#booster1").length){
  126. clearInterval(sidebarWait)
  127. $(".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>')
  128. 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;}'
  129. var boosterCss = document.getElementById('booster1Title')
  130. style = document.createElement('style');
  131. boosterCss.appendChild(style);
  132. style.type = 'text/css';
  133. style.appendChild(document.createTextNode(css));
  134. }
  135. },200)
  136. }());
  137.  
  138. $('<img/>')[0].src = "https://cdn.shopify.com/s/files/1/0265/9473/8251/files/vegetable.jpg?41"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement