Last active
February 13, 2022 12:07
-
-
Save hinxx/d76e4280ec44280f92d5f30d6baaf7f0 to your computer and use it in GitHub Desktop.
Remove twitter Promoted.user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove twitter Promoted | |
// @namespace Violentmonkey Scripts | |
// @match https://twitter.com/* | |
// @grant none | |
// @version 1.0 | |
// @author hinxx | |
// @description Removes the Promoted tweets from twitter timeline | |
// ==/UserScript== | |
// execute every second | |
setInterval(function() { | |
var spans = document.getElementsByTagName("span"); | |
// console.log('have nr spans:', spans.length); | |
for (var i = 0; i < spans.length; i++) { | |
var span = spans[i]; | |
if (span.textContent === 'Promoted') { | |
// console.log('FOUND Promoted span'); | |
var parent = span; | |
var found = 13; | |
while (found > 0) { | |
// console.log('element:', parent.nodeName, parent.tagName); | |
parent = parent.parentElement; | |
found--; | |
} | |
// console.log('top element:', parent.nodeName, parent.tagName, parent.style.transform); | |
if (parent.style.transform.indexOf('translateY(') != -1 && parent.style.display != 'none') { | |
console.log('hiding element:', parent.nodeName, parent.tagName, parent.style); | |
// remove messes up twitter JS.. use display: none instead! | |
// parent.remove(); | |
parent.style.display = 'none'; | |
} | |
} | |
} | |
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove twitter trends | |
// @namespace Violentmonkey Scripts | |
// @match https://twitter.com/* | |
// @grant none | |
// @version 1.0 | |
// @author qsniyg | |
// @description Removes the Trending section from twitter | |
// ==/UserScript== | |
setInterval(function() { | |
var sections = document.getElementsByTagName("section"); | |
for (var i = 0; i < sections.length; i++) { | |
var section = sections[i]; | |
if (section.children.length !== 2) | |
continue; | |
if (section.children[0].innerText.indexOf("Trending") >= 0) { | |
section.style.display = "none"; | |
} | |
} | |
}, 1000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Remove twitter who to follow | |
// @namespace Violentmonkey Scripts | |
// @match https://twitter.com/* | |
// @grant none | |
// @version 1.0 | |
// @author qsniyg | |
// @description Removes the Who To Follow section from twitter | |
// ==/UserScript== | |
setInterval(function() { | |
var sections = document.getElementsByTagName("aside"); | |
for (var i = 0; i < sections.length; i++) { | |
var section = sections[i]; | |
// section.style.display = "none"; | |
section.parentElement.style.display = "none"; | |
} | |
}, 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment