Greasy Fork is available in English.

避免洛谷提示Request Blocked

在使用洛谷时,如果回退页面或前进页面经常会遇到`Request Blocked`的情况,这个脚本能检测并自动刷新页面。

  1. // ==UserScript==
  2. // @name 避免洛谷提示Request Blocked
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.5
  5. // @description 在使用洛谷时,如果回退页面或前进页面经常会遇到`Request Blocked`的情况,这个脚本能检测并自动刷新页面。
  6. // @author gandyli
  7. // @match *://*.luogu.org/*
  8. // @exclude *://*.luogu.org/login/logout?uid=*
  9. // @exclude *://*.luogu.org/ide
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. var reg1 = new RegExp("^((?!blog).)*https://www.luogu.org((?!blog).)*$"), reg2 = new RegExp("^((?!blog).)*http://www.luogu.org((?!blog).)*$"), reg3= new RegExp("^((?!blog).)*https://www2.luogu.org((?!blog).)*$"), reg4=new RegExp("^((?!blog).)*http://www2.luogu.org((?!blog).)*$");
  16. var str = window.location.href;
  17. if (reg1.test(str) || reg2.test(str) || reg3.test(str) || reg4.test(str)){
  18. if (document.getElementById("app-header")===null)
  19. {
  20. location.reload();
  21. }}
  22. })();