Guest User

Untitled

a guest
May 24th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. // As of the middle of May, 2018, I was able to use this in Chrome
  2. // to add the 600 something twitter users I follow to a list.
  3. //
  4. // Create a list called "Everyone".
  5. //
  6. // Go to your "Following" list. Scroll down until everyone has loaded.
  7. //
  8. // Scroll back up to the top.
  9. //
  10. // Paste the following into the Chrome DevTools Console and press
  11. // your Enter key.
  12. //
  13. // It may take a while, but when it finishes, everyone you follow should
  14. // be in your "Everyone" list, and you can see tweets in chronological order.
  15. //
  16. // It it's taking too long, or you want to stop the process, type 'cancel()'
  17. // in the console and hit Enter.
  18. function addEveryone() {
  19. let stopped = false;
  20. const addProf = (p, caller) => {
  21. p.getElementsByClassName('dropdown-toggle')[0].click();
  22. p
  23. .getElementsByClassName('list-text')[0]
  24. .getElementsByClassName('dropdown-link')[0]
  25. .click();
  26. setTimeout(() => {
  27. try {
  28. let addButton = Array.from(
  29. document.querySelectorAll(
  30. '#list-membership-dialog-body > div > ul li'
  31. )
  32. ).filter(item => item.innerText.indexOf('Everyone') != -1)[0];
  33. if (
  34. !addButton.getElementsByClassName('membership-checkbox')[0].dataset
  35. .isChecked
  36. ) {
  37. addButton.click();
  38. document
  39. .querySelector(
  40. '#list-membership-dialog-dialog > div.modal-content > button > span'
  41. )
  42. .click();
  43. console.log('added');
  44. caller();
  45. } else {
  46. document
  47. .querySelector(
  48. '#list-membership-dialog-dialog > div.modal-content > button > span'
  49. )
  50. .click();
  51. console.log('skipped');
  52. caller();
  53. }
  54. } catch (e) {
  55. console.log('erred');
  56. caller(p);
  57. }
  58. }, 100);
  59. };
  60.  
  61. let profiles = Array.from(document.getElementsByClassName('ProfileCard'));
  62.  
  63. function popper(failed) {
  64. if (failed) {
  65. profiles.push(failed);
  66. }
  67.  
  68. if (profiles.length > 1 && !stopped) {
  69. addProf(profiles.shift(), popper);
  70. } else {
  71. return;
  72. }
  73. }
  74.  
  75. popper();
  76.  
  77. return () => (stopped = true);
  78. }
  79.  
  80. cancel = addEveryone();
Add Comment
Please, Sign In to add comment