Escape From WebVPN

避免WebVPN劫持CC98站外链接

目前为 2022-03-01 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Escape From WebVPN
  3. // @version 0.0.3
  4. // @description 避免WebVPN劫持CC98站外链接
  5. // @icon https://www.cc98.org/static/98icon.ico
  6. // @author ml98
  7. // @namespace http://tampermonkey.net/
  8. // @license MIT
  9. // @match http://www-cc98-org-s.webvpn.zju.edu.cn:8001/*
  10. // @run-at document-idle
  11. // @grant none
  12. // ==/UserScript==
  13. /* eslint-env jquery */
  14. /* global revertUrl */
  15.  
  16. function escapeFromWebVPN() {
  17. $(document).on('click', 'a', function(e) {
  18. if(revertUrl && this.href && !(new URL(this.href).host.includes('cc98.org'))) {
  19. e.preventDefault();
  20. window.open().location = revertUrl(this.href);
  21. return false;
  22. }
  23. });
  24. }