Always jump to leetcode.com when opening leetcode.cn
当前为
// ==UserScript==
// @name Always leetcode.com
// @namespace https://github.com/boris1993/tampermonkey-always-leetcode-com
// @version 2023-12-21
// @description Always jump to leetcode.com when opening leetcode.cn
// @author boris1993
// @license WTFPL
// @match https://leetcode.cn/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
// @grant none
// ==/UserScript==
(function() {
'use strict';
const url = new URL(document.URL);
const hostname = url.hostname;
if (hostname !== 'leetcode.cn') {
return;
}
const path = url.pathname;
const newUrl = `${url.protocol}//leetcode.com${path}`;
location.replace(newUrl);
})();