Skip to content

Instantly share code, notes, and snippets.

@arashmilani
Last active May 26, 2019 11:06
Show Gist options
  • Save arashmilani/ced2322b2b37ce679e59d9e10086feac to your computer and use it in GitHub Desktop.
Save arashmilani/ced2322b2b37ce679e59d9e10086feac to your computer and use it in GitHub Desktop.
Twitter "activity tweets" remover
// ==UserScript==
// @name twitter-activity-tweets-remover
// @namespace http://arashmilani.com/
// @version 0.1
// @description Twitter "activity tweets" remover
// @author Arash Milani
// @match https://*twitter.com/*
// @grant none
// ==/UserScript==
(function() {
setInterval(() => {
let lis = document.querySelectorAll('.stream-item');
for(let li of lis) {
if(li.tagName !== 'LI'){
continue;
}
let dataSuggestioJson = li.getAttribute('data-suggestion-json');
if(!dataSuggestioJson) {
continue;
}
let dataSuggestion = JSON.parse(dataSuggestioJson);
if(dataSuggestion.suggestion_details.suggestion_type === 'ActivityTweet') {
li.style.display = 'none';
}
}
}, 3000);
})();
@armantaherian
Copy link

armantaherian commented Apr 21, 2018

Maybe CSS would be a better solution:

.stream-item[data-suggestion-json*='"suggestion_type":"ActivityTweet"'] {
  display: none;
}

@arashmilani
Copy link
Author

Thumbs up for css solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment