Last active
April 28, 2023 09:56
-
-
Save Namorzyny/1a6462e84a224ed60a2e45984dbb9c83 to your computer and use it in GitHub Desktop.
Force Desktop Version of Wikipedia
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 Force Desktop Version of Wikipedia | |
// @namespace github.com/namorzyny | |
// @version 2023.2.4 | |
// @match https://*.wikipedia.org/* | |
// @match https://*.m.wikipedia.org/* | |
// @run-at document-start | |
// @grant none | |
// @author namorzyny | |
// @icon https://wikipedia.org/favicon.ico | |
// @description Force Desktop Version of Wikipedia | |
// @homepageURL https://gist.github.com/Namorzyny/1a6462e84a224ed60a2e45984dbb9c83 | |
// ==/UserScript== | |
(() => { | |
const newURL = new URL(location.href); | |
newURL.host = newURL.host.replace('.m.', '.'); | |
if (newURL.host.startsWith('zh')) { | |
const title = newURL.pathname.split('/').pop(); | |
if (newURL.pathname.startsWith('/zh-tw/')) return; | |
newURL.pathname = '/zh-tw/' + title; | |
location.href = newURL.toString(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment