Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
8.3 kB
4
Indexable
Never
<style>
 html body .thankyou_content .new-order-button {
    display: none !important;
}
html body.eg-timer-show .eg-popup{
    display: block;
}
html body .eg-toster-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 33px;
}


html body .eg-toster-heading {
    font-size: 24px !important;
    font-weight: bold !important;
    color: #1f3d5c;
    letter-spacing: 0.66px;
    line-height: 1.5;
    margin-bottom: 20px;
    margin-top: 10px;
    width: 100%;
    text-align: center;
}

html body .eg-promo-timer .eg-hours, 
html body .eg-promo-timer .eg-date,
html body .eg-toster-image .content-bloc .content-text {
    display: none;
}
html body .eg-toster-subheading {
    color: #333333;
    font-size: 16px;
    letter-spacing: 0.53px;
    line-height: 24px;
    text-align: center;
    margin: 16px 10px 22px;
}

html body .eg-toster-cross {
    position: absolute;
    top: 6px;
    right: 10px;
    font-size: 30px;
    line-height: 18px;
    cursor: pointer;
    color: #ffffff;
    padding: 3px;
    display: inline-flex;
    width: auto;
    z-index: 9;
    font-weight: 600;
}
.eg-promo-timer-inr {
    display: flex;
    align-items: center;
    justify-content: center;
}
.eg-promo-timer  .eg-hours,
.eg-promo-timer .eg-date {
    display: none;
}
.eg-promo-timer .eg-box {
    display: flex;
    justify-content: center;
    text-align: center;
    margin: 0px 5px;
    align-items: baseline;
}

.eg-promo-timer .eg-box .eg-text {
    text-transform: capitalize;
    color: #1f3d5c;
    font-weight: 600;
    margin-top: 10px;
}
.eg-toster .eg-link {
    display: inline-flex;
    background: #2e7182;
    padding: 9px 20px;
    text-align: center;
    color: #fff;
    font-size: 18px;
    letter-spacing: 1px;
    border-radius: 13px;
}

.eg-toster .eg-link:hover {
    opacity: .9;
}
.eg-promo-timer .eg-box .eg-number {
    border-radius: 2px;
    color: #1f3d5c;
    font-weight: 600;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 27px;
}
.eg-promo-timer .eg-promo-timer-inr .eg-colon {
    display: none;
}

.eg-promo-timer .eg-promo-timer-inr > span {
    font-size: 18px;
    margin-right: 10px;
}
@media screen and (max-width:767px) {

    html body .eg-toster {
        max-width: 375px;
        margin-left: auto;
        margin-right: auto;
        margin-top: 25px;
    }
    
 html body .thankyou_content {
    padding: 0px 10px !important;
}
}
.thankyou_content > div:nth-child(1) {
    text-align: center;
}
.thankyou_content > div:nth-child(1) .main_heading {
    position: relative;
    line-height: 50px;
    padding-left: 30px;
    text-align: center;
    display: inline-block;
    margin-top: 60px;
}
.eg-toster {
    background: #47acad;
    color: #fff;
    border-radius: 25px;
    padding: 30px 25px 5px;
    margin-top: 11px;
}
html body .eg-toster-heading {
    font-size: 24px !important;
    font-weight: bold !important;
    color: #ffffff;
    letter-spacing: 0.66px;
    line-height: 1.5;
    margin-bottom: 20px;
    margin-top: 10px;
    width: 100%;
    text-align: center;
}
.eg-toster .eg-link {
    display: block;
    background: #203d5a;
    padding: 18px 30px;
    text-align: center;
    color: #fff;
    font-size: 18px;
    letter-spacing: 1px;
    border-radius: 13px;
    margin-top: 25px;
    width: 80%;
}
.eg-promo-timer .eg-box .eg-number {
    border-radius: 2px;
    color: #1f3d5c;
    font-weight: 600;
    padding: 4px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 27px;
    background: #fff;
}
.eg-promo-timer .eg-box .eg-text {
    text-transform: capitalize;
    color: #1f3d5c;
    font-weight: 600;
    margin-top: 10px;
    margin-left: 10px;
}
</style>

(function () {
  try {
    /* main variables */
    var debug = 0;
    var variation_name = "";

    /* all Pure helper functions */

    function waitForElement(selector, trigger, delayInterval, delayTimeout) {
      var interval = setInterval(function () {
        if (
          document &&
          document.querySelector(selector) &&
          document.querySelectorAll(selector).length > 0
        ) {
          clearInterval(interval);
          trigger();
        }
      }, delayInterval);
      setTimeout(function () {
        clearInterval(interval);
      }, delayTimeout);
    }

    function getCookie(name) {
        var nameEQ = name + "=";
        var ca = document.cookie.split(';');
        for(var i=0;i < ca.length;i++) {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
        return null;
    }

    function setCookie(name,value,days) {
        var expires = "";
        if (days) {
            var date = new Date();
            date.setTime(date.getTime() + (days*24*60*60*1000));
            expires = "; expires=" + date.toUTCString();
        }
        document.cookie = name + "=" + (value || "")  + expires + "; path=/";
    }

    var egToster =''+ 
    '  <div class="eg-toster">'+ 
    '      <div class="eg-toster-content">'+ 
    '          <h2 class="eg-toster-heading">Order in the next 30 minutes and get 10% off</h2>'+ 
    '          <div class="eg-promo-timer">'+ 
    '              <div class="eg-promo-timer-inr">'+ 
    '                  <div class="eg-minutes eg-box">'+ 
    '                      <span class="eg-number">00</span>'+ 
    '                      <span class="eg-text">min</span>'+ 
    '                  </div>'+ 
    '                  <span class="eg-colon">:</span>'+ 
    '                  <div class="eg-seconds eg-box">'+ 
    '                      <span class="eg-number">00</span>'+ 
    '                      <span class="eg-text">sec</span>'+ 
    '                  </div>'+ 
    '              </div>'+ 
    '          </div>'+ 
    '         <a href="https://thespanishgroup.org/billing?offerDiscount=true" class="eg-link">Place Order Now</a>'+
    '      </div>'+ 
    '  </div>';

    var offset;
    
    function createSession() {
      if(getCookie('firstVisit') == null) {
        setCookie('firstVisit', '1',365);
      }
    }

    function init() {
    
        document.querySelector('.wrapper .thankyou_content .main_heading').insertAdjacentHTML('afterend', egToster);
        document.querySelector('body').classList.add('eg-timer-show');
        
      // document.querySelector('.eg-toster-cross').addEventListener('click', function(){
      //   createSession();
      // });


        var countdown = 30 * 60 * 1000;
        var timerId = setInterval(function(){
          countdown -= 1000;
          var min = Math.floor(countdown / (60 * 1000));
          //var sec = Math.floor(countdown - (min * 60 * 1000));  // wrong
          var sec = Math.floor((countdown - (min * 60 * 1000)) / 1000);  //correct
        
          if (countdown <= 0) {
             clearInterval(timerId);
             document.querySelector('body').classList.remove('eg-timer-show');
             createSession();
          } else {
            
            if (min < 10) {
              document.querySelector(".eg-minutes .eg-number").innerHTML = min = "0" + min;
            } else {
              document.querySelector(".eg-minutes .eg-number").innerHTML = min;
            }

            if (sec < 10) {
              document.querySelector(".eg-seconds .eg-number").innerHTML = sec = "0" + sec;
            } else {
              document.querySelector(".eg-seconds .eg-number").innerHTML = sec;
            }
          }
        
        }, 1000); 

//add mouseout event 
// document.addEventListener("mouseout", function(e) {
//   if (e.toElement == null && e.relatedTarget == null) {
//     if(getCookie('firstVisit') == null) {
//       document.querySelector('body').classList.add("eg-timer-show");
    
//      //create session 
//       createSession();
//       offset=window.pageYOffset;
//     }
//   }
// });

    }

    /* Initialise variation */
    // if(!getCookie('firstVisit')){
      waitForElement(".wrapper .thankyou_content > div:first-child", init, 50, 15000);
    // }
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();