您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Shows new incoming tweets. Adds a button to jump to the last tweet before adding new ones.
// ==UserScript== // @name Twitter Auto Show New Tweets // @author Denis Lugowski // @description Shows new incoming tweets. Adds a button to jump to the last tweet before adding new ones. // @include http://www.twitter.com/* // @version 1.0 // @namespace https://gf.qytechs.cn/users/96649 // ==/UserScript== // -------------- VARIABLES -------------- // var tweets = document.getElementsByClassName("stream-item"); var numTweets = tweets.length; // -------------- INTERVALS, TIMEOUTS -------------- // setInterval(function(){ if (document.querySelector('.new-tweets-bar') !== null) { document.getElementsByClassName("new-tweets-bar")[0].click(); tweets = document.getElementsByClassName("stream-item"); appendListElement(tweets.length - numTweets); numTweets = tweets.length; } }, 5000); // -------------- FUNCTIONS -------------- // function appendListElement(numNewTweets) { var li = document.createElement('li'); var navigation = document.getElementById("global-actions"); var oldNotification = document.getElementById("new_tweets_notification"); if (oldNotification !== null) navigation.removeChild(oldNotification); li.id = "new_tweets_notification"; li.innerHTML = '<a role="button" href="#lastTweet" id="scrollToTweet" data-placement="bottom" data-original-title="">\ <span class="Icon Icon--arrowDown Icon--large"></span>\ <span class="text">' + numNewTweets + ' new Tweets</span></a>'; navigation.appendChild(li); // inline eventlistener not working document.getElementById("scrollToTweet").addEventListener('click', function() { tweets[numNewTweets].scrollIntoView(true); }); }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址