###########################自用网页增强工具

自用

  1. // ==UserScript==
  2. // @name ###########################自用网页增强工具
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description 自用
  6. // @author baideye.com
  7. // @match *://*.uviewui.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=uviewui.com
  9. // @grant none
  10. // @require https://libs.baidu.com/jquery/2.0.0/jquery.min.js
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. // 创建最外层盒子box和目录toc
  15. $("#app").prepend("<div id='box'><div id='toc'></div></div>");
  16. $("#box").css({
  17. "display": "flex",
  18. "flex-direction": "column",
  19. "position": "fixed",
  20. "left": "0",
  21. "top":"20%",
  22. "z-index": "9999999",
  23. "background": "#fff",
  24. "border": "1px solid #dee1ed",
  25. "padding": "10px",
  26. "font-size": "16px",
  27. "width":"145px",
  28. });
  29. $("#toc").css({
  30. "display": "flex",
  31. "flex-direction":" column",
  32. })
  33. // h3
  34. creatToc()
  35. $("#box").append("<div id='reset'>刷新</div>");
  36. $("#reset").css({
  37. "margin": "20px auto 10px",
  38. "background": "#2a955f",
  39. "color": "#fff",
  40. "padding": "5px 30px",
  41. "border-radius": "5px",
  42. })
  43.  
  44. $("#reset").bind('click', function() {
  45. $("#toc").empty() ;
  46. creatToc()
  47. })
  48.  
  49. function creatToc(){
  50. // 创建目录
  51. let h3Arr = document.querySelectorAll("h3");
  52. for(let value of h3Arr){
  53. $("#toc").append("<a id='h3' class='text' href=' "+ value.querySelector("a").href +" '>"+value.innerText+"</a>");
  54. }
  55. // 添加css
  56. $(".text").css({
  57. "color": "#555",
  58. "margin-top": "15px",
  59. "font-weight": "normal",
  60. });
  61. }
  62. // $(window).bind('hashchange', function() {
  63. // location.reload();
  64. // });
  65.  
  66.  

QingJ © 2025

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