Extract all tweets for Twitter

get all tweets from a page

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

// ==UserScript==
// @name        Extract all tweets for Twitter
// @name:ja     Extract all tweets for Twitter
// @namespace   https://gf.qytechs.cn/ja/users/100769-atul-k
// @description get all tweets from a page
// @description:hget all the tweets from a page
// @description:ja get all the text in one go
// @include     https://twitter.com/*
// @author      atul
// @version     0.0.1
// @grant       none
// @license     MIT License
// ==/UserScript==
(function () {  
  var processedLists = new WeakMap();
  
  // ボタンの作成
  var createButton = function (list) {
    var images = list.parentNode.parentNode.getElementById('global-actions');
    var button = document.createElement('li');
    button.setAttribute('class', 'dm-nav');
    button.innerHTML = 
       ' <a data-original-title="" role="button" href="#" class="js-tooltip js-dynamic-tooltip global-dm-nav" data-placement="bottom"> ' +
        '  <span class="Icon Icon--dm Icon--large"></span> ' +
        '  <span class="text">Messages</span> ' +
        '  <span class="dm-new"><span class="count-inner"></span></span> '  +
        '</a>';
    button.addEventListener('click', function () {
      alert("you clicked");
    });
    button.addEventListener('mouseenter',function(){
      
    })
    button.addEventListener('mouseleave',function(){
      
    })
    return button;
  };
  
  // 新規に出現したtweetsに対してボタンを追加
  var addButtons = function () {
        images.appendChild(button);
      }
    }
  };
  
  // ツィートの表示件数が増えた場合
  (function () {
    var DOMObserverTimer = false;
    var DOMObserverConfig = {
      attributes: true,
      childList: true,
      subtree: true
    };
    var DOMObserver = new MutationObserver(function () {
      if (DOMObserverTimer !== 'false') {
        clearTimeout(DOMObserverTimer);
      }
      DOMObserverTimer = setTimeout(function () {
        DOMObserver.disconnect();
        addButtons();
        DOMObserver.observe(document.body, DOMObserverConfig);
      }, 100);
    });
    DOMObserver.observe(document.body, DOMObserverConfig);
  }) ();
  
  // 初回実行
  addButtons();
}) ();

QingJ © 2025

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