Skip to content

Instantly share code, notes, and snippets.

@Namorzyny
Last active April 28, 2023 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Namorzyny/1a6462e84a224ed60a2e45984dbb9c83 to your computer and use it in GitHub Desktop.
Save Namorzyny/1a6462e84a224ed60a2e45984dbb9c83 to your computer and use it in GitHub Desktop.
Force Desktop Version of Wikipedia
// ==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