Skip to content

Instantly share code, notes, and snippets.

@lac5
Last active June 17, 2024 15:04
Show Gist options
  • Save lac5/0605f29df9e4dcf2dd8608c13f87f231 to your computer and use it in GitHub Desktop.
Save lac5/0605f29df9e4dcf2dd8608c13f87f231 to your computer and use it in GitHub Desktop.
Refreshes the timeline items automatically every 10 sec. (Original from <https://greasyfork.org/en/scripts/16553-twitter-auto-refresh/code?locale_override=1%27A%3D0%27>)
// ==UserScript==
// @name Twitter auto-refresh
// @namespace larryc5
// @version 1.3
// @description Refreshes the timeline items automatically every 10 sec. (Original from <https://greasyfork.org/en/scripts/16553-twitter-auto-refresh/code?locale_override=1%27A%3D0%27>)
// @author Larry Costigan
// @match https://twitter.com/*
// @grant none
// @downloadURL https://gist.github.com/larryc5/0605f29df9e4dcf2dd8608c13f87f231/raw/twitter-auto-refresh.user.js
// @updateURL https://gist.github.com/larryc5/0605f29df9e4dcf2dd8608c13f87f231/raw/twitter-auto-refresh.meta.js
// ==/UserScript==
// ==UserScript==
// @name Twitter auto-refresh
// @namespace larryc5
// @version 1.3
// @description Refreshes the timeline items automatically every 10 sec. (Original from <https://greasyfork.org/en/scripts/16553-twitter-auto-refresh/code?locale_override=1%27A%3D0%27>)
// @author Larry Costigan
// @match https://twitter.com/*
// @grant none
// @downloadURL https://gist.github.com/larryc5/0605f29df9e4dcf2dd8608c13f87f231/raw/twitter-auto-refresh.user.js
// @updateURL https://gist.github.com/larryc5/0605f29df9e4dcf2dd8608c13f87f231/raw/twitter-auto-refresh.meta.js
// ==/UserScript==
(function(window) {
'use strict';
var document = window.document;
var location = window.location;
setInterval(function() {
if (!document.hidden && /^\/+(?:home|[^\/]*\/lists\/[^\/]*)?\/*$/i.test(location.pathname) && window.scrollY <= 1) { // Get new tweets only when not seeing tweets down the timeline
var homeButton = document.querySelector('[href="/home"]');
if (homeButton) {
homeButton.click();
}
}
}, 10000);
}(window));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment