Created
March 30, 2024 18:10
-
-
Save vfonic/6d834a2e3ef2fb799081cdafbba01cd2 to your computer and use it in GitHub Desktop.
This file contains 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 X mute the muted | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=x.com | |
// @grant none | |
// @require file:///Users/viktor/Developer/JavaScript/tampermonkey/xMuteTheMuted.js | |
// ==/UserScript== |
This file contains 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 X mute the muted | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=x.com | |
// @grant none | |
// @require file:///Users/viktor/Developer/JavaScript/tampermonkey/xMuteTheMuted.js | |
// ==/UserScript== | |
;(function () { | |
'use strict' | |
const muteTheMuted = () => { | |
const elements = document.evaluate( | |
"//*[contains(text(), 'This Post is from an account you muted.')]", | |
document, | |
null, | |
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, | |
null, | |
) | |
for (var i = 0; i < elements.snapshotLength; i++) { | |
elements.snapshotItem(i).parentElement.parentElement.parentElement.parentElement.parentElement.style.display = 'none' | |
} | |
} | |
new MutationObserver(function (mutationsList, observer) { | |
for (let mutation of mutationsList) { | |
if (mutation.type === 'childList') { | |
muteTheMuted() | |
return | |
} | |
} | |
}).observe(document, { childList: true, subtree: true }) | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment