Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created January 12, 2010 04:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitode909/274903 to your computer and use it in GitHub Desktop.
Save hitode909/274903 to your computer and use it in GitHub Desktop.
Twitterで「新着何件」みたいなボタンが出た瞬間にクリックする
// ==UserScript==
// @name click-new
// @namespace http://www.hatena.ne.jp/hitode909
// @include http://twitter.com/*
// @include https://twitter.com/*
// ==/UserScript==
function click(target) {
var event = document.createEvent("MouseEvents");
event.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0, false, false, false, false, 0, null);
target.dispatchEvent(event);
}
setInterval(function() {
var button = document.querySelector("#results_update,.new-tweets-bar");
if (!button || button.style.display == "none") return;
click(button);
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment