Created
January 26, 2010 11:00
-
-
Save satyr/286741 to your computer and use it in GitHub Desktop.
topsy auto more
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name topsy auto more | |
// @namespace http://d.hatena.ne.jp/murky-satyr | |
// @include http://topsy.com/* | |
// ==/UserScript== | |
addEventListener('scroll', function f(){ | |
function stop(){ removeEventListener('scroll', f, false) } | |
try { | |
let a = document.querySelector('#more-bucket-more a'); | |
if(!a || /\b0\b/.test(a.textContent)) return stop(); | |
let wt = Array.slice(document.querySelectorAll('.wf-top'), -1)[0]; | |
var {bottom} = wt.getBoundingClientRect(); | |
if(bottom - scrollY < innerHeight * 2){ | |
let ev = document.createEvent('MouseEvents'); | |
ev.initMouseEvent('click', 1, 1, window, 0, 0,0,0,0, 0,0,0,0, 0, a); | |
a.dispatchEvent(ev); | |
} | |
} catch(e){ | |
GM_log(e); | |
stop(); | |
} | |
}, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment