Untitled

mail@pastecode.io avatarunknown
plain_text
a month ago
6.4 kB
3
Indexable
Never
(function(){
    var style=document.createElement('style');style.type='text/css';style.appendChild(document.createTextNode('@media(max-width:991px) {    html body .product-display-default .usp-list ul li:before {        background: url("https://cfactory-img.s3.amazonaws.com/pitches/Oak/iconTick.svg") no-repeat;        background-size: 16px;        height: 16px;        width: 16px;    }    .cv-product-content {        padding: 0.3125rem;        padding-top: 8px;        background: #ededee;    }    .cv-product-section {        padding: 20px 0px;        background: rgba(171, 190, 168, 0.20);        display: flex;        flex-wrap: wrap;    }    .cv-product-content>div {        padding: 8px;        background: #fff;    }    .cv-card {        display: flex;        flex-wrap: wrap;        justify-content: center;        text-align: center;        gap: 32px 24px;    }    .cv-card .box {        width: 38%;    }    .cv-card .box .cv-title {        margin-bottom: 0px;        color: #505052;        text-align: center;        font-family: Montserrat;        font-size: 14px;        font-style: normal;        font-weight: 600;        line-height: normal;        margin-top: 8px;    }    .product-display-default .spec-panel .usp-list {        background: #fff;    }    .spec-panel .card.usp-list li {        color: #505052;        font-family: Montserrat;        font-size: 15px;        font-style: normal;        font-weight: 400;        line-height: 25px;    }    .spec-panel .card.usp-list .vertical.menu{        margin-bottom: 0px !important;    }    .cv-product-section .cv-card .box:nth-child(3) img {        width: 46px;    }}@media screen and (max-width: 639px) {    html body .cv-product-content {        padding-bottom: 0px;    }}@media (orientation: landscape) {    html body .cv-product-content + .spec-panel .card-section.panel:first-of-type {        background: #ffffff !important;    }    }'));document.head.appendChild(style);
(function (w) {
  "use strict";
  var tag = "cv-2-0", // TO DO: test name
    debug = document.cookie.indexOf("cfQA") > -1,
    window = typeof unsafeWindow !== "undefined" ? unsafeWindow : w;

  window[tag] = {
    log: function (msg) {
      if (debug) console.log("[CONV]", tag, "-->", msg);
    },
    waitForElement: function (cssSelector, callback) {
      var stop,
        elementCached,
        timeout,
        check = function () {
          try {
            elementCached = document.querySelector(cssSelector);

            if (stop) return;

            if (elementCached) {
              callback(elementCached);
              clearTimeout(timeout);

              window[tag].log(cssSelector + " found");
            } else {
              window.requestAnimationFrame(check);
            }
          } catch (err) {
            window[tag].log(err.message);
          }
        };

      window.requestAnimationFrame(check);

      timeout = setTimeout(function () {
        stop = true;
        window[tag].log(cssSelector + " not found");
      }, 15000);
    },
    start: function () {
      try {
        this.waitForElement("body", function (docBody) {
          docBody.classList.add(tag);
        });

        if (debug && document.title.indexOf("CONV QA") < 0) {
          document.title = "[CONV QA] " + document.title;
        }

        initVariation();

        window[tag].log("test running");
      } catch (err) {
        window[tag].log(err.message);
      }
    }
  };
  var cvProductContent = '' +
    '  <div class="cell cv-product-content">' +
    '      <div class="grid-x">' +
    '          <div class="cell cv-product-section hide-for-large">' +
    '              <div class="cv-card">' +
    '                  <div class="box">' +
    '                      <div class="box-inr">' +
    '                          <img src="https://cfactory-img.s3.amazonaws.com/pitches/Oak/FrameIcon1.svg" alt="Icon">' +
    '                          <p class="cv-title">100% solid oak</p>' +
    '                      </div>' +
    '                  </div>' +
    '                  <div class="box">' +
    '                      <div class="box-inr">' +
    '                          <img src="https://cfactory-img.s3.amazonaws.com/pitches/Oak/FrameIcon2.svg" alt="Icon">' +
    '                          <p class="cv-title">Handmade</p>' +
    '                      </div>' +
    '                  </div>' +
    '                  <div class="box">' +
    '                      <div class="box-inr">' +
    '                          <img src="https://cfactory-img.s3.amazonaws.com/pitches/Oak/FrameIcons3.png" alt="Icon">' +
    '                          <p class="cv-title">Delivery available to your room of choice</p>' +
    '                      </div>' +
    '                  </div>' +
    '                  <div class="box">' +
    '                      <div class="box-inr">' +
    '                          <img src="https://cfactory-img.s3.amazonaws.com/pitches/Oak/FrameIcon4.svg" alt="Icon">' +
    '                          <p class="cv-title">Tree planted for every order</p>' +
    '                      </div>' +
    '                  </div>' +
    '                  <div class="box">' +
    '                      <div class="box-inr">' +
    '                          <img src="https://cfactory-img.s3.amazonaws.com/pitches/Oak/FrameIcon5.svg" alt="Icon">' +
    '                          <p class="cv-title">Available in store</p>' +
    '                      </div>' +
    '                  </div>' +
    '                  <div class="box">' +
    '                      <div class="box-inr">' +
    '                          <img src="https://cfactory-img.s3.amazonaws.com/pitches/Oak/FrameIcon6.svg" alt="Icon">' +
    '                          <p class="cv-title">Finance available over £500</p>' +
    '                      </div>' +
    '                  </div>' +
    '              </div>' +
    '          </div>' +
    '      </div>' +
    '  </div>';

  window[tag].start();
  function initVariation() {
    window[tag].waitForElement('.product-display-default .product-display-default-partial-accordion .spec-panel', function (ele) {
      ele.insertAdjacentHTML('beforebegin', cvProductContent)
      document.querySelector('.spec-panel .card.usp-list h4').textContent = "Product features";
    }, 50, 15000);
  }
})(window);



})();