Extract all tweets for Twitter

get all tweets from a page

当前为 2017-02-07 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Extract all tweets for Twitter
  3. // @name:ja Extract all tweets for Twitter
  4. // @namespace https://gf.qytechs.cn/ja/users/100769-atul-k
  5. // @description get all tweets from a page
  6. // @description:hget all the tweets from a page
  7. // @description:ja get all the text in one go
  8. // @include https://twitter.com/*
  9. // @author atul
  10. // @version 0.0.1
  11. // @grant none
  12. // @license MIT License
  13. // ==/UserScript==
  14. (function () {
  15. var processedLists = new WeakMap();
  16. // ボタンの作成
  17. var createButton = function (list) {
  18. var images = list.parentNode.parentNode.getElementById('global-actions');
  19. var button = document.createElement('li');
  20. button.setAttribute('class', 'dm-nav');
  21. button.innerHTML =
  22. ' <a data-original-title="" role="button" href="#" class="js-tooltip js-dynamic-tooltip global-dm-nav" data-placement="bottom"> ' +
  23. ' <span class="Icon Icon--dm Icon--large"></span> ' +
  24. ' <span class="text">Messages</span> ' +
  25. ' <span class="dm-new"><span class="count-inner"></span></span> ' +
  26. '</a>';
  27. button.addEventListener('click', function () {
  28. alert("you clicked");
  29. });
  30. button.addEventListener('mouseenter',function(){
  31. })
  32. button.addEventListener('mouseleave',function(){
  33. })
  34. return button;
  35. };
  36. // 新規に出現したtweetsに対してボタンを追加
  37. var addButtons = function () {
  38. images.appendChild(button);
  39. }
  40. }
  41. };
  42. // ツィートの表示件数が増えた場合
  43. (function () {
  44. var DOMObserverTimer = false;
  45. var DOMObserverConfig = {
  46. attributes: true,
  47. childList: true,
  48. subtree: true
  49. };
  50. var DOMObserver = new MutationObserver(function () {
  51. if (DOMObserverTimer !== 'false') {
  52. clearTimeout(DOMObserverTimer);
  53. }
  54. DOMObserverTimer = setTimeout(function () {
  55. DOMObserver.disconnect();
  56. addButtons();
  57. DOMObserver.observe(document.body, DOMObserverConfig);
  58. }, 100);
  59. });
  60. DOMObserver.observe(document.body, DOMObserverConfig);
  61. }) ();
  62. // 初回実行
  63. addButtons();
  64. }) ();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址