Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // f12 - enter
- function scrollToLoadMore() {
- // keep scrolling if twitter tries to stop loading more.
- // scroll up, then down to force infinite load.
- window.scrollTo(0, 0);
- setTimeout(function() {
- window.scrollBy(0, 9999999999);
- }, 200);
- }
- function removeTweet(tweetEl) {
- // show it
- tweetEl.style.backgroundColor = 'rgba(255,0,0,0.5)';
- tweetEl.scrollIntoView();
- window.scrollBy(0, -150);
- // remove it
- let favButton = tweetEl.querySelector('.js-actionFavorite');
- favButton.click();
- setTimeout(function() {
- tweetEl.parentNode.removeChild(tweetEl);
- }, 250);
- }
- function favThenRemove(tweetEl) {
- // older tweets in your likes list may not show the favorited state correctly, so we click, then un-click.
- // show it.
- tweetEl.style.backgroundColor = 'rgba(0,255,0,0.5)';
- // fav it.
- let favButton = tweetEl.querySelector('.js-actionFavorite');
- favButton.click();
- setTimeout(function() {
- removeTweet(tweetEl);
- }, 450);
- }
- function removeFav() {
- let tweetEl = document.querySelector('.js-actionable-tweet');
- if(tweetEl) {
- if(tweetEl.classList.contains('favorited')) {
- removeTweet(tweetEl);
- } else {
- favThenRemove(tweetEl);
- }
- } else {
- scrollToLoadMore();
- }
- }
- let unfavInterval = setInterval(removeFav, 500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement