您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
[2024.11.21]删除影响阅读的不必要元素,微调样式以方便观看,亦可Ctrl+P直接打印为PDF离线观看
当前为
// ==UserScript== // @name 组卷网-组卷中心一键清理 // @namespace http://tampermonkey.net/ // @version 0.22 // @description [2024.11.21]删除影响阅读的不必要元素,微调样式以方便观看,亦可Ctrl+P直接打印为PDF离线观看 // @author TheOneAdonis // @match https://zujuan.xkw.com/zujuan // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // 创建按钮 const button = document.createElement('button'); button.textContent = '清理'; button.style.position = 'fixed'; button.style.right = '10px'; button.style.top = '10px'; button.style.zIndex = '1000'; button.style.padding = '10px'; button.style.backgroundColor = '#2877ff'; button.style.color = 'white'; button.style.border = 'none'; button.style.borderRadius = '5px'; button.style.cursor = 'pointer'; // 将按钮添加到body document.body.appendChild(button); // 按钮点击事件 button.addEventListener('click', function() { // 列出需要删除的元素选择器 const elementsToDelete = [ 'body > header', 'body > div.bread-nav', 'body > div.fiexd-nav', 'body > main > aside', 'body > main > article > div.seal-line', 'body > main > article > div.paper-main > div.paper-head', 'body > main > article > div.paper-main > div.paper-body > div:nth-child(1) > div.part-head', '#part-head-box2', 'body > main > article > div.paper-main > div.deleted-box', 'body > div.footer' ]; // 删除指定的元素 elementsToDelete.forEach(selector => { const element = document.querySelector(selector); if (element) { element.remove(); } }); // 删除所有class="questype-head"的元素 const questypeHeads = document.querySelectorAll('.questype-head'); questypeHeads.forEach(element => { element.remove(); }); // 设置所有元素的字体大小为14px function setFontSize() { const allElements = document.querySelectorAll('*'); allElements.forEach(el => { el.style.fontSize = '14px'; }); } setFontSize(); // 将class="paper-cnt clearfix"的max-width设置为100% function setMaxWidth() { const paperCnt = document.querySelector('.paper-cnt.clearfix'); if (paperCnt) { paperCnt.style.maxWidth = '100%'; } } setMaxWidth(); // 将除/main以外的元素的margin置为0 function resetMargins() { const allElements = document.querySelectorAll('*'); allElements.forEach(el => { if (el !== document.querySelector('body > main')) { el.style.margin = '0px'; } }); } resetMargins(); // 将所有class="ques-item"的上下padding置为0 function resetPadding() { const quesItems = document.querySelectorAll('.ques-item'); quesItems.forEach(item => { item.style.paddingTop = '0'; item.style.paddingBottom = '0'; }); } resetPadding(); // 移除按钮 button.remove(); }); })();