Photo URL cleaning
|
|
First off, this is a GREAT script. Very helpful. But I have one major problem. When browsing images, if you click through too fast, the page will continue to jump back to previous items as the browser does catchup with the JavaScript. This cannot be resolved with a simple exclude filter, because if |
|
|
That's a good idea. The photo thing has always annoyed me too; my current "fix" is to go through photos very slowly. |
|
|
Hey, I worked the revision into the code. Basically if you are browsing around the photos section it will do nothing if there are two 'photo.php's in the title. Here is the code.
// ==UserScript==
// @name Facebook | URL Cleaner
// @namespace http://www.theworldofstuff.com/greasemonkey/
// @description Cleans Facebook URLs that don't actually take you to a new page.
// @include http://*.facebook.com/*
// ==/UserScript==
window.gm_cleanURL = function() {
// if the url is ugly
var reg = /^(https?:\/\/([-a-z0-9]+\.)*facebook\.com)\/[^#]+#(\/.+)/i;
// Photo exception added 4/15/09 by Ron Troyer
// if the url is *photo.php*photo.php*
var photo = /.*photo\.php.*photo\.php.*/i;
//change it if url is ugly and not photo page
if ((reg.test(window.location.href)) && (!(photo.test(window.location.href)))) {
var foo = window.location.href.replace(reg,'$1$3');
window.location.replace(foo);
}
// if not, wait till it is
else {
window.setTimeout(gm_cleanURL, 2000);
}
}
gm_cleanURL();
|