Created
November 18, 2022 16:42
-
-
Save LOuroboros/7e7204e14dd5612f3486af29b66fae97 to your computer and use it in GitHub Desktop.
Force Mobile Bulbapedia
This file contains hidden or 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 Force Mobile Bulbapedia | |
// @match *://bulbapedia.bulbagarden.net/* | |
// @run-at document-start | |
// @grant none | |
// ==/UserScript== | |
var oldUrlPath = window.location.pathname; | |
// Check if ".m" is present in the URL. If not, append it before the host. | |
if (window.location.href.indexOf(".m") <= -1) | |
{ | |
var newURL = window.location.protocol + "//" + "m." | |
+ window.location.host | |
+ oldUrlPath | |
+ window.location.search | |
+ window.location.hash | |
; | |
// replace() puts the good page in the history instead of the bad page. | |
window.location.replace (newURL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment