This is from Vhanla's post on "Another Site" (It is not created by me!!):
Hi folks, today I will teach you how to take advantage of the built-in userscript feature of Google Chrome to have a mouse gesture for navigating through history, I mean, back and forward.
First you need to have that feature enabled, so you need to activate that with these simples steps (if you don't know how)
For XP users go to Default folder (or the profile you're using) and create the directory "User Scripts" just like this
C:\Documents and Settings\<you username>\Local Settings\Application Data\Google\Chrome\User Data\Default\User Scripts
For Vista or 7 users
C:\Users\Administrator\AppData\Local\Google\Chrome \User Data\Default\User Scripts
After that you need to start Google Chrome with "--enable-user-scripts" parameter
And finally the UserScript:
Now open the Notepad and paste that code, and save that in the user scripts directory, remember that it must have js extension, so in order to succed, save as "mousegestures.user.js" with "" included inside of that directory.Code:// ==UserScript== // @name Mouse Gestures for Google Chrome // @author vhanla // @namespace http://www.codigobit.net/ // @version 1.0 // @description Allows to use mouse gestures for navigating through pages // @include * // @exclude // ==/UserScript== (function() { var posx = 0; var estado = false; var gestdown = function() { if (event.which) button= (event.which < 2) ? "LEFT" : ((event.which == 2) ? "MIDDLE" : "RIGHT"); if (button=="RIGHT"){ estado=true; posx=event.clientX; document.oncontextmenu = new Function("return false") } } var gestup = function() { if (estado){ estado=false; if(event.clientX+100<posx){ window.history.back(); } else if(event.clientX-100>posx){ window.history.forward(); } else void(document.oncontextmenu=null) } } window.addEventListener("mousedown", gestdown, false); window.addEventListener("mouseup", gestup, false); })();
Ok, that is all, now you can hold the right button and drag back or forward in order to navigate.
I prefer this method instead of having external programs.
I don't know how to send keystrokes with javascript. However, I would suggest another method just like Opera.
With Speedymarks you can emulate Opera's speed dial page. You don't need to be logged in if you want, and also you can set up to open in a different tab or in the same.Code:// ==UserScript== // @name Mouse Gestures for Google Chrome // @author vhanla // @namespace http://www.codigobit.net/ // @version 1.0 // @description Allows to use mouse gestures for navigating through pages // @include * // @exclude // ==/UserScript== (function() { var posx = 0; var posy = 0; var estado = false; var gestdown = function() { if (event.which) button= (event.which < 2) ? "LEFT" : ((event.which == 2) ? "MIDDLE" : "RIGHT"); if (button=="RIGHT"){ estado=true; posx=event.clientX; posy=event.clientY; document.oncontextmenu = new Function("return false") } } var gestup = function() { if (estado){ estado=false; if(event.clientX+50<posx){ window.history.back(); } else if(event.clientX-50>posx){ window.history.forward(); } else if(event.clientY-50>posy){ window.open("http://www.speedymarks.com"); } else void(document.oncontextmenu=null) } } window.addEventListener("mousedown", gestdown, false); window.addEventListener("mouseup", gestup, false); })();
Well for disabling you can add the following code into this existing one
Maybe there is a better method to disable in all the page, but with this one you can only disable specific tagsCode:var notooltips = function() { var titles = document.getElementsByTagName("a"); for (var x = titles.length - 1 ; x>=0;x--) titles[x].title = ""; var titlestd = document.getElementsByTagName("td"); for ( x = titlestd.length - 1 ; x>=0;x--) titlestd[x].title = ""; var alts = document.getElementsByTagName("img"); for (x = alts.length - 1 ; x>=0;x--) alts[x].setAttribute('title',''); } window.addEventListener("load",notooltips, false);


LinkBack URL
About LinkBacks




Reply With Quote

