// ==UserScript== // @name 📘微信读书阅读助手(with ChatGPT) // @namespace https://github.com/mefengl // @version 6.0.9 // @description 读书人用的脚本 // @author mefengl // @match https://weread.qq.com/* // @match https://chat.openai.com/chat // @require https://cdn.staticfile.org/jquery/3.6.1/jquery.min.js // @grant GM_openInTab // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_getValue // @grant GM_setValue // @grant GM_addValueChangeListener // @license MIT // @downloadURL none // ==/UserScript== (function () { ("use strict"); // 书城运行脚本闪烁严重,直接跳过 if (location.pathname.includes("category")) return; // 功能1️⃣:宽屏 $(function () { $(".app_content").css("maxWidth", 1000); $(".readerTopBar").css("display", "flex"); }); // 功能2️⃣:自动隐藏顶栏和侧边栏,上划显示,下滑隐藏 let windowTop = 0; $(window).scroll(() => { const scrollS = $(this).scrollTop(); if (scrollS >= windowTop + 100) { // 下滑隐藏 $(".readerTopBar, .readerControls").fadeOut(); windowTop = scrollS; } else if (scrollS < windowTop) { // 上划显示 $(".readerTopBar, .readerControls").fadeIn(); windowTop = scrollS; } }); // 功能3️⃣:一键搜📗豆瓣阅读或📙得到阅读 // 监听页面是否是搜索页面 const handleListenChange = (mutationsList) => { const className = mutationsList[0].target.className; if (/search_show/.test(className)) { // 开始添加按钮 if (get_searchBox().parentElement.lastChild.tagName == "BUTTON") return; // 添加按钮们 [ { name: "豆瓣读书", color: "#027711", searchUrl: "https://search.douban.com/book/subject_search?search_text=", }, { name: "豆瓣阅读", color: "#389eac", searchUrl: "https://read.douban.com/search?q=", }, { name: "得到阅读", color: "#b5703e", searchUrl: "https://www.dedao.cn/search/result?q=", }, { name: "孔夫子", color: "#701b22", searchUrl: "https://search.kongfz.com/product_result/?key=", }, { name: "多抓鱼", color: "#497849", searchUrl: "https://www.duozhuayu.com/search/book/", }, ].forEach(({ name, color, searchUrl }) => $(".search_input_text").parent().append( $('