Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

It didn't work on a site so I edited the script #6

Open
Bestulo opened this issue Oct 26, 2022 · 0 comments
Open

It didn't work on a site so I edited the script #6

Bestulo opened this issue Oct 26, 2022 · 0 comments

Comments

@Bestulo
Copy link

Bestulo commented Oct 26, 2022

Here's the script I made cuz nothing worked. It finally worked when I edited body position. The class things is probably overkill.

The site in question: https://www.infoworld.com/article/3663129/deno-deploy-moves-toward-ga-adds-paid-plan.html

(() => {
  document.querySelectorAll("body *").forEach(function (node) {
    if (["fixed", "sticky"].includes(getComputedStyle(node).position)) {
      node.parentNode.removeChild(node);
    }
  });

  document.querySelectorAll("html *").forEach(function (node) {
    var s = getComputedStyle(node);
    if ("hidden" === s["overflow"]) {
      node.style["overflow"] = "visible !important";
    }
    if ("hidden" === s["overflow-x"]) {
      node.style["overflow-x"] = "visible !important";
    }
    if ("hidden" === s["overflow-y"]) {
      node.style["overflow-y"] = "visible !important";
    }
  });

  var htmlNode = document.querySelector("html");
  htmlNode.style["overflow"] = "visible !important";
  htmlNode.style["overflow-x"] = "visible !important";
  htmlNode.style["overflow-y"] = "visible !important";

  document.querySelectorAll("body *").forEach(function (node) {
    var s = getComputedStyle(node);
    if ("hidden" === s["overflow"]) {
      node.style["overflow"] = "visible !important";
    }
    if ("hidden" === s["overflow-x"]) {
      node.style["overflow-x"] = "visible !important";
    }
    if ("hidden" === s["overflow-y"]) {
      node.style["overflow-y"] = "visible !important";
    }
  });

  var bodyNode = document.querySelector("body");
  bodyNode.style["overflow"] = "visible !important";
  bodyNode.style["overflow-x"] = "visible !important";
  bodyNode.style["overflow-y"] = "visible !important";

  // attach 10 classes to body: class1, class2, ..., class10

  const range10 = [...Array(10).keys()];
  range10.forEach((i) => {
    bodyNode.classList.add(`class${i + 1}`);
  });

  // attach 10 classes to html

  range10.forEach((i) => {
    htmlNode.classList.add(`class${i + 1}`);
  });

  // create a style component and style so any body with these classes inside an html with these classes will be overflow: visible !important

  const style = document.createElement("style");
  style.innerHTML = `
  html.class1.class2.class3.class4.class5.class6.class7.class8.class9.class10 body.class1.class2.class3.class4.class5.class6.class7.class8.class9.class10 {
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    position: relative !important;
  }
`;
  document.head.appendChild(style);
})();
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant