Add Tumblr Unnagger

This commit is contained in:
blankie 2023-12-28 23:08:04 +11:00
parent 13bffe0d7f
commit 8d5abf9a30
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 83 additions and 0 deletions

View File

@ -101,6 +101,10 @@ build logs to view them without logging in
![A man yelling "I DON'T WANNA", followed by sign up/login boxes](https://gitlab.com/blankX/userscripts/-/raw/master/accounts.jpg)
## Tumblr Unnagger
A script that removes several login/account walls on Tumblr
## Wayback Machine Toolbar Toggler
A userscript that replaces the "close this toolbar" button with one that lets

79
Tumblr Unnagger.user.js Normal file
View File

@ -0,0 +1,79 @@
// ==UserScript==
// @name Tumblr Unnagger
// @namespace blankie-scripts
// @match https://*.tumblr.com/*
// @grant GM_addStyle
// @version 1.0.0
// @author blankie
// @description Removes login nags
// @inject-into content
// @run-at document-end
// ==/UserScript==
"use strict";
let css = `
/* Remove the "Sign up" and "Follow <blog>" buttons */
.sign-up-button, .follow-button {
display: none !important;
}
/* Remove the top iframe bar on the default theme (e.g. https://azulcrescent.tumblr.com/) */
.tmblr-iframe {
display: none !important;
}
/* Fix margin from the top iframe bar being hidden */
.nav-wrapper.nav-fixed {
top: 0;
}
/* Hide fullscreen nag when scrolling */
#glass-container {
display: none;
}
/* Restore scrolling when fullscreen nag is shown */
html {
overflow: scroll !important;
}
`;
if (/^\/archive(\/.*)?$/.test(window.location.pathname)) {
css += `
/* Remove the "It's time to try Tumblr" nag on /archive */
#base-container > div:has(style) > div:nth-child(4) {
display: none;
}
`;
}
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;
}
for (let node of mutation.addedNodes) {
if (node.nodeType !== 1) {
continue;
}
removeLoginWall(node);
}
}
});
observer.observe(document.body, {childList: true, subtree: true});