Cloudflare Plus

Remove or fix ugly Cloudflare generated parameters from the url.

目前为 2021-10-09 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Cloudflare Plus
  3. // @namespace https://greasyfork.org/users/592063
  4. // @version 0.1.1
  5. // @author wuniversales
  6. // @description Remove or fix ugly Cloudflare generated parameters from the url.
  7. // @icon https://icons.duckduckgo.com/ip2/cloudflare.com.ico
  8. // @include /__cf_chl_(jschl|captcha|managed)_tk__=/
  9. // @run-at document-start
  10. // @grant none
  11. // @noframes
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16. if(document.querySelectorAll("div[class^='cf-'").length==0){
  17. const oldUrl = window.location.href;
  18. const url = new URL(oldUrl);
  19. const params = url.searchParams;
  20. const key=['jschl','captcha','managed'];
  21. for (let i = 0; i < key.length; i++) {
  22. params.delete('__cf_chl_'+key[i]+'_tk__');
  23. }
  24. const newUrl = url.toString();
  25. if(newUrl!==oldUrl){
  26. window.location.replace(newUrl);
  27. }
  28. }
  29. })();