Skip to content

Instantly share code, notes, and snippets.

@vfonic
Created March 30, 2024 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vfonic/6d834a2e3ef2fb799081cdafbba01cd2 to your computer and use it in GitHub Desktop.
Save vfonic/6d834a2e3ef2fb799081cdafbba01cd2 to your computer and use it in GitHub Desktop.
// ==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==
// ==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