Skip to content

Instantly share code, notes, and snippets.

@xatier
Last active August 5, 2023 10:32
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 xatier/c66f99ef825a4ec4ea8d8896c39f848f to your computer and use it in GitHub Desktop.
Save xatier/c66f99ef825a4ec4ea8d8896c39f848f to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Wikiwand 自動 zh-TW 切換
// @namespace https://www.wikiwand.com/
// @version 0.0.3
// @description switch to zh-tw automatically
// @author xatier
// @match https://www.wikiwand.com/zh/*
// @match https://www.wikiwand.com/zh-hant/*
// @match https://www.wikiwand.com/zh-hk/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=wikiwand.com
// ==/UserScript==
(function() {
'use strict';
let url = `${window.location.protocol}//${window.location.hostname}${window.location.port}${window.location.pathname.replace(/^\/(zh|zh-hant|zh-hk)\//, '\/zh-tw\/')}`;
console.log(`redircting to ... ${url}`);
window.location.href = url;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment