Skip to content

Instantly share code, notes, and snippets.

@girvan
Created November 24, 2011 06:22
Show Gist options
  • Save girvan/1390751 to your computer and use it in GitHub Desktop.
Save girvan/1390751 to your computer and use it in GitHub Desktop.
Javascript bookmark for scrolling test
javascript:(function () { var scroll_length = 20; var stuck_threshold = 2; var height = 4000; var url = window.location.href.split("url=")[1]; var wait = parseInt(url.split("#")[1]); var start_time = new Date().getTime() / 1000; var yo = function () { document.getElementById('ttt').contentWindow.document.getElementById('footer-links').innerHTML += "<div style='background-color:gray;width:10px;position:absolute;height:" + height + "px;top:0;left:0;'>&nbsp;<\/div>"; var win = document.getElementById('ttt').contentWindow; var doc = document.getElementById('ttt').contentWindow.document; var i = 0; var last = 0; while (i < height) { win.scrollTo(0, i); i += scroll_length; } alert("#take:" + ((new Date().getTime() / 1000) - start_time - wait / 1000)); }; setTimeout(yo, wait); document.body.innerHTML = ("<iframe id='ttt' src='" + url + "' width='100%' height='100%'></iframe>"); })();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment