shumin-微信读书

自用特化版本,原版参见https://gf.qytechs.cn/zh-CN/scripts/421994

  1. // ==UserScript==
  2. // @name shumin-微信读书
  3. // @version 2.0.0
  4. // @namespace http://tampermonkey.net/
  5. // @description 自用特化版本,原版参见https://gf.qytechs.cn/zh-CN/scripts/421994
  6. // @contributor Li_MIxdown;hubzy;xvusrmqj;LossJ;JackieZheng;das2m;harmonyLife;SimonDW
  7. // @author qianjunlang
  8. // @match https://weread.qq.com/web/reader/*
  9. // @icon https://weread.qq.com/favicon.ico
  10. // @grant GM_log
  11. // @grant GM_addStyle
  12. // @grant unsafeWindow
  13. // @grant GM_setValue
  14. // @grant GM_getValue
  15. // @grant GM_openInTab
  16. // @grant GM_download
  17. // @grant GM_setClipboard
  18. // @grant GM_notification
  19. // ==/UserScript==
  20. 'use strict';
  21.  
  22. /*
  23. GM_addStyle('*{font-family: FangSong !important;}');
  24. //GM_addStyle(".readerChapterContent{color: #FeFeFe;}");
  25. var style_tag = document.createElement('style');
  26. style_tag.innerHTML = `
  27. .bookInfo_title, .readerHeaderButton, .readerFooter_button, .readerTopBar, .readerTopBar_title_link, .readerTopBar_title_chapter, .actionItem.addShelfItem {
  28. font-family: Microsoft YaHei UI !important;
  29. }
  30. `;
  31. document.head.appendChild(style_tag);
  32. */
  33.  
  34. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  35.  
  36. window.addEventListener('load', function() {
  37.  
  38. function getCurrentMaxWidth(element) {
  39. let currentValue = window.getComputedStyle(element).maxWidth;
  40. currentValue = currentValue.substring(0, currentValue.indexOf('px'));
  41. currentValue = parseInt(currentValue);
  42. return currentValue;
  43. }
  44. function changeWidth(increse) {
  45. const item1 = document.querySelector(".readerContent .app_content");
  46. const item2 = document.querySelector('.readerTopBar');
  47. const currentValue = getCurrentMaxWidth(item1);
  48.  
  49. item1.style['max-width'] = item2.style['max-width'] = parseInt( currentValue + 100*increse ) + 'px';
  50.  
  51. const myEvent = new Event('resize');
  52. window.dispatchEvent(myEvent)
  53. }
  54.  
  55.  
  56. //$(".readerControls_item.isNormalReader").css("display", "none"); // 删除双栏
  57. const downloadBtn = document.querySelector(".readerControls_item.download");
  58. if (downloadBtn) downloadBtn.style.display = "none"; // 删除下载APP按钮
  59. const wetypeBtn = document.querySelector(".readerControls_item.wetype");
  60. if (wetypeBtn) wetypeBtn.style.display = "none"; // 删除微信输入
  61.  
  62.  
  63. const controls = document.querySelector('.readerControls');
  64. if (controls) {
  65. const buttonHTML = `<button id='lv-button1' class='readerControls_item widthIncrease' style='color:#ffffff;cursor:pointer;'>←→</button><button id='lv-button2' class='readerControls_item widthDecrease' style='color:#ffffff;cursor:pointer;'>→←</button>`;
  66. controls.insertAdjacentHTML('beforeend', buttonHTML);
  67.  
  68.  
  69. document.getElementById('lv-button1').addEventListener('click', () => changeWidth(+1));
  70. document.getElementById('lv-button2').addEventListener('click', () => changeWidth(-1));
  71. changeWidth(5); // 默认加宽到最大
  72.  
  73.  
  74. let rightBorder = 14, rightOffset = -10;
  75. controls.style.position = "fixed";
  76. controls.style.transition = "right 0.05s ease-in 0s";
  77. controls.style.borderRight = rightBorder + "px solid transparent";
  78. controls.style.left = "auto";
  79. controls.style.opacity = "0.3";
  80. controls.style.right = (rightOffset - rightBorder) + "px";
  81.  
  82.  
  83. controls.addEventListener('mouseenter', function() {
  84. this.style.opacity = "1";
  85. this.style.right = "0px";
  86. });
  87. controls.addEventListener('mouseleave', function() {
  88. this.style.opacity = "0.3";
  89. this.style.right = (rightOffset - rightBorder) + "px";
  90. });
  91. }
  92.  
  93. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  94.  
  95.  
  96. const topBar = document.querySelector('.readerTopBar');
  97. if (topBar) {
  98. topBar.style.transition = "top 0.1s ease-in 0s";
  99.  
  100. let windowTop = 0;
  101. window.addEventListener('scroll', function() {
  102. let scrollS = window.scrollY;
  103.  
  104. topBar.style.top = (scrollS >= windowTop ? "-70px" : "0px");
  105.  
  106. windowTop = scrollS;
  107. });
  108. }
  109.  
  110. })();

QingJ © 2025

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