您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
A manga helper for wnacg.com
当前为
// ==UserScript== // @name wnacg-helper // @namespace https://www.wnacg.com/ // @version 0.0.1 // @author dzh // @license MIT // @icon https://vitejs.dev/logo.svg // @match https://www.wnacg.com/* // @description A manga helper for wnacg.com // ==/UserScript== (function () { 'use strict'; (function() { $(document).ready(() => { observerImgList(); }); $(window).on("load", () => { $(document).keydown(handleKeydownEvent); }); function observerImgList() { const targetNode = document.getElementById("img_list"); if (!targetNode) return; const observer = new MutationObserver(handleMutationCallback); observer.observe(targetNode, { childList: true, subtree: true }); } function handleMutationCallback(mutationList, observer) { mutationList.forEach((mutation) => { if (mutation.type === "childList") { autoChangeWidth(); } }); } function autoChangeWidth() { const imgList = document.querySelectorAll("#img_list img"); imgList.forEach((img) => { img.style.width = "60%"; }); } function handleKeydownEvent(e) { switch (e.key) { case "=": plusWidth(); break; case "-": minusWidth(); break; case "r": autoChangeWidth(); break; } } function plusWidth() { const imgList = document.querySelectorAll("#img_list img"); const plusStep = 2; imgList.forEach((img) => { const width = parseInt(img.style.width); img.style.width = `${width + plusStep}%`; }); } function minusWidth() { const imgList = document.querySelectorAll("#img_list img"); const minusStep = 2; imgList.forEach((img) => { const width = parseInt(img.style.width); if (width <= 10) return; img.style.width = `${width - minusStep}%`; }); } })(); })();