Advertisement
Guest User

Twitter ~Remove favs.

a guest
Apr 22nd, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. // f12 - enter
  2.  
  3. function scrollToLoadMore() {
  4. // keep scrolling if twitter tries to stop loading more.
  5. // scroll up, then down to force infinite load.
  6. window.scrollTo(0, 0);
  7. setTimeout(function() {
  8. window.scrollBy(0, 9999999999);
  9. }, 200);
  10. }
  11.  
  12. function removeTweet(tweetEl) {
  13. // show it
  14. tweetEl.style.backgroundColor = 'rgba(255,0,0,0.5)';
  15. tweetEl.scrollIntoView();
  16. window.scrollBy(0, -150);
  17. // remove it
  18. let favButton = tweetEl.querySelector('.js-actionFavorite');
  19. favButton.click();
  20. setTimeout(function() {
  21. tweetEl.parentNode.removeChild(tweetEl);
  22. }, 250);
  23. }
  24.  
  25. function favThenRemove(tweetEl) {
  26. // older tweets in your likes list may not show the favorited state correctly, so we click, then un-click.
  27. // show it.
  28. tweetEl.style.backgroundColor = 'rgba(0,255,0,0.5)';
  29. // fav it.
  30. let favButton = tweetEl.querySelector('.js-actionFavorite');
  31. favButton.click();
  32. setTimeout(function() {
  33. removeTweet(tweetEl);
  34. }, 450);
  35. }
  36.  
  37. function removeFav() {
  38. let tweetEl = document.querySelector('.js-actionable-tweet');
  39. if(tweetEl) {
  40. if(tweetEl.classList.contains('favorited')) {
  41. removeTweet(tweetEl);
  42. } else {
  43. favThenRemove(tweetEl);
  44. }
  45. } else {
  46. scrollToLoadMore();
  47. }
  48. }
  49. let unfavInterval = setInterval(removeFav, 500);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement