Update Tumblr Unnagger to 1.0.2

- Fix hiding sign up and follow buttons
This commit is contained in:
blankie 2024-01-27 15:37:43 +11:00
parent 57875d4733
commit 4f32e63ece
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 26 additions and 27 deletions

View File

@ -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});
});
observer.observe(document.body, {childList: true, subtree: true});
}