Way to always see desktop instead of mobile FF.net

Discussion of general topics about Mozilla Firefox
Post Reply
slickrcbd
Posts: 553
Joined: September 1st, 2010, 1:57 am

Way to always see desktop instead of mobile FF.net

Post by slickrcbd »

I dislike the layout of the mobile version of fanfiction.net when reading it on a desktop computer. While I agree it has it's benefits on a smart phone, I don't like it on the desktop.

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');
    }
});
This was my attempt to modify it to work on FF.net:

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.
Post Reply