vue文档修改阅读背景

vue文档修改阅读背景颜色

目前为 2022-10-27 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name vue文档修改阅读背景
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description vue文档修改阅读背景颜色
  6. // @author You
  7. // @require https://cdn.bootcdn.net/ajax/libs/jquery/3.2.1/jquery.min.js
  8. // @require https://code.jquery.com/ui/1.13.2/jquery-ui.js
  9. // @icon https://s1.ax1x.com/2022/09/05/v7FgKO.jpg
  10. // @match https://vuex.vuejs.org/*
  11. // @match https://cn.vuejs.org/*
  12. // @match https://cn.vitejs.dev/*
  13. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  14. // @grant none
  15. // @license MIT
  16. // ==/UserScript==
  17.  
  18. (function () {
  19. "use strict";
  20. var cssContent = {
  21. "div#CL_Console": {
  22. "-moz-user-select": "none",
  23. "-webkit-user-select": "none",
  24. "-ms-user-select": "none",
  25. "-khtml-user-select": "none",
  26. "user-select": "none",
  27. position: "fixed",
  28. top: "30%",
  29. left: "2px",
  30. "z-index": "99",
  31. },
  32. "img#CL_img": {
  33. width: "35px",
  34. "border-radius": "20px",
  35. cursor: "pointer",
  36. },
  37. ".none": {
  38. display: "none",
  39. },
  40. ".block": {
  41. display: "block",
  42. },
  43. "div#CL_OperationPanel": {
  44. width: "300px",
  45. height: "300px",
  46. background: "rgb(232 240 255 / 70%)",
  47. "backdrop-filter": "blur(3px)",
  48. position: "absolute",
  49. top: "20px",
  50. left: "35px",
  51. "box-shadow": "1px 1px 4px 0px #747698",
  52. "border-radius": "6px",
  53. padding: "10px",
  54. },
  55. "div#color-box": {
  56. height: "100px",
  57. width: "250px",
  58. margin: "auto",
  59. display: "flex",
  60. "justify-content": "space-evenly",
  61. },
  62. ".pink": {
  63. height: "50px",
  64. width: "50px",
  65. background: "red",
  66. },
  67. "input#yellow": {
  68. height: "50px",
  69. width: "50px",
  70. background: "rgb(36, 12, 15)",
  71. },
  72. "input#black": {
  73. height: "50px",
  74. width: "50px",
  75. background: "rgb(233, 172, 152)",
  76. },
  77. "div#a": {
  78. height: "50px",
  79. width: "50px",
  80. "border-radius": "50%",
  81. "background-color": "antiquewhite",
  82. "text-align": "center",
  83. "line-height": "50px",
  84. },
  85. "div#b": {
  86. height: "50px",
  87. width: "50px",
  88. "border-radius": "50%",
  89. "background-color": "lightblue",
  90. "text-align": "center",
  91. "line-height": "50px",
  92. },
  93. "div#c": {
  94. height: "50px",
  95. width: "50px",
  96. "border-radius": "50%",
  97. "background-color": "beige",
  98. "text-align": "center",
  99. "line-height": "50px",
  100. },
  101. };
  102.  
  103. // 加载控制面板
  104. $("body").append(
  105. $('<div id="CL_Console">')
  106. .append(
  107. $(
  108. '<img id="CL_img" src="https://s1.ax1x.com/2022/09/05/v7FgKO.jpg" title="控制中心"/>'
  109. )
  110. )
  111. .append(
  112. $('<div id="CL_OperationPanel" class="none">')
  113. .append($("<div>阅读背景</div>"))
  114. .append(
  115. $(`
  116. <div id="color-box">
  117. <div id="a">A</div>
  118. <div id="b">B</div>
  119. <div id="c">C</div>
  120. </div>
  121. `)
  122. )
  123. )
  124. );
  125. for (var selector in cssContent) {
  126. $(selector).css(cssContent[selector]);
  127. }
  128.  
  129. $(document).on("click", "#CL_img", function () {
  130. $("#CL_OperationPanel").toggle(200);
  131. });
  132.  
  133. //监听按钮的拖动
  134. $(function () {
  135. $("#CL_Console").draggable();
  136. console.log(9999);
  137. });
  138.  
  139. var localHost = location.host;
  140. $("#a").on("click", this, function () {
  141. $(this).css("border", "1px solid rgb(66, 62, 62)");
  142. $("#b").css("border", "");
  143. $("#c").css("border", "");
  144. if (localHost === "vuex.vuejs.org") {
  145. $(".container").eq(0).css("background-color", "antiquewhite");
  146. } else if (localHost === "cn.vuejs.org") {
  147. $(".container").eq(1).css("background-color", "antiquewhite");
  148. } else if (localHost === "cn.vitejs.dev") {
  149. $(".container").eq(2).css("background-color", "antiquewhite");
  150. }
  151. });
  152.  
  153. $("#b").on("click", this, function () {
  154. $(this).css("border", "1px solid rgb(66, 62, 62)");
  155. $("#a").css("border", "");
  156. $("#c").css("border", "");
  157. if (localHost === "vuex.vuejs.org") {
  158. $(".container").eq(0).css("background-color", "lightblue");
  159. } else if (localHost === "cn.vuejs.org") {
  160. $(".container").eq(1).css("background-color", "lightblue");
  161. } else if (localHost === "cn.vitejs.dev") {
  162. $(".container").eq(2).css("background-color", "lightblue");
  163. }
  164. });
  165. $("#c").on("click", this, function () {
  166. $(this).css("border", "1px solid rgb(66, 62, 62)");
  167. $("#a").css("border", "");
  168. $("#b").css("border", "");
  169. console.log($(".container").length);
  170. if (localHost === "vuex.vuejs.org") {
  171. $(".container").eq(0).css("background-color", "beige");
  172. } else if (localHost === "cn.vuejs.org") {
  173. $(".container").eq(1).css("background-color", "beige");
  174. } else if (localHost === "cn.vitejs.dev") {
  175. $(".container").eq(2).css("background-color", "beige");
  176. }
  177. });
  178. })();

QingJ © 2025

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