您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
粉笔网优化布局,清屏快速生成pdf
当前为
// ==UserScript== // @name 粉笔网刷题宝 // @namespace http://tampermonkey.net/ // @version 0.0.38 // @author binyellow // @icon https://nodestatic.fbstatic.cn/weblts_spa_online/page/assets/fenbi32.ico // @defaulticon 粉笔网优化布局,清屏快速生成pdf // @match https://www.fenbi.com/* // @require https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js // @description 粉笔网优化布局,清屏快速生成pdf // ==/UserScript== (function ($) { 'use strict'; const processCls = `__binyellow__processed__`; function processElements(selector, callback) { const elements = $(`${selector}:not(.${processCls})`); elements.each(function() { callback($(this)); $(this).addClass(processCls); }); } const mokao = () => { processElements(".exam-post-nav", (node) => { $(node).css({ left: 0, top: 0 }); const detailContent = $(".solution-detail.clear-float"); $(detailContent).css({ width: "100%" }); const optionsUl = $(detailContent).find(".options.ng-star-inserted"); $(optionsUl).css({ display: "flex", "justify-content": "space-between", "flex-wrap": "wrap" }); optionsUl.children().css("margin", "0"); $(detailContent).find(".exam-main-content.ng-tns-c3-0.ng-star-inserted").css({ width: "calc(100% - 302px)" }); $(".practice-header").hide(); $(detailContent).find(".solu-detail.ng-star-inserted").css({ margin: 0, padding: 0 }); $(detailContent).find(".nav-coll-divider.solu-divider").css({ margin: "6px 0" }); $(detailContent).find(".question-content > p:nth-child(2) > img").each(function() { var img = $(this); var width = img.width() || 0; var height = img.height() || 0; var newWidth = width * 0.6; var newHeight = height * 0.6; img.width(newWidth); img.height(newHeight); }); }); }; function observeDom(container, cbs2) { function handleMutation(mutation) { if (mutation.type === "childList") { mutation.addedNodes.forEach((node) => { cbs2.forEach((cb) => cb(node)); }); } } const observer = new MutationObserver((mutations) => { mutations.forEach(handleMutation); }); observer.observe(container, { childList: true, subtree: true }); } const caogao = () => { const caogao2 = $(".draft-icon"); if (caogao2 == null ? void 0 : caogao2.length) { $(caogao2).on("click", function() { console.log("draft-icon 被点击"); $(document).on("keydown", function(event) { if (event.key === "Escape" || event.keyCode === 27) { $(".tool-item.exit").trigger("click"); $(document).off("keydown"); } }); }); } }; function shenlun() { const leftSubject = $(".zhenti-body-left.zhenti-body-part.bg-color-gray-light5"); leftSubject.find(".materials-container").css({ width: "100%", padding: 12 }); leftSubject.find(".material-content.ng-tns-c41-0").css({ width: "100%" }); leftSubject.find(".material-content.ng-tns-c41-0").find("#material").css({ width: "100%" }); const rightAnser = $(".zhenti-body-right.zhenti-body-part"); rightAnser.css({ flex: "none" }); rightAnser.find(".questions-container").css({ "padding-left": "12px" }); } const kuaisu = (node, did2) => { var _a; const xingCeTiMu = $(node).find("main.exam-content"); if ((xingCeTiMu == null ? void 0 : xingCeTiMu.length) && !(did2 == null ? void 0 : did2.xingce)) { did2.xingce = true; const css = { margin: 0 }; $("main.exam-content").css(css); $(".simple-nav-header.bg-color-gray-bold").hide(); const optionsCls = ".options.choice-options.font-color-gray-mid"; $(optionsCls).css({ display: "flex" }); $(".nav-coll-divider").hide(); $(".solu-list.border-gray-light4").css({ "margin-top": 0 }); $(".solu-answer-text.clear-float").hide(); $(".bg-color-gray-light2.border-gray-light3.font-color-gray-mid.expend-btn").hide(); $(".solu-list-item.video-item").css({ "margin-bottom": 0 }); $(".solu-list-item.video-item fb-ng-solution-detail-item").hide(); $("<style>.fb-collpase-bottom { width: calc(100% - 1024px); right: 0; }</style>").appendTo("head"); $(".fb-collpase-bottom.bg-color-gray-mid").css({ margin: 0, width: "100%" }); $(".fixedActions.bg-color-gray-bold").css({ right: 0 }); did2.xingce = false; shenlun(); } if (((_a = $(".fb-question-material")) == null ? void 0 : _a.length) && !did2.zhaiping) { did2.zhaiping = true; $(".fb-question-material").css({ margin: 12 }); $(".material-content").css({ padding: 0 }); $(".ques-options-dry").css({ padding: 0 }); $(".options.font-color-gray-mid").css({ display: "flex" }); } const collections = $(".solution-item.bg-color-gray-bold"); if ((collections == null ? void 0 : collections.length) && !did2.collectionDid) { collections.each(function() { const solution = $(this).find(".solu-list.border-gray-light4"); $(solution).css({ padding: 8 }); $(solution).find("fb-ng-solution-detail-answer").hide(); }); did2.collectionDid = true; } const collectionBtn = $( ".solution-item.bg-color-gray-bold>app-fb-solution>fb-ng-solution > div[_ngcontent-fenbi-web-exams-c75] > div[_ngcontent-fenbi-web-exams-c75]" ); if ((collectionBtn == null ? void 0 : collectionBtn.length) && !did2.collectionBtnDid) { collectionBtn.each(function() { $(this).css({ position: "absolute", right: 0 }); console.log(this); }); did2.collectionBtnDid = true; } processElements(".options.font-color-gray-mid", (node2) => { node2.css({ display: "flex" }); }); }; const dealWidth = () => { const cssRules = ` @media (max-width: 1000px) { .exam-content { width: calc(100% - 45px) !important; } #app-practice { min-width: 100% !important; } .tools-container { left: 0; } .fb-collpase-bottom { left: 0; width: 100% !important; } } `; const styleTag = document.createElement("style"); styleTag.innerHTML = cssRules; document.head.appendChild(styleTag); }; const fixedActions = () => { processElements(".fixedActions.bg-color-gray-bold", () => { var newButton = $("<button>清屏</button>"); const marginLabel = '<div><label for="ti-jian-ju">题间距</label></div>'; var newInput = $('<input id="ti-jian-ju" type="number" value="180">'); const fontLabel = '<label for="zi-ti">字体</label>'; const fontInput = $('<input id="zi-ti" type="number" value="20">'); $(".fixedActions.bg-color-gray-bold").children().first().before(newButton).before(marginLabel).before(newInput).before(fontLabel).before(fontInput); newButton.on("click", function() { const scrollDom = $("#fenbi-web-exams"); scrollDom.scrollTop(scrollDom[0].scrollHeight); var examContent = $("main.exam-content"); var inputValue = newInput.val(); var fontValue = fontInput.val(); $("body").empty(); $("body").append(examContent); $("body").append(`<style> .fixedActions.bg-color-gray-bold,.fb-collpase-bottom, app-side-tool,.fb-question > div:last-child[_ngcontent-fenbi-web-exams-c68],div[_ngcontent-fenbi-web-exams-c69] > div[_ngcontent-fenbi-web-exams-c69],.content.font-color-gray-mid>p.ques-type { display: none; } .fb-question-options.fenbi-ng-utils > div[_ngcontent-fenbi-web-exams-c40] { padding: 16px 0 0 0; margin-bottom: ${inputValue}px; } .options.font-color-gray-mid { display: flex; justify-content: space-between; flex-wrap: wrap; } .options.font-color-gray-mid > li { margin: 0 !important; } [_nghost-fenbi-web-exams-c40] p, [_nghost-fenbi-web-exams-c40] .options-material { font-weight: normal; font-size: ${fontValue}px; } main.exam-content { margin-right: 35px !important; } .material-nav.bg-color-gray-light { display: none; } </style>`); $(".nav-coll-divider").hide(); $(".fb-question>div:last-child > button").hide(); }); }); }; let did = {}; const cbs = []; cbs.push((node) => kuaisu(node, did)); cbs.push(caogao); cbs.push(mokao); cbs.push(fixedActions); const initCbs = []; initCbs.push(dealWidth); initCbs.push(() => { }); initCbs.forEach((cb) => cb()); observeDom(document.body, cbs); })($);