diff --git a/Tumblr Unnagger.user.js b/Tumblr Unnagger.user.js index 3b5511e..0692f66 100644 --- a/Tumblr Unnagger.user.js +++ b/Tumblr Unnagger.user.js @@ -2,9 +2,8 @@ // @name Tumblr Unnagger // @namespace blankie-scripts // @match https://*.tumblr.com/* -// @exclude-match https://www.tumblr.com/* // @grant GM_addStyle -// @version 1.0.1 +// @version 1.0.2 // @author blankie // @description Removes login nags // @inject-into content @@ -37,7 +36,7 @@ let css = ` /* Restore scrolling when fullscreen nag is shown */ html { overflow: scroll !important; - } +} `; if (/^\/archive(\/.*)?$/.test(window.location.pathname)) { @@ -49,32 +48,32 @@ if (/^\/archive(\/.*)?$/.test(window.location.pathname)) { `; } -GM_addStyle(css); +if (window.location.hostname !== "www.tumblr.com" || window.location.pathname === "/dashboard/iframe") { + GM_addStyle(css); - - -function removeLoginWall(element) { - element.removeAttribute("data-login-wall-type"); - for (let child of element.querySelectorAll("[data-login-wall-type]")) { - child.removeAttribute("data-login-wall-type"); - } -} - -// Remove login walls for elements before Javascript -removeLoginWall(document.body); - -// Remove login walls for elements added by Javascript -let observer = new MutationObserver(function(mutations) { - for (let mutation of mutations) { - if (mutation.type !== "childList") { - continue; + function removeLoginWall(element) { + element.removeAttribute("data-login-wall-type"); + for (let child of element.querySelectorAll("[data-login-wall-type]")) { + child.removeAttribute("data-login-wall-type"); } - for (let node of mutation.addedNodes) { - if (node.nodeType !== 1) { + } + + // Remove login walls for elements before Javascript + removeLoginWall(document.body); + + // Remove login walls for elements added by Javascript + let observer = new MutationObserver(function(mutations) { + for (let mutation of mutations) { + if (mutation.type !== "childList") { continue; } - removeLoginWall(node); + for (let node of mutation.addedNodes) { + if (node.nodeType !== 1) { + continue; + } + removeLoginWall(node); + } } - } -}); -observer.observe(document.body, {childList: true, subtree: true}); \ No newline at end of file + }); + observer.observe(document.body, {childList: true, subtree: true}); +} \ No newline at end of file