自动跳转到leetcode.com

在访问leetcode.cn时自动跳转到leetcode.com

  1. // ==UserScript==
  2. // @name 自动跳转到leetcode.com
  3. // @namespace https://gist.github.com/boris1993/5eabcb8d10fcd7fc52cf0dbdd0a7a41b
  4. // @version 2023-12-25
  5. // @description 在访问leetcode.cn时自动跳转到leetcode.com
  6. // @author boris1993
  7. // @license WTFPL
  8. // @match https://leetcode.cn/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode.cn
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. if (location.hostname === 'leetcode.cn') {
  16. location.replace(`${location.protocol}//leetcode.com${location.pathname}`);
  17. }
  18. })();