您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自用特化版本,原版参见https://gf.qytechs.cn/zh-CN/scripts/421994
当前为
// ==UserScript== // @name shumin-微信读书 // @version 0.1 // @namespace http://tampermonkey.net/ // @description 自用特化版本,原版参见https://gf.qytechs.cn/zh-CN/scripts/421994 // @contributor Li_MIxdown;hubzy;xvusrmqj;LossJ;JackieZheng;das2m;harmonyLife;SimonDW // @author qianjunlang // @match https://weread.qq.com/web/reader/* // @require https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js // @icon https://weread.qq.com/favicon.ico // @grant GM_log // @grant GM_addStyle // @grant unsafeWindow // @grant GM_setValue // @grant GM_getValue // @grant GM_openInTab // @grant GM_download // @grant GM_setClipboard // @grant GM_notification // ==/UserScript== GM_addStyle('*{font-family: FangSong !important;}'); //GM_addStyle(".readerChapterContent{color: #FeFeFe;}"); var style_tag = document.createElement('style'); style_tag.innerHTML = ` .bookInfo_title, .readerHeaderButton, .readerFooter_button, .readerTopBar, .readerTopBar_title_link, .readerTopBar_title_chapter, .actionItem.addShelfItem { font-family: Microsoft YaHei UI !important; } `; document.head.appendChild(style_tag); $(window).on('load', async function () { 'use strict'; // 基于jQuery检测dom出现 function jianceDOM(classname){ return new Promise(res=>{ let max=80; let jiance=setInterval(()=>{ if(document.querySelectorAll(classname).length){ clearInterval(jiance) res(true) } if(max<=0){ clearInterval(jiance) res(false) } max-- },100) }) } // 检测文章内容发生变化 $("body").append(` <div id="module_box" style=" position: fixed; left:0; top:200px; bottom:0; right:0; margin:auto; width: 200px; height: 100px; text-align: center; line-height: 100px; background-color: rgba(0, 0, 0, 0.3); font-size: 24px; z-index:999999; display:none;">复制成功</div> `) async function add_copy_code_btn() { // 检测代码段是否存在 let res_dom_code = await jianceDOM("pre") let copy_code_btn_length = $("#copy_code").length if (res_dom_code && copy_code_btn_length==0) { // $("pre").css("position","relative") $("pre").append(` <button id="copy_code" style="position: absolute;right: 0;top: 0;color:white;cursor:pointer;z-index:99999;">📋</button> `) } } add_copy_code_btn() // 复制按钮 $(document).on("click","#copy_code",function(){ // let code_text = $(this).closest('pre').text().replace("📋","") //let code_text = $(this).closest('pre')[0].childNodes[0].textContent let code_text = $(this).closest('pre')[0].textContent.replace("📋","") GM_setClipboard(code_text) $("#module_box").fadeIn() setTimeout(() => { $("#module_box").fadeOut() },1000) // GM_notification({text:'复制成功',timeout:0}) }) $(document).on("click","button[title='下一章']",function(){ // console.log("下一章按钮") add_copy_code_btn() add_copy_img_btn() }) $(document).on("click",".chapterItem",function(){ add_copy_code_btn() add_copy_img_btn() }) async function add_copy_img_btn() { let res_dom_img = await jianceDOM('.wr_readerImage_opacity') let open_img_btn_length = $("button[name='btn_cxy_open_img_page']").length let get_img_btn_length = $("button[name='btn_cxy_get_img']").length if (res_dom_img && open_img_btn_length == 0 && get_img_btn_length == 0) { console.log("图片个数===",$('.wr_readerImage_opacity').length) $('.wr_readerImage_opacity').each((ind,ele) => { let btn = document.createElement("button") btn.name = "btn_cxy_open_img_page" btn.innerHTML = "📋" let btn2 = document.createElement("button") btn2.name = "btn_cxy_get_img" btn2.innerHTML = "↓" // 设置指定位置 // let xy = $(ele)[0].getBoundingClientRect() btn.style.cssText = `position: absolute;right: 0px;top: ${ele.offsetTop-50}px;color:white;z-index:9999; cursor:pointer` btn2.style.cssText = `position: absolute;right: 0px;top: ${ele.offsetTop-20}px;color:#888;z-index:9999; cursor:pointer` // 添加按钮 ele.after(btn) ele.after(btn2) }) } } add_copy_img_btn() // 打开新窗口 显示图片 $(document).on("click","button[name='btn_cxy_open_img_page']",function(){ let link = $(this).prev().prev().attr("src") GM_openInTab(link, { active: true }); }) // 下载图片按钮 $(document).on("click","button[name='btn_cxy_get_img']",function(){ let link = $(this).prev().attr("src") // console.log(link); GM_download({ url: link, name: new Date().getTime()+'.jpg', headers: { "User-Agent": "netdisk;6.7.1.9;PC;PC-Windows;10.0.17763;WindowsBaiduYunGuanJia", }, onprogress: function (e) { // console.log(JSON.stringify(e)) }, }); }) function getCurrentMaxWidth(element) { let currentValue = window.getComputedStyle(element).maxWidth; currentValue = currentValue.substring(0, currentValue.indexOf('px')); currentValue = parseInt(currentValue); return currentValue; } function changeWidth(increse) { const step = 100; const item1 = document.querySelector(".readerContent .app_content"); const item2 = document.querySelector('.readerTopBar'); const currentValue = getCurrentMaxWidth(item1); let changedValue; if (increse) { changedValue = currentValue + step; } else { changedValue = currentValue - step; } item1.style['max-width'] = changedValue + 'px'; item2.style['max-width'] = changedValue + 'px'; const myEvent = new Event('resize'); window.dispatchEvent(myEvent) } // 添加内容 var butDiy = `<button id='lv-button1' class='readerControls_item widthIncrease' style='color:#6a6c6c;cursor:pointer;'>加宽</button><button id='lv-button2' class='readerControls_item widthDecrease' style='color:#6a6c6c;cursor:pointer;'>减宽</button>`; $('.readerControls').append(butDiy); // 默认加宽到最大 changeWidth(true);changeWidth(true);changeWidth(true);changeWidth(true);changeWidth(true); // 添加监听 document.getElementById('lv-button1').addEventListener('click', () => changeWidth(true)); document.getElementById('lv-button2').addEventListener('click', () => changeWidth(false)); // 删除下载APP按钮 $(".readerControls_item.download").css("display", "none"); $('.readerControls').css({ "position": "fixed", "left": +730+'px', }); var windowTop = 0; $(window).scroll(function () { let scrollS = $(this).scrollTop(); let selBtn = document.querySelector('.readerTopBar'); let readerControl = document.querySelector(".readerControls"); $('.readerControls').mouseenter ( function () { $('.readerControls').css('opacity','1') }) $('.readerControls').mouseleave ( function () { $('.readerControls').css('opacity','0') }) if (scrollS >= windowTop) { // 上划显示 selBtn.style.opacity = 0; windowTop = scrollS; } else { // 下滑隐藏 selBtn.style.opacity = 1; windowTop = scrollS; } }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址