Keylol_手机版优化

移除一些元素

  1. // ==UserScript==
  2. // @name:zh-CN Keylol_手机版优化
  3. // @name Keylol_Mobile_Tweaker
  4. // @namespace https://blog.chrxw.com
  5. // @supportURL https://blog.chrxw.com/scripts.html
  6. // @contributionURL https://afdian.com/@chr233
  7. // @version 1.0
  8. // @description 移除一些元素
  9. // @description:zh-CN 移除一些元素
  10. // @author Chr_
  11. // @match https://keylol.com/*
  12. // @license AGPL-3.0
  13. // @icon https://blog.chrxw.com/favicon.ico
  14. // ==/UserScript==
  15.  
  16.  
  17. (() => {
  18. "use strict";
  19.  
  20. const isPc = !!document.querySelector('a[href="forum.php?mobile=yes"]')
  21.  
  22. if (!isPc) {
  23. const replay = document.getElementById('fastpostform');
  24. if (replay) {
  25. replay.style.display = "none";
  26. }
  27. }
  28.  
  29. tweakerBtns();
  30.  
  31. const observer = new MutationObserver((mutations) => {
  32. mutations.forEach((mutation) => {
  33. if (mutation.addedNodes.length > 0) {
  34. tweakerBtns();
  35. }
  36. });
  37. });
  38.  
  39. observer.observe(document.body, { childList: true, subtree: true });
  40.  
  41. function tweakerBtns() {
  42. const rateBtns = document.querySelectorAll('div[id^="dppf"]>a');
  43. if (rateBtns.length > 0) {
  44. for (let btn of rateBtns) {
  45. const span = document.createElement('span');
  46. span.innerHTML = btn.innerHTML;
  47. span.style.margin = "0 3px";
  48. btn.parentNode.replaceChild(span, btn);
  49. }
  50. }
  51.  
  52. const ratePcBtns = document.querySelectorAll('div.pob.cl>em>a');
  53. if (ratePcBtns.length > 0) {
  54. for (let btn of ratePcBtns) {
  55. const span = document.createElement('span');
  56. span.innerHTML = btn.innerHTML;
  57. span.className = btn.className;
  58. span.style.padding = "5px 10px 5px 25px";
  59. btn.parentNode.replaceChild(span, btn);
  60. }
  61. }
  62. }
  63. })();

QingJ © 2025

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