Skip to content

Instantly share code, notes, and snippets.

@coo11
Created October 1, 2020 09:40
Show Gist options
  • Select an option

  • Save coo11/d751dd842ee70a4134d71e3d2b90f2f2 to your computer and use it in GitHub Desktop.

Select an option

Save coo11/d751dd842ee70a4134d71e3d2b90f2f2 to your computer and use it in GitHub Desktop.
A bookmarklet to prevent Twitter from showing retweets in timeline.
setTimeout(function fn() {
Array.prototype.filter
.call(document.querySelectorAll("div"), (e, i) => {
var t;
try {
t = e.querySelector("div > div > article").querySelector("span[dir]")
.parentNode;
if (t.lastChild.nodeValue == " 转推了") {
t.parentNode.removeChild(t);
t = true;
} else t = false;
} catch (e) {
t = false;
}
return t;
})
.forEach(e => {
var a = e.querySelector("div[data-testid=tweet]");
a.parentNode.removeChild(a);
});
setTimeout(fn, 1000);
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment