// ==UserScript== // @name twitterReload // @namespace http://d.hatena.ne.jp/javascripter/ // @include http://twitter.com/home // ==/UserScript== (function() { const INTERVAL = 5*1000*60; setInterval(replaceTimeLine, INTERVAL); function replaceTimeLine() { var iframe = document.body.appendChild(document.createElement('iframe')); iframe.style.display = 'none'; iframe.src = 'http://twitter.com'; iframe.contentWindow.addEventListener('DOMContentLoaded', function() { var timeLine = document.getElementById('timeline'); var newTimeLine = document.importNode(iframe.contentDocument.getElementById('timeline'), true); timeLine.parentNode.replaceChild(newTimeLine, timeLine); setTimeout(function() { iframe.parentNode.removeChild(iframe) }, 0); }, false); } })();
updateボタンを押すとAjaxにリロードされるからきっとこんなことやらなくて平気なんだろうけど、分からなかったからiframeに読み込んでゴチャゴチャやってる。
Twitterは重いから、INTERVALを大きめにしたほうがいいかもしれない。