// Scroll Slut v0.1
// by xpsdeset
// @description This baby Makes it easy to Scroll web.
//Being lazy I hated to Scroll A page especially it was an endless scroll to visit the bottom of page.Also i hated to use my keyboard shortcut keys.
//Why use keyboard when we can do actual surfing with total control of mouse
//You Screen is divided into 4 logical big button see http://xpsdeset.googlepages.com/scrollslut.jpg
//double click on the button and you can goto start or bottom of the page ,view a page one screen at a time with page up or down..
// Browser Window Size and Position functions by
// copyright Stephen Chapman,
// you may copy these functions but please keep the copyright notice as well
var win,doc;
jetpack.tabs.onFocus(function()
{
win=this.contentWindow;
doc=this.contentDocument;
});
jetpack.tabs.onReady(function(_doc)
{
win=this.contentWindow;
doc=_doc;
doc.addEventListener('dblclick', function(event) {
eX=event.pageX;
eY=event.pageY;
pX=pageWidth();
pb=posBottom();
pt=posTop();
ph=pageHeight();
pY=posTop()+ph/2;
goY=0;
if(eX<=pX/2 && eY<=pY) //home
{
goY=0;
win.scrollTo(0,goY);
}
if(eX<=pX/2 && eY>pY) //end
{
goY=100000;
win.scrollTo(0,goY);
}
if(eX>pX/2 && eY<=pY) //pageUp
{
goY=eY-(ph*0.75);
if(goY<0)
goY=0;
win.scrollTo(0,goY);
}
if(eX>pX/2 && eY>pY) //pageDown
win.scrollTo(0,eY);
}, true);
});
jetpack.statusBar.append({html: '<img src="http://xpsdeset.googlepages.com/ico.png">', width: 32});
function pageWidth() {return win.innerWidth != null? win.innerWidth : doc.documentElement && doc.documentElement.clientWidth ? doc.documentElement.clientWidth : doc.body != null ? doc.body.clientWidth : null;}
function pageHeight() {return win.innerHeight != null? win.innerHeight : doc.documentElement && doc.documentElement.clientHeight ? doc.documentElement.clientHeight : doc.body != null? doc.body.clientHeight : null;}
function posTop() {return typeof win.pageYOffset != 'undefined' ? win.pageYOffset : doc.documentElement && doc.documentElement.scrollTop ? doc.documentElement.scrollTop : doc.body.scrollTop ? doc.body.scrollTop : 0;}
function posBottom() {return posTop()+pageHeight();}