Sha256: cd396a607bf6fee8460fe54027ca38235d201ee9dcc67ec455a0a195ef8e23be

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

let showPop = false;
if (
  !localStorage.getItem("timeDisplayed") ||
  new Date().getTime() - localStorage.getItem("timeDisplayed") >=
    60000 * 24 * 60
) {
  showPop = true;
  localStorage.setItem("timeDisplayed", new Date().getTime());
} else {
  showPop = false;
}
let freeCount = localStorage.getItem("freeCount");
if (!freeCount) {
  freeCount = 0;
}
localStorage.setItem(
  "freeCount",
  Number(freeCount) < 5 ? Number(freeCount) + 1 : 5
);
if (freeCount >= 5 || showPop) {
  $(".nav-tabs a.nav-tab-link").click(function () {
    $(".nav-tabs  a.nav-tab-link").removeClass("active");
  });

  const detect = document.querySelector("#detect");
  const wrapper = document.querySelector(".wrapper");
  const closePopup = document.getElementsByClassName("closePopup");
  const extensions = document.querySelector(".extensions");

  const refresh = () => {
    location.reload();
  };

  let adsBtn = document.querySelector(".allow-ads-btn");
  adsBtn.addEventListener("click", () => {
    extensions.classList.add("show");
  });

  let adClasses = [
    "ad",
    "ads",
    "adsbox",
    "doubleclick",
    "ad-placement",
    "ad-placeholder",
    "adbadge",
    "BannerAd",
  ];
  for (let item of adClasses) {
    detect.classList.add(item);
  }

  let getProperty = window.getComputedStyle(detect).getPropertyValue("display");
  console.log(getProperty);
  if (!wrapper.classList.contains("show")) {
    getProperty == "none"
      ? wrapper.classList.add("show")
      : wrapper.classList.remove("show");
  }
  closePopup[0].addEventListener("click", () => {
    wrapper.classList.remove("show");
    localStorage.setItem("freeCount", 0);
  });
  closePopup[1].addEventListener("click", () => {
    extensions.classList.remove("show");
    localStorage.setItem("freeCount", 0);
  });
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
appscms-tools-theme-3.1.0 assets/js/adBlocker.js
appscms-tools-theme-3.0.9 assets/js/adBlocker.js
appscms-tools-theme-3.0.7 assets/js/adBlocker.js
appscms-tools-theme-3.0.6 assets/js/adBlocker.js
appscms-tools-theme-3.0.4 assets/js/adBlocker.js