// ==UserScript== // @name mouseless-autoscroll // @namespace Utopiah // @description autoscroll without using your hands (keep them for the coffee cup ;) // @include * // @exclude *?action=edit // @exclude *tube.com/* // @exclude *cartoons* // @exclude *://mail.google.com/* // @exclude *video* // @exclude *.tv/* // @exclude *vimeo.com/* // @exclude *putlocker.com/file/* // @require http://ecmanaut.googlecode.com/svn/trunk/lib/gm/$x$X.js // ==/UserScript== // the require script is a part of ecmanaut grand project // to re-organize the world starting with the annoying interface to the DOM API /* * Script homepage : http://userscripts.org/forums/1/topics/2150 * To do : check the homepage http://fabien.benetou.fr/Tools/Greasemonkey#MouselessAutoscroll */ //=================================== Configuration ======================================= var SPEED_STEP=1; // step size for increase and decrease of speed var BASE_TIME=4; // default scrolling speed in speed-step var MAX_SLOWEST_SPEED=10; // define the slowest speed-step var speed=GM_getValue("speed", BASE_TIME); // load last speed value var timer = null; // handle for the periodic call to the scrolling function //=================================== Core ============================================= // loop as fast as required, don't loop when speed is inferior to the small timestep function reset_timer() { if (timer) { window.clearTimeout(timer); }; if (speed >= MAX_SLOWEST_SPEED) timer = null; else timer = window.setInterval(scroll, Math.exp(speed)); } // actually scroll the window one pixel down function scroll () { window.scrollBy(0, 1); }; // Reminder : use window.scrollBy(0, -1) to scroll up // call the scrolling loop reset_timer(); //=================================== Interface ========================================= function scroll_faster () { if(speed>=SPEED_STEP){ speed-=SPEED_STEP; } // else { find a way to display to the user we reached the maximum speed... any idea ? } hideallbuttons(); // instead each action should individually self-clean their picture with a setTimeout // that would need 5 different functions because of the setTimeout Greasemonkey specificity // (especially since we can't specify parameters within setTimeout call in GM afaik) var button = document.getElementById('button_faster'); button.style.visibility="visible"; setTimeout(hideallbuttons,2000); reset_timer(); }; function scroll_slower () { if(speed>=MAX_SLOWEST_SPEED-SPEED_STEP) { speed=MAX_SLOWEST_SPEED; scroll_pause(); return;} if(speed