Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
2.9 kB
1
Indexable
Never
(function () {
  try {
    var debug = 0;
    var variation_name = "";
    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);
    }

    let popup = `
    <div class="eg-overlay">
    <div class="eg-card-container">
        <div class="eg-card-popup">
            <p class="eg-headline"> What brings you here today?</p>
            <div class="eg-card-box">
                <div class="eg-check-a-salary">
                    <img src="https://www.hiringpeople.co.uk/wp-content/uploads/2017/09/HIRING-PEOPLE-main-logo-light.png">
                    <p>I’m Interested in job advertising</p>
                    <a href="https://www.hiringpeople.co.uk/home/services/job-advertising/">Advertise Job</a>
                </div>
                <div class="eg-hiring-people">
                    <div class="eg-image">
                        <img src="https://www.hiringpeople.co.uk/wp-content/uploads/2017/09/HIRING-PEOPLE-main-logo-light.png">
                    </div>
                    <p>I want to view my CVs</p>
                    <a href="https://www.hiringpeople.co.uk/my-account/">Login</a>
                </div>
                <div class="eg-hiring">
                    <div class="eg-image">
                        <img src="https://www.checkasalary.co.uk/images/branding/logo-web-light.webp">
                    </div>
                    <p>I’m looking for a job</p>
                    <a href="https://www.checkasalary.co.uk/#job_seekers">View jobs</a>
                </div>
            </div>
            <p class="eg-continue">Or continue on the Hiring People site...</p>
        </div>
    </div>
</div>`

    function init() {
      if (!document.querySelector(".eg-overlay") && getSession("is-dug-popup") == null) {
        document.querySelector("html body").insertAdjacentHTML("beforeend", popup);
        document.body.classList.add("eg-show-popup");
        setSession("is-dug-popup", true);
        document.querySelector("html body .eg-card-popup .eg-continue").addEventListener("click", function () {
          document.body.classList.remove("eg-show-popup");
        })
      }
    }

    const setSession = (name, value) => {
      sessionStorage.setItem(name, value);
    }

    const getSession = (name) => {
      return sessionStorage.getItem(name) || null;
      // return null;
    }

    waitForElement('html body', init, 1000, 15000);
  } catch (e) {
    if (debug) console.log(e, "error in Test" + variation_name);
  }
})();