🏠 Home 

CSDN 优化

优化 CSDN 体验


安装此脚本?
  1. // ==UserScript==
  2. // @name CSDN 优化
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3.2
  5. // @description 优化 CSDN 体验
  6. // @author share121
  7. // @match https://blog.csdn.net/*/article/details/*
  8. // @icon https://g.csdnimg.cn/static/logo/favicon32.ico
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12. window.addEventListener(
  13. 'copy',
  14. e => (e.stopImmediatePropagation?.(), e.stopPropagation(), !1),
  15. !0
  16. )
  17. setTimeout(() => {
  18. document
  19. .querySelectorAll('a')
  20. .forEach(e =>
  21. e.addEventListener(
  22. 'click',
  23. a => (
  24. a.stopImmediatePropagation?.(),
  25. a.stopPropagation(),
  26. (e.target = '_blank'),
  27. !1
  28. ),
  29. !0
  30. )
  31. )
  32. }, 500)
  33. document.querySelectorAll('pre, code').forEach(e => {
  34. e.style.cssText +=
  35. '-webkit-touch-callout:auto;-webkit-user-select:auto;-khtml-user-select:auto;-moz-user-select:auto;-ms-user-select:auto;user-select:auto;'
  36. })
  37. document.querySelectorAll('.hljs-button.signin').forEach(e => {
  38. e.onclick = a => {
  39. a.stopPropagation()
  40. navigator.clipboard.writeText(e.parentNode.innerText).then(() => {
  41. e.dataset.title = '复制成功'
  42. setTimeout(() => {
  43. e.dataset.title = '复制'
  44. }, 3000)
  45. })
  46. }
  47. e.dataset.title = '复制'
  48. })
  49. let tmp = setInterval(() => {
  50. let button = document.querySelector('#passportbox > span')
  51. if (button) {
  52. clearInterval(tmp)
  53. button.click()
  54. }
  55. })
  56. document.querySelector('#article_content').style.height = 'auto'
  57. document.querySelector('.hide-article-box.hide-article-pos')?.remove()
  58. document.querySelector('#blogExtensionBox')?.remove()
  59. document.querySelectorAll('.look-more-preCode').forEach(e => e.click())
  60. document
  61. .querySelectorAll('.newcomment-list .ellipsis')
  62. .forEach(e => e.classList.remove('ellipsis'))