Skip to content

Instantly share code, notes, and snippets.

@Temetra
Last active December 23, 2022 20:49
Show Gist options
  • Save Temetra/156be11c1e4c8e6d982cc723c061daa0 to your computer and use it in GitHub Desktop.
Save Temetra/156be11c1e4c8e6d982cc723c061daa0 to your computer and use it in GitHub Desktop.
Greasemonkey script to remove Twitter login prompts
// ==UserScript==
// @name Remove Twitter Login Prompts
// @namespace Violentmonkey Scripts
// @match https://twitter.com/*
// @grant none
// @version 1.2
// @author Temetra
// @description 20/12/2022, 09:25:19
// ==/UserScript==
let targetNode;
const contents = ["Don’t have an account? Sign up"];
const mutationCallback = (mutationList, observer) => {
if (mutationList.length == 1 && mutationList[0].addedNodes.length > 0) {
let ele = mutationList[0].addedNodes[0];
for (let text of contents) {
if (ele.innerText.includes(text)) {
document.documentElement.style.margin = "";
document.documentElement.style.overflow = "";
document.documentElement.style.overflowY = "scroll";
ele.style.display = "none";
return;
}
}
}
};
const loadCallback = () => {
// Observe layers element
targetNode = document.getElementById("layers");
let config = { attributes: false, childList: true, subtree: false };
let observer = new MutationObserver(mutationCallback);
observer.observe(targetNode, config);
// Hide bottom bar
let ele = document.querySelector("[data-testid='BottomBar']");
if (ele) ele.style.display = "none";
};
window.addEventListener("load", () => setTimeout(loadCallback, 250));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment