Last active
June 26, 2016 18:26
-
-
Save heavyLobster2/cc3ee6205e96c3f9c76c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Redirect Mobile Pages | |
// @description Redirects mobile pages to the desktop version | |
// @version 1.0.6 | |
// @author heavyLobster2 | |
// @namespace github.com/heavyLobster2 | |
// @downloadURL https://gist.github.com/heavyLobster2/cc3ee6205e96c3f9c76c/raw/RedirectMobilePages.user.js | |
// @include *://*.m.wikipedia.org/* | |
// @include *://m.reddit.com/* | |
// @run-at document-start | |
// @grant none | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
var oldUrl = window.location.href; | |
var newUrl = null; | |
var hostname = (new URL(oldUrl)).hostname; | |
if (hostname.includes(".m.wikipedia.org")) { | |
newUrl = oldUrl.replace(".m.wikipedia.org", ".wikipedia.org"); | |
} else if (hostname === "m.reddit.com") { | |
newUrl = oldUrl.replace("m.reddit.com", "www.reddit.com"); | |
} | |
if (newUrl !== null) { | |
window.location.replace(newUrl); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment