Friday, March 27, 2009

TapScroll, Great script for MicroB, a must

Tapscroll is a script that can make you easily scroll page down in MicroB.
First, need to install 'Greasemonkey'
http://browser-extras.garage.maemo.org/downloads_os2008.html

then, intall the Tapscroll script:
http://userscripts.org/scripts/show/23768

REF:
SourceCode:
// ==UserScript==
// @name TapScroll
// @namespace http://chum54.blog103.fc2.com/
// @include *
// @exclude http://mail.google.com/*
// @version 0.0.2
// ==/UserScript==
(function () {
var scroll = {
'h' : function() { scrollBy(-50, 0) }, // scroll left
'l' : function() { scrollBy( 50, 0) }, // scroll right
'j' : function() { scrollBy(0, 40) }, // scroll down
'k' : function() { scrollBy(0, -40) }, // scroll up
'n' : function() { scrollBy(0, 150) }, // scroll down more
'p' : function() { scrollBy(0, -150) }, // scroll up more
'g' : function() { scrollTo(0, 0) }, // move to page top
'f' : function() { history.forward() }, // move to page top
'b' : function() { history.back() }, // move to page top
't' : function() { toggle_bar() }, // toggle bar
'd' : function() { scrollBy(0, window.innerHeight / 2) }, // scroll half down
'u' : function() { scrollBy(0, -window.innerHeight / 2) }, // scroll half up
};
var formElement = { 'input':true, 'button':true, 'select':true, 'textarea':true };
window.addEventListener('keypress',
function(e) {
if (e.metaKey e.ctrlKey e.altKey
formElement[e.target.tagName.toLowerCase()]) {
return;
}
var key = (e.shiftKey? 'S-' : '') + String.fromCharCode(e.charCode);
if (scroll[key]) {
scroll[key]();
e.preventDefault();
e.stopPropagation();
}
}, false);
function toggle_bar() {
if(document.getElementById("tapscroll_bar_down").style.display == "table"){
//hide("tapscroll_bar_up");
hide("tapscroll_bar_down");
}else {
//show("tapscroll_bar_up");
show("tapscroll_bar_down");
}
}
function hide(id){
document.getElementById(id).style.display = "none";
}
function show(id){
document.getElementById(id).style.display = "table";
}
// ignore inner frame
if (String(window.frameElement).indexOf('HTMLIFrameElement') < 0){
focus();
// Page up
//pageup=document.createElement("div");
//pageup.innerHTML="
UP
";
//document.body.appendChild(pageup);
// Page down and top
pagedown=document.createElement("div");
pagedown.innerHTML="
DOWNTOPDOWN
";
document.body.appendChild(pagedown);
}
})();

No comments:

Post a Comment