Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* context: https://www.reddit.com/r/operabrowser/comments/ntgbhd/how_to_remove_this/h0t5xp6/ */
- javascript: /*HiddenSite*/
- (() => {
- let url = "https://en.wikipedia.org", db = document.body, b = window.hidSite, o = window.hidSiteOverlay,
- getEles = () => {
- b = hidSite; o = window.hidSiteOverlay
- },
- hide = () => {
- getEles();
- b.style.cssText = "display:none!important";
- o && o.remove();
- db.classList.remove("sbshow")
- };
- if (o) {
- hide()
- } else if (b) {
- if (b.style.display) {
- b.style.display = "";
- db.classList.add("sbshow")
- } else {
- b.insertAdjacentHTML("beforeend", `<div id="hidSiteOverlay"><div id="hidSitePrompt">
- <button id="hide">Hide Hidden Site</button><button id="close">Close Hidden Site</button></div></div>`);
- hidSiteOverlay.focus()
- }
- } else {
- db.insertAdjacentHTML("beforeend", `<div id="hidSite"><style>body.sbshow>*{display:none!important}${
- `#hidSite,#hidSite *{all:revert}
- #hidSiteFrame{position:fixed;left:0;top:0;border:none;box-sizing:border-box;width:100vw;height:100vh}
- #hidSiteOverlay{position:fixed;left:0;top:0;width:100vw;height:100vh;background:rgb(0,0,0,.5);cursor:pointer}
- #hidSitePrompt{position:fixed;left:50vw;top:1em;transform:translateX(-50%);border:.2em solid #007;border-radius:.5em;padding:1em;background:#fff;cursor:auto}
- body:not(.sbshow):after{position:fixed;right:0;bottom:0;border:1px solid #000;width:.3em;height:.3em;background:#ff0;content:""}
- #hidSite button{cursor:pointer}
- #hidSite #close{margin-left:3em}`.replace(/([;\}])/g, "!important$1")
- }</style><iframe id="hidSiteFrame" referrerpolicy="same-origin"></iframe></div>`);
- hidSiteFrame.src = url;
- hidSite.onclick = ev => {
- getEles();
- switch (ev.target.id) {
- case "hide":
- hide(); break;
- case "close":
- b.remove(); db.classList.remove("sbshow"); removeEventListener("blur", hide); break;
- case "hidSiteOverlay":
- o.remove(); hidSiteFrame.focus()
- }
- };
- addEventListener("blur", hide);
- db.classList.add("sbshow");
- hidSiteFrame.focus()
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement