vjudge+background

为vJudge设置背景

当前为 2023-08-15 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name vjudge+background
  3. // @namespace vjudge-plus-v2
  4. // @version 1.6
  5. // @inject-into content
  6. // @description 为vJudge设置背景
  7. // @author axototl (original by Suntra)
  8. // @match https://vjudge.net/
  9. // @match https://vjudge.net/*
  10. // @noframes
  11. // @icon https://vjudge.net/favicon.ico
  12. // @run-at document-body
  13. // @license AGPLv3
  14. // @grant GM_addStyle
  15. // @grant GM_registerMenuCommand
  16. // @grant GM_getValue
  17. // @grant GM_setValue
  18. // @run-at document-idle
  19. // ==/UserScript==
  20.  
  21. function reloader() {
  22. window.alert("设置成功,刷新生效");
  23. location.reload();
  24. }
  25.  
  26. (function() {
  27. if (navigator.userAgent.includes("Chrome") && performance.getEntries()[0].responseStatus != 200) return;
  28. // 设置背景
  29. let back = GM_getValue("background", "https://cdn.luogu.com.cn/images/bg/fe/Day_And_Night_1.jpg");
  30. GM_registerMenuCommand("设置背景URL", () => {
  31. back = window.prompt("请输入背景URL", back);
  32. GM_setValue("background", back);
  33. reloader();
  34. });
  35. let col = GM_getValue("col", "#b93e3e");
  36. let tes = /^#([0-9a-f]{3,4}|[0-9a-f]{6})$/i;
  37. GM_registerMenuCommand("设置文字颜色", () => {
  38. let tmp = col;
  39. do {
  40. tmp = window.prompt("请输入颜色的Hexcode\n(比如#b93e3e)\n建议选择背景主色调的反差色", tmp);
  41. } while (!tes.test(tmp));
  42. GM_setValue("col", tmp);
  43. reloader();
  44. });
  45.  
  46. // if(window.location.href.match(/\/problem\/description\/[^\/]+$/)) {
  47. // console.log("error!!!");
  48. // GM_addStyle(
  49. // "dd {background-color: rgba(255,255,255,70%) !important;border-radius: 0.25rem !important;}"
  50. // );
  51. // } else
  52. {
  53. GM_addStyle("body {background: #f0f0f0 url("+back+") no-repeat center top fixed;background-size: 100% 100%;-moz-background-size: 100% 100%;}");
  54. document.body.innerHTML = "<nav style='height: 60px'></nav>" + document.body.innerHTML;
  55. }
  56.  
  57. GM_addStyle(
  58. ".navbar {border-radius:0rem;background-color: rgba(0,0,0,65%) !important;position: fixed;top: 0;left: 0;z-index: 1000;width: 100%;}"+
  59. "scrollbar-width: none"+
  60. "#prob-ads {display: none;}"+
  61. "#img-support {display: none;}"+
  62. ".card, .list-group-item, .btn-secondary, .page-link, .page-item.disabled .page-link, .dropdown-menu {background-color: rgba(255,255,255,65%);}"+
  63. ".modal-content {background-color: rgba(255,255,255,90%);}"+
  64. ".form-control {background-color: rgba(255,255,255,50%);}"+
  65. ".tab-content {background-color: rgba(255,255,255,50%);border: 2px solid #eceeef;border-radius: 0.25rem;padding: 20px;}"+
  66. "a:focus, a:hover {color: #ff4c8c;text-decoration: underline;}"+
  67. "body {color: "+col+" !important;}"
  68. );
  69.  
  70. document.querySelector("body > div.body-footer").innerHTML += '<p style="color: #3fb98b">Theme powered by vjudge+background (original by <a href="https://github.com/dffxd-suntra/vjudge-plus">vjudge+</a>)</p>';
  71. })();

QingJ © 2025

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