Luogu Problem Jumper

双击题号,自动跳转

目前為 2019-08-18 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Luogu Problem Jumper
  3. // @version 1.2.0
  4. // @description 双击题号,自动跳转
  5. // @author Anguei
  6. // @match https://www.luogu.org/*
  7. // @match https://*.blog.luogu.org/*
  8. // @require https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js
  9. // @grant none
  10. // @namespace Anguei
  11. // ==/UserScript==
  12.  
  13. $(document).ready(function() {
  14. $(document).dblclick(function() {
  15. var selection = window.getSelection();
  16. var selected = selection.toString();
  17. selected = selected.replace(' ', '').toUpperCase();
  18. if (isProblemId(selected)) {
  19. window.open('https://www.luogu.org/problem/' + selected);
  20. selection.removeAllRanges();
  21. }
  22.  
  23. function isProblemId(text) {
  24. if (text.match(/AT[0-9]{1,4}/) == text) return true;
  25. if (text.match(/CF[0-9]{1,4}[A-Z][0-9]{0,1}/) == text) return true;
  26. if (text.match(/SP[0-9]{1,5}/) == text) return true;
  27. if (text.match(/P[0-9]{4}/) == text) return true;
  28. if (text.match(/UVA[0-9]{1,5}/) == text) return true;
  29. if (text.match(/U[0-9]{1,6}/) == text) return true;
  30. if (text.match(/T[0-9]{1,6}/) == text) return true;
  31. return false;
  32. }
  33. });
  34. });

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址