//
// This is a Greasemonkey user script. It allows you to "right double click"
// to navigate back from a web page. To use it, whenever you click the Back
// button, instead just double click the page using the right mouse button.
//
// 
// Greasemonkey is a Firefox only extension, this will not work if
// you use IE.
//
// To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "RightDoubleClickBack", and click Uninstall.
//
// Written by Damien Katz and placed into the public domain.
//
// ==UserScript==
// @name           RightDoubleClickBack
// @namespace      http://damienkatz.net
// @description    When you right double click, it goes back in the browser history
// @include        *
// ==/UserScript==


(function () {
	
	// adjust this to change the double click speed
	var DBL_CLICK_SPEED_MSECS = 600;
		
	function onmousedown(ev) {
		if (ev.button == 2) {
			var now = new Date();
			
			if (lastClickTime.getTime() + DBL_CLICK_SPEED_MSECS > now.getTime()) {
				history.back();
			}
			else {
				lastClickTime = now;
			}
		}
	}	
	
	var lastClickTime = new Date();
	
	document.body.addEventListener("mousedown", onmousedown, true);
	
})();




