添加 CSS 样式

向网页中添加 style 标签和自定义的 CSS 规则

  1. // ==UserScript==
  2. // @name 添加 CSS 样式
  3. // @namespace http://tampermonkey.net/
  4. // @version v1.0.0
  5. // @description 向网页中添加 style 标签和自定义的 CSS 规则
  6. // @author iuroc
  7. // @match https://developer.huawei.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=huawei.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict'
  15. const CONFIG = [
  16. {
  17. rule: () => location.hostname == 'developer.huawei.com',
  18. style: `
  19. .linenums {
  20. font-family: Consolas;
  21. }
  22.  
  23. .feedback-btn.ng-star-inserted,
  24. .app-doc-footer,
  25. .suspension-menu,
  26. .pcAccount.flex.ac.js.newStyle {
  27. display: none !important;
  28. }
  29. `
  30. }
  31. ]
  32.  
  33. CONFIG.forEach(item => {
  34. if (item.rule()) {
  35. const element = document.createElement('style')
  36. element.innerText = item.style
  37. document.body.append(element)
  38. }
  39. })
  40. })()

QingJ © 2025

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