您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
更好的洛谷!
当前为
// ==UserScript== // @name luogu_better // @namespace https://www.luogu.com.cn // @version 0.1.1 // @license MIT // @description 更好的洛谷! // @author rabbit // @match https://www.luogu.com.cn/* // @icon https://www.luogu.com.cn/favicon.ico // ==/UserScript== window.addEventListener('load', function() { console.log("luogu_beautification loaded | Made by Rabbit"); // 函数:应用样式 function applyStyles() { const style = document.createElement("style"); style.innerHTML = ` body { background-image: url('https://bing.img.run/uhd.php') !important; background-size: cover; } .lg-article { border-radius: 9px !important; } .lg-article .lg-index-stat { border-radius: 9px !important; } .card.padding-default { border-radius: 9px !important; } .card.wrapper.padding-none { border-radius: 9px !important; } .lfe-form-sz-middle { border-radius: 9px !important; } .refined-input.input-wrap.frame { border-radius: 18px !important; padding: 5px; } input { border-radius: 18px !important; padding: 5px; } .center { border-radius: 9px !important; } .card.user-header-container.padding-0 { border-radius: 9px !important; } .card { border-radius: 9px !important; } .l-card { border-radius: 9px !important; } .columba-content-wrap { border-radius: 9px !important; } .text { border-radius: 18px !important; padding: 5px; } .casket { border-radius: 9px !important; } .dropdown { border-radius: 9px !important; } .am-comments-list { background-color:rgb(250,250,250); border-radius: 9px !important; overflow: auto; } textarea { border-radius: 9px !important; } `; document.head.appendChild(style); } // 首次加载时应用样式 applyStyles(); // 创建 MutationObserver 以监控 DOM 变化 const observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { if (mutation.addedNodes.length > 0) { applyStyles(); // 当有新元素被添加时重新应用样式 } }); }); // 开始监听 document.body 的子元素变化(包括整个 DOM 树的变化) observer.observe(document.body, { childList: true, subtree: true }); }); window.back = "https://bing.img.run/uhd.php"; setInterval(function(){ document.querySelector('body').style=`background: url(${window.back}) fixed center;background-size: cover;`; if(document.querySelector('main[style="background-color: rgb(239, 239, 239);"]') != null) document.querySelector('main[style="background-color: rgb(239, 239, 239);"]').style="opacity: 0.9;"; if(document.querySelector('div[style="background: linear-gradient(90deg, rgb(35, 37, 38), rgb(65, 67, 69)); filter: blur(0px) brightness(100%);"]') != null) document.querySelector('div[style="background: linear-gradient(90deg, rgb(35, 37, 38), rgb(65, 67, 69)); filter: blur(0px) brightness(100%);"]').style="opacity: 0.9;"; if(document.querySelector('div[style="background: rgb(51, 51, 51); filter: blur(0px) brightness(100%);"]') != null) document.querySelector('div[style="background: rgb(51, 51, 51); filter: blur(0px) brightness(100%);"]').style="opacity: 0.9;"; if(document.querySelector('div[class="mdui-panel mdui-panel-gapless"]') != null) document.querySelector('div[class="mdui-panel mdui-panel-gapless"]').style="opacity: 0.9;"; if(document.querySelector("div[data-v-0a593618]") != null){ document.querySelector("div[data-v-0a593618]").remove(); } },100); (function(){ const $=document.getElementsByClassName.bind(document); window.onload=function(){ var myVar = setInterval(function(){ //alert("Hello"); const findElem=findElemByText.bind($("lfe-form-sz-small")) const sub=findElem("关闭"); if(sub){ sub.click(); clearInterval(myVar); } }, 100); } function findElemByText(text) { for (const elem of this) { if (elem.innerText.includes(text)) { return elem } } return null } })(); (function() { 'use strict'; document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div:nth-child(1)").remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div.lg-article.am-hide-sm").remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div.am-u-md-8").remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-9.am-u-md-8.lg-index-benben.lg-right > div:nth-child(2)").remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(1) > div > div > div > div").className="am-u-md-12 lg-punch am-text-center"; document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div").lastChild.remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div").lastChild.remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div").lastChild.remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div").lastChild.remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div").lastChild.remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div").lastChild.remove(); document.querySelector("#app-old > div.lg-index-content.am-center > div:nth-child(3) > div.am-u-lg-3.am-u-md-4.lg-right > div").lastChild.remove(); })(); $('document').ready(function(){ var x=document.querySelectorAll(".lg-punch-result"); var y=document.querySelectorAll(".am-u-sm-6"); if(x[0].innerHTML=="§ 大凶 §"){ var sum="<span id='yi' style='font-weight:bold'>宜:</span>学习<br><span style='font-size:10px;color:#7f7f7f'>学业有成</span></br>"; sum+="<span id='yi' style='font-weight:bold'>宜:</span>继续完成WA的题<br><span style='font-size:10px;color:#7f7f7f'>下一次就可以AC了</span></br>"; y[0].innerHTML=sum; } x[0].innerHTML="§ 大吉 §"; x[0].style="color:#e74c3c!important"; y[1].innerHTML="万事皆宜"; y[1].style="color:rgba(0, 0, 0, .75)!important"; y[1].style="font-weight:bold"; }); //随机跳题 参考自叶ID的作品 setTimeout(function () { document.querySelector('div[class="am-u-md-3"]').innerHTML = ` <div class="lg-article" id="rand-problem-form"> <h2>随机跳题 v1.0</h2> <select class="am-form-field" style="background-color:#DDD;" name="rand-problem-rating" autocomplete="off" placeholder="选择难度"> <option value="0">暂无评定</option> <option value="1">入门</option> <option value="2">普及-</option> <option value="3">普及/提高-</option> <option value="4">普及+/提高</option> <option selected value="5">提高+/省选-</option> <option value="6">省选/NOI-</option> <option value="7">NOI/NOI+/CTSC</option> </select> <select class="am-form-field" style="background-color:#DDD;margin-top:16px;" name="rand-problem-source" autocomplete="off" placeholder="选择来源"> <option selected value="P">洛谷题库</option> <option value="CF">CodeForces</option> <option value="SP">SPOJ</option> <option value="AT">AtCoder</option> <option value="UVA">UVa</option> </select> <button class="am-btn am-btn-sm am-btn-primary" style="margin-top:16px;visibility:hidden">跳转</button> <button class="am-btn am-btn-sm am-btn-primary lg-right" id="rand-problem-button" style="margin-top:16px;">跳转</button> </div>`; $('#rand-problem-button').click(function() { $('#rand-problem-button').addClass('am-disabled'); $.get("https://www.luogu.com.cn/problem/list?difficulty=" + $('[name=rand-problem-rating]')[0].value + "&type=" + $('[name=rand-problem-source]')[0].value + "&page=1&_contentOnly=1", function (data) { var arr = data; if (arr['code'] != 200) { $('#rand-problem-button').removeClass('am-disabled'); show_alert("出现了一些问题~", arr["message"]); } else { var problem_count = arr['currentData']['problems']['count']; var page_count = Math.ceil(problem_count / 50); var rand_page = Math.floor(Math.random()*page_count) + 1; $.get("https://www.luogu.com.cn/problem/list?difficulty=" + $('[name=rand-problem-rating]')[0].value + "&type=" + $('[name=rand-problem-source]')[0].value + "&page=" + rand_page + "&_contentOnly=1", function(data) { var list = data['currentData']['problems']['result']; var rand_idx = Math.floor(Math.random()*list.length); var pid = list[rand_idx]['pid']; location.href = "https://www.luogu.com.cn/problem/" + pid; } ); } } ); }); },499);