However, a lot of times people will link to m.fanfiction.net/s/12345/1/ instead of www.fanfiction.net/s/12345/1/. This takes me to the mobile version. Is there any way to automatically change the hostname portion of the URL from m to www?
There used to be a greasemonkey script to redirect links from the defunct userscripts.org to users-mirror.org, but my attempt to modify it to do the same thing with Pit of Voles has met with failure. I haven't seen a link to userscripts.org in years, so I don't know if the script just doesn't work with modern Firefox (I'm pretty sure it was around Firefox 4 or maybe 3.6) or if I screwed up.
This is the old redirect script:
Code: Select all
// ==UserScript==
// @name Redirect Userscripts.org to Userscripts-MIRROR.org
// @namespace uso2usom
// @description On any web page it will check if the clicked links goes to userscripts.org. If so, the link will be rewritten to point to userscripts-mirror.org
// @include http://*.*
// @include https://*.*
// @exclude http://userscripts.org/*
// @exclude https://userscripts.org/*
// @exclude http://userscripts.org:8080/*
// @exclude https://userscripts.org:8080/*
// @version 1
// @grant none
// ==/UserScript==
// This is a slightly brute force solution, but there is no other way to do it using only a userscript. A full-fledged addon may be created soon.
document.body.addEventListener('click', function(e){
var targ = e.target || e.srcElement;
if ( targ && targ.href && targ.href.match('https?:\/\/userscripts.org') ) {
targ.href = targ.href.replace('://userscripts.org', '://userscripts-mirror.org');
}
});
Code: Select all
// ==UserScript==
// @name Redirect m.fanfiction.net to www.fanfiction.net
// @namespace uso2usom
// @description On any web page it will check if the clicked links goes to m.fanfiction.net. If so, the link will be rewritten to point to www.fanfiction.net
// @include http://*.*
// @include https://*.*
// @exclude http://m.fanfiction.net/*
// @exclude https://m.fanfiction.net/*
// @exclude http://m.fanfiction.net:8080/*
// @exclude https://m.fanfiction.net:8080/*
// @version 1
// @grant none
// ==/UserScript==
// This is a slightly brute force solution, but there is no other way to do it using only a userscript. A full-fledged addon may be created soon.
document.body.addEventListener('click', function(e){
var targ = e.target || e.srcElement;
if ( targ && targ.href && targ.href.match('https?:\/\/m.fanfiction.net') ) {
targ.href = targ.href.replace('://m.fanfiction.net', '://www.fanfiction.net');
}
});
If there is something else I can use instead, I'm open to suggestions.