您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
优化 linovelib 阅读体验
当前为
// ==UserScript== // @name linovelib // @namespace https://github.com/IronKinoko/userscripts/tree/master/packages/linovelib // @version 1.0.1 // @license MIT // @description 优化 linovelib 阅读体验 // @author IronKinoko // @match https://w.linovelib.com/* // @icon https://www.google.com/s2/favicons?domain=w.linovelib.com // @grant none // @noframes // ==/UserScript== (function () { 'use strict'; function isMobile() { const re = /iphone|ipod|android|webos|blackberry|windows phone/i; const ua = navigator.userAgent; return re.test(ua); } main(); async function main() { if (!isMobile()) return; if (window.ReadTools) { resetPageEvent(); injectMovePageEvent(); } } function resetPageEvent() { const $body = document.body; $body.onclick = (e) => { const toolsId = ["#toptools", "#bottomtools", "#readset"]; if (toolsId.some((id) => { var _a; return (_a = document.querySelector(id)) == null ? void 0 : _a.contains(e.target); })) { return; } window.ReadPages.PageClick(); }; } function injectMovePageEvent() { let left, startX, startY, diffX, startTime, isMoved, direction; const $page = document.getElementById("apage"); window.addEventListener("touchstart", (e) => { if (window.ReadTools.pagemid != 1 || e.touches.length > 1) return; left = parseFloat($page.style.left.replace("px", "")) || 0; startX = e.touches[0].clientX; startY = e.touches[0].clientY; startTime = Date.now(); isMoved = false; direction = ""; }); window.addEventListener("touchmove", (e) => { if (window.ReadTools.pagemid != 1 || e.touches.length > 1) return; isMoved = true; diffX = e.touches[0].clientX - startX; let diffY = e.touches[0].clientY - startY; if (direction === "") { direction = Math.abs(diffX) > Math.abs(diffY) ? "x" : "y"; } if (direction === "x") { e.preventDefault(); $page.style.left = left + diffX + "px"; $page.style.transition = "initail"; } }, { passive: false }); window.addEventListener("touchend", (e) => { if (window.ReadTools.pagemid != 1 || e.touches.length > 1) return; if (!isMoved || direction === "y") return; const diffTime = Date.now() - startTime; const threshold = diffTime < 300 ? 10 : document.documentElement.clientWidth * 0.3; $page.style.transition = ""; if (Math.abs(diffX) > threshold) { const type = diffX > 0 ? "previous" : "next"; window.ReadPages.ShowPage(type); if (window.ReadPages.currentPage > window.ReadPages.totalPages || window.ReadPages.currentPage < 1) { window.ReadPages.ShowPage(); } } else { window.ReadPages.ShowPage(); } }); } })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址