Skip to content

Instantly share code, notes, and snippets.

@satyr
Created January 26, 2010 11:00
Show Gist options
  • Save satyr/286741 to your computer and use it in GitHub Desktop.
Save satyr/286741 to your computer and use it in GitHub Desktop.
topsy auto more
// ==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