Link to LeetCode English

Add a link to the same problem of the LeetCode English site.

  1. // ==UserScript==
  2. // @name Link to LeetCode English
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Add a link to the same problem of the LeetCode English site.
  6. // @author Ernest
  7. // @match https://leetcode-cn.com/problems/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=leetcode-cn.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Your code here...
  17. var elemDiv = document.createElement('div');
  18. elemDiv.style.cssText = 'position: absolute; width: 60px; left:45%; top:10px;';
  19. elemDiv.innerHTML += "<a href=" + document.URL.replace("-cn","") + " target='_blank'> English";
  20. document.body.appendChild(elemDiv);
  21. })();