Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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