正文
增加 38 行删除 1150 行
123456789101112131415161718192021222324252627282930313233343536373837 行未改动76777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211UPD:2026.9.20 更新至 v1.3.0,针对在线 IDE 进行了优化 & 修复了背景被覆盖的问题。(by @[zsTree](/user/1362278))2026.9.17 更新至 v1.2.3,修复了背景全屏、关闭广告功能的部分已知问题。(by @[zsTree](/user/1362278))2026.9.16 更新至 v1.2.2,添加了设置面板中更新检查的功能。(by @[zsTree](/user/1362278))2026.9.15 更新至 v1.2.1,修复了用户主页 `.user-header-bottom` 透明度不统一以及部分不同页面设置面板样式不统一的问题。(by @[zsTree](/user/1362278))2026.9.12 更新至正式版 v1.2.0,修复了前端更新导致主页背景全屏功能炸了的问题。(by @[zsTree](/user/1362278))2026.8.26 更新至 v1.1.3,修复了切换毛玻璃样式会多出默认背景和开启毛玻璃无法正确渲染样式的问题。(by @[zsTree](/user/1362278))2026.8.18 更新至 v1.1.2,修复了新 UI 界面头部卡片侧边多余的模糊。(by @[Ashstrider](/user/1388468))2026.8.16 更新至 v1.1.1,修复了脚本偶尔未加载的问题。(by @[zsTree](/user/1362278))2026.8.1 更新至正式版 v1.1.0,修复了圆角在 SPA 页面中的问题,添加了讨论区评论的圆角效果。(by @[zsTree](/user/1362278))2026.7.29 更新至 v1.0.4:- 添加了旧前端头像下拉框和侧边栏「应用」的透明、模糊、圆角效果;(by @[Ashstrider](/user/1388468))- 添加了自定义 CSS 功能,添加了侧边栏和顶部栏的模糊效果,修复了模糊度不为 0px 时旧前端头像下拉框被遮挡的问题。(by @[Ashstrider](/user/1388468))---Luogu Plugins 用户群QQ 群号 1103713183https://qm.qq.com/q/Ke85zBh6w4---与 @[Ashstrider](/user/1388468) 共同完成初版代码编写任务。::::info[效果预览]{open}:::align{center}37 行未改动欢迎在我们的 GitHub 项目中提交 Issue 和 Pull Request 反馈问题,为我们做贡献前请阅读[贡献指南](https://github.com/Luogu-Plugins/Luogu-Display-Better/blob/main/CONTRIBUTING.md)。当然您乐意的话可以通过以下二选一的方式加入我们:- 添加 zsTree 的 QQ 3757255177;- 进入 [Luogu Plugins 用户群](https://qm.qq.com/q/Ke85zBh6w4)。## 脚本代码[最新脚本获取链接](https://github.com/Luogu-Plugins/Luogu-Display-Better/releases):::info[v1.3.0]```javascript// ==UserScript==// @name Luogu Display Better// @namespace https://github.com/Luogu-Plugins// @version 1.3.0// @description Change your Luogu style what you like best// @author Luogu-Plugins// @match *://www.luogu.com.cn/*// @connect cdn.jsdelivr.net// @icon https://fecdn.luogu.com.cn/columba/static.325908fec383795b.logo-single-color.svg// @grant GM_xmlhttpRequest// @grant GM_info// @run-at document-end// ==/UserScript==(function() {'use strict';let cardborderRad;let picborderRad;let blurValue;let opacityValue;let cardRounded;let picRounded;let bgFullscreen;let adBlock;let customCSS;let updateChannel;let bgCleanObserver = null;let isObserving = false;let adBlockObserver = null;const UPDATE_URLS = {stable: 'https://cdn.jsdelivr.net/gh/Luogu-Plugins/Luogu-Display-Better@main/LuoguDisplayBetter.user.js',latest: 'https://cdn.jsdelivr.net/gh/Luogu-Plugins/Luogu-Display-Better@dev/LuoguDisplayBetter.user.js'};function initVarible() {cardborderRad = parseFloat(localStorage.getItem("LuoguDisplayBetter-cardborderRad") ?? 15);picborderRad = parseFloat(localStorage.getItem("LuoguDisplayBetter-picborderRad") ?? 8);blurValue = parseFloat(localStorage.getItem("LuoguDisplayBetter-blur") ?? 10);opacityValue = parseFloat(localStorage.getItem("LuoguDisplayBetter-opacity") ?? 75);cardRounded = localStorage.getItem("LuoguDisplayBetter-cardRounded") !== 'false';picRounded = localStorage.getItem("LuoguDisplayBetter-picRounded") !== 'false';adBlock = localStorage.getItem("LuoguDisplayBetter-adBlock") === 'true';bgFullscreen = localStorage.getItem("LuoguDisplayBetter-bgFullscreen") !== 'false';customCSS = localStorage.getItem("LuoguDisplayBetter-customCSS") ?? '';updateChannel = localStorage.getItem("LuoguDisplayBetter-updateChannel") ?? 'stable';}function applyRounded() {const old = document.getElementById('ldb-rounded-style');if (old) old.remove();if (isNaN(cardborderRad) && isNaN(picborderRad)) return;let style = document.createElement('style');style.id = 'ldb-rounded-style';const cardRadius = cardborderRad + 'px';const picRadius = picborderRad + 'px';let css = ``;if (cardRounded) {css = `.l-card, .lg-article, .card { border-radius: ${cardRadius} !important; }.swal2-popup { border-radius: ${cardRadius} !important; }.l-form-layout, .am-panel { border-radius: ${cardRadius} !important; }.l-card.comment .author { border-top-left-radius: ${cardRadius} !important; border-top-right-radius: ${cardRadius} !important; }.dropdown .center { border-radius: ${cardRadius} !important; }.user-header-top { border-top-left-radius: ${cardRadius}; border-top-right-radius: ${cardRadius}; } .user-header-bottom { border-bottom-left-radius: ${cardRadius}; border-bottom-right-radius: ${cardRadius}; }.user-nav { border-bottom-left-radius: ${cardRadius}; border-bottom-right-radius: ${cardRadius}; }.test-case { border-radius: 10px; }html.ldb-bgfullscreen .article-banner.article-banner { border-top-left-radius: ${cardRadius} !important; border-top-right-radius: ${cardRadius} !important; }html.ldb-bgfullscreen .article-content.article-content { border-bottom-left-radius: ${cardRadius} !important; border-bottom-right-radius: ${cardRadius} !important; }html.ldb-bgfullscreen .toc.toc { border-radius: .5em !important; }.meta { border-top-left-radius: ${cardRadius} !important; border-top-right-radius: ${cardRadius} !important; }.ide-container { border-radius: ${cardRadius} !important; }.ide-textarea[readonly].lfe-code { border-bottom-right-radius: ${cardRadius} !important; }`;}if (picRounded) css += `img { border-radius: ${picRadius} !important; }`;style.innerHTML = css;document.head.append(style);}function applyCardBlur() {const old = document.getElementById('ldb-blur-style');if (old) old.remove();if (blurValue === undefined || isNaN(blurValue)) return;const style = document.createElement('style');style.id = 'ldb-blur-style';const val = blurValue === 0 ? 'none' : `blur(${blurValue}px)`;let css =`.lg-article, .card, .l-card { backdrop-filter: ${val} !important; -webkit-backdrop-filter: ${val} !important; }.dropdown .center, .popup { backdrop-filter: ${val} !important; -webkit-backdrop-filter: ${val} !important; }.am-comment-hd, .am-comment-bd { backdrop-filter: ${val} !important; -webkit-backdrop-filter: ${val} !important; }.article-banner { backdrop-filter: ${val} !important; -webkit-backdrop-filter: ${val} !important; }.top-bar, .sidebar, .nav-group, nav.lfe-body, .user-nav, .wrapper.wrapped.lfe-body.header-layout.tiny { backdrop-filter: ${val} !important; -webkit-backdrop-filter: ${val} !important; }.dropdown, .dropdown .center, .popup,.lfe-dropdown, .el-dropdown-menu,.el-popper, .dropdown-menu,.ant-dropdown, .ant-select-dropdown {z-index: 999999 !important;transform: translateZ(0) !important;}.dropdown, .dropdown-container, [class*="dropdown"] { overflow: visible !important; }.header-layout, .top-bar { z-index: 1000 !important; }`;style.innerHTML = css;document.head.append(style);}function applyCardOpacity() {const old = document.getElementById('ldb-opacity-style');if (old) old.remove();if (opacityValue === undefined || isNaN(opacityValue)) return;const alpha = opacityValue / 100;const themePage = document.querySelector('.theme-page');let baseColor = '255, 255, 255';if (themePage) {const native = getComputedStyle(themePage).getPropertyValue('--theme-card-background').trim();if (native) {const m = native.match(/rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/);if (m) baseColor = `${m[1]}, ${m[2]}, ${m[3]}`;}}const cardColor = `rgba(${baseColor}, ${alpha})`;const style = document.createElement('style');style.id = 'ldb-opacity-style';style.innerHTML = `.lg-article, .l-card, .card { background-color: ${cardColor} !important; }.dropdown .center, .popup { background-color: ${cardColor} !important; }.am-comment-hd, .am-comment-bd { background-color: ${cardColor} !important; }nav.lfe-body > div { background-color: ${cardColor} !important; }.user-header-bottom { background-color: transparent !important; }html { scrollbar-color: rgba(139, 139, 139, 1) rgba(255, 255, 255, 0); }.ide-container { background-color: ${cardColor} !important; }.panel-layout>.panel-divider.with-icon { background-color: transparent !important; }.panel-layout>.panel-divider.dragging { background-color: var(--lfe-color--primary) !important; }.ͼ2 .cm-gutters, .ide-toolbar { background-color: transparent !important; border: 0px solid transparent !important; }input:not([type=range]), textarea, .refined-input { background-color: transparent !important; }.panel-divider, .layout-horizontal>.panel-divider { background-color: transparent !important; }.combo-wrapper>.text, .dropdown { background-color: transparent !important; }`;document.head.append(style);if (themePage) {themePage.style.setProperty('--theme-card-background', cardColor);}}function forceMainTransparent() {const list = document.querySelectorAll('.main-container > main, main');if (!list.length) return;list.forEach(el => {const bgc = el.style.getPropertyValue('background-color').trim();const bg = el.style.getPropertyValue('background').trim();if (bgc && bgc !== 'transparent' && bgc !== 'rgba(0, 0, 0, 0)') {el.style.setProperty('background-color', 'transparent', 'important');}if (bg && bg !== 'transparent' && bg !== 'none') {el.style.setProperty('background', 'transparent', 'important');}});}function applyBgFullscreen() {const oldStyle = document.getElementById('ldb-bgfullscreen-style');if (oldStyle) oldStyle.remove();document.documentElement.classList.remove('ldb-bgfullscreen');const themePage = document.querySelector('.theme-page');if (themePage && themePage._ldbSavedVars) {for (const [key, value] of Object.entries(themePage._ldbSavedVars)) {if (value) {themePage.style.setProperty(key, value);} else {themePage.style.removeProperty(key);}}delete themePage._ldbSavedVars;}if (!bgFullscreen) return;let bgImage = null;let bgRepeat = 'no-repeat';let bgSize = 'cover';let bgPosition = 'center';let bgFilter = 'none';if (themePage) {const cs = getComputedStyle(themePage);const img = cs.getPropertyValue('--theme-body-image').trim();if (img && img !== 'none') {const urlMatch = img.match(/url\(["']?([^"')]+)["']?\)/);bgImage = urlMatch ? `url("${urlMatch[1]}")` : `url("${img.replace(/^["']|["']$/g, '')}")`;}const repeatVal = cs.getPropertyValue('--theme-body-image-repeat').trim();if (repeatVal) bgRepeat = repeatVal;const sizeVal = cs.getPropertyValue('--theme-body-image-size').trim();if (sizeVal) bgSize = sizeVal;const posVal = cs.getPropertyValue('--theme-body-image-position').trim();if (posVal) bgPosition = posVal;const filterVal = cs.getPropertyValue('--theme-body-color-filter').trim();if (filterVal && filterVal !== 'none') bgFilter = filterVal;}if (!bgImage) {const themeScript = document.getElementById('luogu-theme');if (themeScript) {try {const themeData = JSON.parse(themeScript.textContent);if (themeData?.lBody?.image) {bgImage = `url("${themeData.lBody.image}")`;const midOpts = themeData.lBody.midOpts || {};if (midOpts.size) bgSize = midOpts.size;if (Array.isArray(midOpts.position) && midOpts.position.length >= 2) {bgPosition = `${midOpts.position[0]}% ${midOpts.position[1]}%`;}if (typeof midOpts.brightness === 'number' && midOpts.brightness !== 0) {bgFilter = `brightness(${100 + midOpts.brightness}%)`;}if (typeof midOpts.notEmpty === 'boolean') {bgRepeat = midOpts.notEmpty ? 'no-repeat' : 'repeat';}}} catch (e) {}}}if (!bgImage) {const bgDiv = document.querySelector('.header-layout .background');if (bgDiv) {const style = getComputedStyle(bgDiv);const img = style.backgroundImage;if (img && img !== 'none') {bgImage = img;if (style.backgroundRepeat) bgRepeat = style.backgroundRepeat;if (style.backgroundSize) bgSize = style.backgroundSize;if (style.backgroundPosition) bgPosition = style.backgroundPosition;}}}if (!bgImage || bgImage === 'none') return;if (themePage) {const varsToOverride = ['--theme-body-image','--theme-body-color','--theme-body-mid-mask','--theme-body-color-filter','--theme-body-back'];const savedVars = {};for (const v of varsToOverride) {savedVars[v] = themePage.style.getPropertyValue(v);}themePage._ldbSavedVars = savedVars;themePage.style.setProperty('--theme-body-image', 'none');themePage.style.setProperty('--theme-body-color', 'none');themePage.style.setProperty('--theme-body-mid-mask', 'none');themePage.style.setProperty('--theme-body-color-filter', 'none');themePage.style.setProperty('--theme-body-back', 'transparent');}const nav = document.querySelector('.container nav');if (nav && location.pathname === '/') nav.classList.remove('user-nav');document.documentElement.classList.add('ldb-bgfullscreen');const styleEl = document.createElement('style');styleEl.id = 'ldb-bgfullscreen-style';styleEl.textContent = `html.ldb-bgfullscreen {background: transparent !important;background-image: none !important;}html.ldb-bgfullscreen::before {content: '' !important;position: fixed !important;top: 0 !important;left: 0 !important;right: 0 !important;bottom: 0 !important;z-index: -1 !important;pointer-events: none !important;background-image: ${bgImage} !important;background-repeat: ${bgRepeat} !important;background-position: ${bgPosition} !important;background-size: ${bgSize} !important;filter: ${bgFilter} !important;-webkit-filter: ${bgFilter} !important;}.header-layout.tiny[data-v-7ddab1d5], .lfe-body[data-v-12f19ddc] {background: transparent !important;}.article-banner + div[data-v-fc349d1c] {background: transparent !important;}html.ldb-bgfullscreen .lcolor-bg-background {background: transparent !important;}html.ldb-bgfullscreen .article-banner.article-banner {background: rgba(245, 245, 245, ${opacityValue / 100}) !important;}html.ldb-bgfullscreen .article-content.article-content {background: rgba(255, 255, 255, ${opacityValue / 100}) !important;}html.ldb-bgfullscreen .toc.toc {background: white !important;box-shadow: 0 2px 4px 0 rgba(0, 0, 0, .15), 0 0 1px 0 rgba(0, 0, 0, .5) inset;padding: 3px 8px;}html.ldb-bgfullscreen body {background: transparent !important;background-image: none !important;}html.ldb-bgfullscreen main,html.ldb-bgfullscreen .main-container > main {background: transparent !important;background-color: transparent !important;}html.ldb-bgfullscreen .main-container,html.ldb-bgfullscreen #app-old,html.ldb-bgfullscreen .lg-index-content,html.ldb-bgfullscreen .lg-index-content .am-g,html.ldb-bgfullscreen .am-panel {background: transparent !important;background-color: transparent !important;}html.ldb-bgfullscreen .header-layout .background {opacity: 0;}html.ldb-bgfullscreen .wrapper.wrapped:not(.header-layout) .background {display: none;}html.ldb-bgfullscreen .wrapper.wrapped:not(.header-layout) {background: transparent !important;}html.ldb-bgfullscreen .footer {background: transparent !important;}html.ldb-bgfullscreen .theme-page {background: transparent !important;}html.ldb-bgfullscreen .top-bar,html.ldb-bgfullscreen .sidebar,html.ldb-bgfullscreen .nav-group,html.ldb-bgfullscreen nav.lfe-body,html.ldb-bgfullscreen nav.lfe-body > div,html.ldb-bgfullscreen .user-nav,html.ldb-bgfullscreen .header-layout {background: transparent !important;background-color: transparent !important;}html.ldb-bgfullscreen .top-bar {--theme-navi-back: transparent !important;}html.ldb-bgfullscreen body::before,html.ldb-bgfullscreen body::after,html.ldb-bgfullscreen #app::before,html.ldb-bgfullscreen #app::after {background: none !important;background-image: none !important;}html.ldb-bgfullscreen #app {background: transparent !important;}`;document.head.appendChild(styleEl);forceMainTransparent();}function applyAdBlock() {const styleId = 'ldb-adblock-style';const old = document.getElementById(styleId);if (old) old.remove();if (!adBlock) return;const style = document.createElement('style');style.id = styleId;style.textContent = `.side div[data-v-ce0b4304] { display: none !important; }`;document.head.appendChild(style);}function startAdBlockObserver() {if (adBlockObserver) return;adBlockObserver = new MutationObserver(() => {applyAdBlock();});adBlockObserver.observe(document.body, { childList: true, subtree: true });}function applyCustomCSS() {const old = document.getElementById('ldb-custom-style');if (old) old.remove();if (!customCSS || customCSS.trim() === '') return;const style = document.createElement('style');style.id = 'ldb-custom-style';style.textContent = customCSS;document.head.appendChild(style);}function cleanBackground() {document.querySelectorAll('.theme-page').forEach(el => {if (el.classList.contains('theme-frosted')) {el.classList.remove('theme-frosted');}if (el.hasAttribute('style')) {el.removeAttribute('style');}});}function ensureObserverCreated() {if (bgCleanObserver) return;bgCleanObserver = new MutationObserver(() => {cleanBackground();});}function toggleBackgroundCleaner() {ensureObserverCreated();cleanBackground();if (!isObserving) {bgCleanObserver.observe(document.documentElement, {childList: true,subtree: true,attributes: true,attributeFilter: ['style', 'class']});isObserving = true;}}function updatePanelStyle() {if (!panelElement) return;const bv = blurValue != null ? blurValue : 0;const ov = opacityValue != null ? opacityValue : 100;panelElement.style.backdropFilter = `blur(${bv}px)`;panelElement.style.webkitBackdropFilter = `blur(${bv}px)`;panelElement.style.background = `rgba(255, 255, 255, ${ov / 100})`;panelElement.style.color = '#1e1e2f';}function applyMainContainerPadding() {const old = document.getElementById('ldb-main-padding-style');if (old) old.remove();const topBar = document.querySelector('.top-bar');const topH = topBar ? topBar.getBoundingClientRect().height : 48;const style = document.createElement('style');style.id = 'ldb-main-padding-style';style.textContent = `.main-container.lside-nav {padding: 10px !important;box-sizing: border-box !important;background: transparent !important;height: calc(100vh - ${topH}px) !important;max-height: calc(100vh - ${topH}px) !important;display: flex !important;flex-direction: column !important;}.main-container.lside-nav > .panel-layout.ide-container {flex: 1 1 auto !important;height: 100% !important;min-height: 0 !important;min-width: 0 !important;width: 100% !important;margin: 0 !important;box-sizing: border-box !important;}.main-container.lside-nav .panel-layout,.main-container.lside-nav .panel {min-height: 0 !important;min-width: 0 !important;box-sizing: border-box !important;}.ide-textarea.lfe-code {scrollbar-width: none !important;-ms-overflow-style: none !important;box-sizing: border-box !important;max-width: 100% !important;}.ide-textarea.lfe-code::-webkit-scrollbar {display: none !important;width: 0 !important;height: 0 !important;}.ide-textarea.lfe-code::-webkit-scrollbar-corner {display: none !important;background: transparent !important;}`;document.head.appendChild(style);}function applyAll() {applyRounded();applyCardOpacity();applyCardBlur();applyBgFullscreen();applyAdBlock();applyCustomCSS();applyMainContainerPadding();toggleBackgroundCleaner();updatePanelStyle();}function saveAndApply(key, value) {localStorage.setItem(key, value);initVarible();applyAll();}let panelCreated = false;let panelElement = null;function createPanel() {if (panelCreated) return;panelCreated = true;const panelHTML = `<div id="ldb-panel" class="l-card hidden"><button id="ldb-panel-close" aria-label="关闭">×</button><h2>插件设置</h2><h3>卡片模糊度</h3><p><input id="ldb-panel-blur" type="range" min="0" max="30" value="${blurValue != null ? blurValue : 10}" /><span id="blur-value">${blurValue != null ? blurValue : 10}px</span></p><h3>卡片不透明度</h3><p><input id="ldb-panel-opacity" type="range" min="0" max="100" value="${opacityValue != null ? opacityValue : 75}" /><span id="opacity-value">${opacityValue != null ? opacityValue : 75}%</span></p><h3>卡片圆角曲度</h3><p><input id="ldb-panel-rounded-card" type="range" min="0" max="30" value="${cardborderRad != null ? cardborderRad : 15}" /><span id="rounded-value-card">${cardborderRad != null ? cardborderRad : 15}px</span></p><h3>图片圆角曲度</h3><p><input id="ldb-panel-rounded-pic" type="range" min="0" max="16" value="${picborderRad != null ? picborderRad : 8}" /><span id="rounded-value-pic">${picborderRad != null ? picborderRad : 8}px</span></p><p><input id="ldb-panel-card-rounded" type="checkbox" ${cardRounded ? 'checked' : ''} /><label for="ldb-panel-card-rounded">卡片圆角</label></p><p><input id="ldb-panel-pic-rounded" type="checkbox" ${picRounded ? 'checked' : ''} /><label for="ldb-panel-pic-rounded">图片圆角</label></p><p><input id="ldb-panel-bgfullscreen" type="checkbox" ${bgFullscreen ? 'checked' : ''} /><label for="ldb-panel-bgfullscreen">背景全屏(在 <a href="/theme" target="_blank">主题</a> 内启用中景图片进行设置)</label></p><p><input id="ldb-panel-adblock" type="checkbox" ${adBlock ? 'checked' : ''} /><label for="ldb-panel-adblock">关闭广告</label></p><h3>自定义 CSS</h3><p><textarea id="ldb-panel-customCSS">${customCSS}</textarea></p><h3>更新通道</h3><p><select id="ldb-panel-updateChannel"><option value="stable" ${updateChannel === 'stable' ? 'selected' : ''}>稳定版</option><option value="latest" ${updateChannel === 'latest' ? 'selected' : ''}>最新版</option></select></p><p><button id="ldb-panel-checkUpdate">检查更新</button><button id="ldb-panel-reset">还原设置</button></p><p id="ldb-updateStatus"></p></div>`;const container = document.createElement('div');container.innerHTML = panelHTML;panelElement = container.firstElementChild;document.body.appendChild(panelElement);const css = `#ldb-panel {position: fixed !important;right: 35px !important;top: 50% !important;transform: translateY(-50%) !important;padding: 28px 24px 24px !important;background: rgba(255, 255, 255, ${(opacityValue != null ? opacityValue : 75) / 100}) !important;backdrop-filter: blur(${blurValue != null ? blurValue : 10}px) !important;-webkit-backdrop-filter: blur(${blurValue != null ? blurValue : 10}px) !important;border-radius: 24px !important;box-shadow: 0 12px 40px rgba(0,0,0,0.15) !important;color: #1e1e2f !important;transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease !important;z-index: 2147483000 !important;box-sizing: border-box !important;width: min(400px, 50vw) !important;max-width: calc(100vw - 70px) !important;font-family: -apple-system, BlinkMacSystemFont, "Segoe UI","PingFang SC", "Microsoft YaHei", sans-serif !important;font-size: 14px !important;line-height: 1.4 !important;text-align: left !important;}#ldb-panel.hidden {opacity: 0 !important;visibility: hidden !important;transform: translateY(-50%) scale(0.96) !important;pointer-events: none !important;}#ldb-panel-close {position: absolute !important;top: 12px !important;right: 12px !important;width: 32px !important;height: 32px !important;padding: 1px 0 0 0 !important;margin: 0 !important;border: none !important;border-radius: 50% !important;background: #ff4d4f !important;box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;color: #fff !important;font-family: Arial, Helvetica, sans-serif !important;font-size: 22px !important;font-weight: 400 !important;line-height: 1 !important;text-align: center !important;box-sizing: border-box !important;display: inline-flex !important;align-items: center !important;justify-content: center !important;overflow: hidden !important;cursor: pointer !important;transition: background 0.2s, transform 0.2s !important;}#ldb-panel-close:hover { background: #e04345 !important; transform: scale(1.06) !important; }#ldb-panel-close:active { transform: scale(0.92) !important; }#ldb-panel h2 { margin: 0 0 16px 0 !important; font-size: 22px !important;font-weight: 600 !important; color: #2c3e50 !important;line-height: 1.3 !important; }#ldb-panel h3 { margin: 18px 0 6px 0 !important; font-size: 15px !important;font-weight: 500 !important; color: #34495e !important;line-height: 1.3 !important; }#ldb-panel p {margin: 6px 0 12px 0 !important;padding: 0 !important;display: flex !important;align-items: center !important;gap: 10px !important;font-size: 14px !important;line-height: 1.4 !important;}#ldb-panel p > input[type="checkbox"] {flex: 0 0 auto !important;width: 18px !important;height: 18px !important;margin: 0 !important;padding: 0 !important;accent-color: #000 !important;cursor: pointer !important;vertical-align: middle !important;}#ldb-panel p > label {display: inline-block !important;margin: 0 !important;padding: 0 !important;cursor: pointer !important;user-select: none !important;font-size: 14px !important;font-weight: 400 !important;line-height: 1 !important;color: #1e1e2f !important;vertical-align: middle !important;}#ldb-panel input[type="range"] {flex: 1 !important;accent-color: #000 !important;height: 4px !important;border-radius: 2px !important;background: #dce3e8 !important;cursor: pointer !important;margin: 0 !important;padding: 0 !important;}#ldb-panel input[type="range"]::-webkit-slider-thumb {-webkit-appearance: none !important;width: 16px !important; height: 16px !important;border-radius: 50% !important; background: #000 !important;box-shadow: 0 1px 4px rgba(0,0,0,0.2) !important;cursor: pointer !important;}#ldb-panel-customCSS {width: 100% !important;min-height: 60px !important;max-height: 200px !important;padding: 6px 8px !important;font-family: monospace !important;font-size: 13px !important;resize: vertical !important;border: 1px solid #ccc !important;border-radius: 4px !important;box-sizing: border-box !important;line-height: 1.4 !important;}#ldb-panel-updateChannel {flex: 1 !important;height: 32px !important;padding: 0 10px !important;font-size: 14px !important;font-family: inherit !important;color: #1e1e2f !important;background: rgba(255, 255, 255, 0.9) !important;border: 1px solid #ccc !important;border-radius: 8px !important;box-sizing: border-box !important;cursor: pointer !important;outline: none !important;transition: border-color 0.2s, box-shadow 0.2s !important;}#ldb-panel-updateChannel:hover {border-color: #999 !important;}#ldb-panel-updateChannel:focus {border-color: #000 !important;box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.08) !important;}#ldb-panel-checkUpdate {display: inline-block !important;margin: 0 !important;padding: 8px 24px !important;background: #000 !important;border: none !important;border-radius: 30px !important;font-size: 14px !important;font-weight: 500 !important;color: #fff !important;cursor: pointer !important;box-shadow: 0 1px 4px rgba(0,0,0,0.15) !important;line-height: 1.4 !important;box-sizing: border-box !important;transition: background 0.2s, transform 0.1s !important;}#ldb-panel-checkUpdate:hover { background: #333 !important; }#ldb-panel-checkUpdate:active { transform: scale(0.96) !important; }#ldb-panel-reset {display: inline-block !important;margin: 0 !important;padding: 8px 24px !important;background: #ecf0f1 !important;border: none !important;border-radius: 30px !important;font-size: 14px !important;font-weight: 500 !important;color: #2c3e50 !important;cursor: pointer !important;box-shadow: 0 1px 4px rgba(0,0,0,0.05) !important;line-height: 1.4 !important;box-sizing: border-box !important;transition: background 0.2s, transform 0.1s !important;}#ldb-panel-reset:hover { background: #d5dbe0 !important; }#ldb-panel-reset:active { transform: scale(0.96) !important; }#ldb-panel #ldb-updateStatus {display: block !important;margin: 4px 0 0 0 !important;padding: 0 !important;font-size: 12px !important;line-height: 1.4 !important;color: #e53935 !important;text-align: left !important;word-break: break-all !important;}#ldb-panel #ldb-updateStatus:empty {display: none !important;margin: 0 !important;}#blur-value, #opacity-value, #rounded-value-card, #rounded-value-pic {display: inline-block !important;width: 45px !important;text-align: center !important;font-weight: 500 !important;line-height: 1 !important;}#ldb-panel a { color: #0d3d41 !important; text-decoration: none !important; }#ldb-panel a:hover { text-decoration: underline !important; }@media (max-width: 900px) {#ldb-panel { width: 50vw !important; right: 12px !important; }}@media (max-width: 400px) {#ldb-panel { width: calc(100vw - 20px) !important; right: 10px !important;padding: 20px 16px !important; }}`;const styleEl = document.createElement('style');styleEl.textContent = css;document.head.appendChild(styleEl);const cardroundedSlider = document.getElementById('ldb-panel-rounded-card');const cardroundedDisplay = document.getElementById('rounded-value-card');const picroundedSlider = document.getElementById('ldb-panel-rounded-pic');const picroundedDisplay = document.getElementById('rounded-value-pic');const closeBtn = document.getElementById('ldb-panel-close');const blurSlider = document.getElementById('ldb-panel-blur');const blurDisplay = document.getElementById('blur-value');const opacitySlider = document.getElementById('ldb-panel-opacity');const opacityDisplay = document.getElementById('opacity-value');const cardRoundedCb = document.getElementById('ldb-panel-card-rounded');const picRoundedCb = document.getElementById('ldb-panel-pic-rounded');const bgFullscreenCb = document.getElementById('ldb-panel-bgfullscreen');const adBlockCb = document.getElementById('ldb-panel-adblock');const customCssInput = document.getElementById('ldb-panel-customCSS');const updateChannelSelect = document.getElementById('ldb-panel-updateChannel');const checkUpdateBtn = document.getElementById('ldb-panel-checkUpdate');const updateStatus = document.getElementById('ldb-updateStatus');const resetBtn = document.getElementById('ldb-panel-reset');closeBtn.addEventListener('click', () => panelElement.classList.add('hidden'));blurSlider.addEventListener('input', function() {blurDisplay.textContent = this.value + 'px';saveAndApply("LuoguDisplayBetter-blur", this.value);});opacitySlider.addEventListener('input', function() {opacityDisplay.textContent = this.value + '%';saveAndApply("LuoguDisplayBetter-opacity", this.value);});cardroundedSlider.addEventListener('input', function() {cardroundedDisplay.textContent = this.value + 'px';saveAndApply("LuoguDisplayBetter-cardborderRad", this.value);});picroundedSlider.addEventListener('input', function() {picroundedDisplay.textContent = this.value + 'px';saveAndApply("LuoguDisplayBetter-picborderRad", this.value);});cardRoundedCb.addEventListener('change', function() {saveAndApply("LuoguDisplayBetter-cardRounded", this.checked);});picRoundedCb.addEventListener('change', function() {saveAndApply("LuoguDisplayBetter-picRounded", this.checked);});bgFullscreenCb.addEventListener('change', function() {saveAndApply("LuoguDisplayBetter-bgFullscreen", this.checked);});adBlockCb.addEventListener('change', function() {saveAndApply("LuoguDisplayBetter-adBlock", this.checked);});customCssInput.addEventListener('input', function() {customCSS = this.value;saveAndApply("LuoguDisplayBetter-customCSS", this.value);});updateChannelSelect.addEventListener('change', function() {if (updateStatus._ldbTimer) {clearTimeout(updateStatus._ldbTimer);updateStatus._ldbTimer = null;}saveAndApply("LuoguDisplayBetter-updateChannel", this.value);updateStatus.textContent = '';});checkUpdateBtn.addEventListener('click', function() {checkForUpdate(updateStatus);});resetBtn.addEventListener('click', function() {if (updateStatus._ldbTimer) {clearTimeout(updateStatus._ldbTimer);updateStatus._ldbTimer = null;}localStorage.setItem("LuoguDisplayBetter-cardborderRad", 15);localStorage.setItem("LuoguDisplayBetter-picborderRad", 8);localStorage.setItem("LuoguDisplayBetter-blur", 10);localStorage.setItem("LuoguDisplayBetter-cardRounded", true);localStorage.setItem("LuoguDisplayBetter-picRounded", true);localStorage.setItem("LuoguDisplayBetter-adBlock", false);localStorage.setItem("LuoguDisplayBetter-bgFullscreen", true);localStorage.setItem("LuoguDisplayBetter-opacity", 75);localStorage.setItem("LuoguDisplayBetter-customCSS", '');localStorage.setItem("LuoguDisplayBetter-updateChannel", 'stable');initVarible();blurSlider.value = blurValue;cardroundedSlider.value = cardborderRad;picroundedSlider.value = picborderRad;blurDisplay.textContent = blurValue + 'px';opacitySlider.value = 75;opacityDisplay.textContent = '75%';cardroundedDisplay.textContent = '15px';picroundedDisplay.textContent = '8px';cardRoundedCb.checked = true;picRoundedCb.checked = true;bgFullscreenCb.checked = true;adBlockCb.checked = false;customCssInput.value = '';updateChannelSelect.value = 'stable';updateStatus.textContent = '';applyAll();});document.addEventListener('keydown', function(e) {if (e.key === 'Escape' && !panelElement.classList.contains('hidden')) {panelElement.classList.add('hidden');}});}function checkForUpdate(statusEl) {if (statusEl._ldbTimer) {clearTimeout(statusEl._ldbTimer);statusEl._ldbTimer = null;}const url = UPDATE_URLS[updateChannel];if (!url) {statusEl.textContent = '未知通道';return;}statusEl.textContent = '检查中...';GM_xmlhttpRequest({method: 'GET',url: url,headers: {'Cache-Control': 'no-cache'},onload: function(response) {if (response.status !== 200) {statusEl.textContent = '获取失败 (' + response.status + ')';return;}const match = response.responseText.match(/\/\/\s*@version\s+([\d.]+)/);if (!match) {statusEl.textContent = '无法解析版本';return;}const remoteVersion = match[1];const localVersion = GM_info.script.version;if (compareVersions(remoteVersion, localVersion) > 0) {statusEl.innerHTML = '发现新版本 v' + remoteVersion + ',' +'<a href="' + url + '" target="_blank" style="color:#0d6efd;text-decoration:underline;cursor:pointer;">点击安装</a>';} else {statusEl.textContent = '已是最新版本 v' + localVersion;statusEl._ldbTimer = setTimeout(function() {statusEl.textContent = '';statusEl._ldbTimer = null;}, 2000);}},onerror: function() {statusEl.textContent = '网络请求失败';},ontimeout: function() {statusEl.textContent = '请求超时';},timeout: 10000});}function compareVersions(a, b) {const pa = a.split('.').map(Number);const pb = b.split('.').map(Number);for (let i = 0; i < Math.max(pa.length, pb.length); i++) {const na = pa[i] || 0;const nb = pb[i] || 0;if (na > nb) return 1;if (na < nb) return -1;}return 0;}function togglePanel() {if (!panelElement) return;panelElement.classList.toggle('hidden');}function addCustomButton() {if (document.querySelector(`.sidebar.lside.bar.hide.nav-scrollbar`)) {const ul = document.querySelector('.nav-group.on-expand ul[data-v-a119941e]');if (!ul) return;if (ul.querySelector(`#stylePluginSettingButton`)) return;const sampleLi = ul.querySelector('li');if (!sampleLi) return;const newLi = document.createElement('li');for (const attr of sampleLi.attributes) {if (attr.name.startsWith('data-v-')) {newLi.setAttribute(attr.name, attr.value);}}newLi.setAttribute('title', '美化插件设置');const newA = document.createElement('a');const sampleA = sampleLi.querySelector('a');if (sampleA) {for (const attr of sampleA.attributes) {if (attr.name.startsWith('data-v-')) {newA.setAttribute(attr.name, attr.value);}}newA.className = sampleA.className;newA.setAttribute('disabled', sampleA.getAttribute('disabled') || 'false');}newA.href = 'javascript:void(0);';newA.id = 'stylePluginSettingButton';const span = document.createElement('span');const sampleSpan = sampleLi.querySelector('span.title');if (sampleSpan) {for (const attr of sampleSpan.attributes) {if (attr.name.startsWith('data-v-')) {span.setAttribute(attr.name, attr.value);}}span.className = sampleSpan.className;}span.textContent = '美化插件设置';newA.appendChild(document.createComment(''));newA.appendChild(span);newLi.appendChild(newA);newA.addEventListener('click', function(event) {event.preventDefault();togglePanel();});ul.appendChild(newLi);return;}const appsContainer = document.querySelector('.apps');if (!appsContainer) return;if (appsContainer.querySelector(`#stylePluginSettingButton`)) return;const sample = appsContainer.querySelector('a');if (!sample) return;const newLink = document.createElement('a');for (const attr of sample.attributes) {if (attr.name.startsWith('data-v-')) {newLink.setAttribute(attr.name, attr.value);}}newLink.setAttribute('colorscheme', sample.getAttribute('colorscheme') || 'none');newLink.className = sample.className;newLink.href = 'javascript:void(0);';newLink.innerText = '美化插件设置';newLink.id = 'stylePluginSettingButton';newLink.addEventListener('click', function(event) {event.preventDefault();togglePanel();});appsContainer.appendChild(newLink);}let mainDomDebounce = null;function scheduleMainDomWork() {if (mainDomDebounce) return;mainDomDebounce = setTimeout(() => {mainDomDebounce = null;addCustomButton();applyMainContainerPadding();if (bgFullscreen) forceMainTransparent();}, 300);}function init() {const firstUsed = localStorage.getItem("LuoguDisplayBetter-FirstUsed") == null;if (firstUsed) {localStorage.setItem("LuoguDisplayBetter-FirstUsed", false);localStorage.setItem("LuoguDisplayBetter-cardborderRad", 15);localStorage.setItem("LuoguDisplayBetter-picborderRad", 8);localStorage.setItem("LuoguDisplayBetter-blur", 10);localStorage.setItem("LuoguDisplayBetter-cardRounded", true);localStorage.setItem("LuoguDisplayBetter-picRounded", true);localStorage.setItem("LuoguDisplayBetter-adBlock", false);localStorage.setItem("LuoguDisplayBetter-bgFullscreen", true);localStorage.setItem("LuoguDisplayBetter-opacity", 75);localStorage.setItem("LuoguDisplayBetter-customCSS", '');localStorage.setItem("LuoguDisplayBetter-updateChannel", 'stable');}initVarible();createPanel();if (firstUsed) togglePanel();addCustomButton();startAdBlockObserver();applyAll();const observer = new MutationObserver(() => {scheduleMainDomWork();});observer.observe(document.body, { childList: true, subtree: true });}if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init);else init();})();```:::### 已知问题- 卡片模糊度大于 0px 时用户卡片和比赛等级分趋势图卡片错位- 更多请见 [GitHub Issues](https://github.com/Luogu-Plugins/Luogu-Display-Better/issues)> 脚本使用 Claude Opus 5 辅助编写,本文使用 Deepseek R1 辅助编写,保证本人贡献大于 AI 贡献。123456789101137 行未改动495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899Luogu Plugins 用户群QQ 群号 1103713183https://qm.qq.com/q/Ke85zBh6w4---与 @[Ashstrider](/user/1388468) 共同完成**初版**代码编写任务。::::info[效果预览]{open}:::align{center}37 行未改动欢迎在我们的 GitHub 项目中提交 Issue 和 Pull Request 反馈问题,为我们做贡献前请阅读[贡献指南](https://github.com/Luogu-Plugins/Luogu-Display-Better/blob/main/CONTRIBUTING.md)。当然您乐意的话可以通过以下二选一的方式加入我们:- 添加 @[zsTree](/user/1362278) 的 QQ 3757255177;- 进入 [Luogu Plugins 用户群](https://qm.qq.com/q/Ke85zBh6w4)。## 脚本代码[GitHub 下载](https://github.com/Luogu-Plugins/Luogu-Display-Better/releases/tag/v1.4.3)由于 v1.4.1 版本及以后的插件代码过长,这里不再提供源码。如果打不开 GitHub,请尝试通过以下方式下载:- [洛谷档案馆](https://luogu.ac.cn/plugin/ttjghalx) **代码** 选项卡下载;- [脚本猫](https://scriptcat.org/zh-CN/script-show-page/7490) 安装脚本;- 在 v1.2.2 版本及以后的插件设置面板中更新。## 更新日志- 2026.10.13 更新至 v1.4.3:- 添加了暗色模式;- 修复了侧边栏因 Vue.js 更新导致面板设置入口按钮失效的问题。- 2026.10.2 更新至 v1.4.2:- 修复了卡片模糊度大于 0px 时用户卡片和比赛等级分趋势图卡片错位的问题;- 修改部分圆角样式;- 修复了部分性能问题。- 2026.9.29 更新至 v1.4.1:- 修复 Markdown 编辑器全屏时无法正常使用的问题;- 重构部分代码;- 添加检查更新时镜像,减小网络请求失败的概率;- 删去 CodeMirror 5,避免无法加载导致的影响使用的问题。- 2026.9.23 更新至正式版 v1.4.0:- 修复页脚位置、在主页首次使用时不会自动跳出设置面板等问题;- 使用 CodeMirror 5 提升了 CSS 自定义 textarea 编辑体验。- 2026.9.20 更新至正式版 v1.3.0,针对在线 IDE 进行了优化 & 修复了背景被覆盖的问题。- 2026.9.17 更新至 v1.2.3,修复了背景全屏、关闭广告功能的部分已知问题。- 2026.9.16 更新至 v1.2.2,添加了设置面板中更新检查的功能。- 2026.9.15 更新至 v1.2.1,修复了用户主页 `.user-header-bottom` 透明度不统一以及部分不同页面设置面板样式不统一的问题。- 2026.9.12 更新至正式版 v1.2.0,修复了前端更新导致主页背景全屏功能炸了的问题。- 2026.8.26 更新至 v1.1.3,修复了切换毛玻璃样式会多出默认背景和开启毛玻璃无法正确渲染样式的问题。- 2026.8.18 更新至 v1.1.2,修复了新 UI 界面头部卡片侧边多余的模糊。- 2026.8.16 更新至 v1.1.1,修复了脚本偶尔未加载的问题。- 2026.8.1 更新至正式版 v1.1.0,修复了圆角在 SPA 页面中的问题,添加了讨论区评论的圆角效果。- 2026.7.29 更新至 v1.0.4:- 添加了旧前端头像下拉框和侧边栏「应用」的透明、模糊、圆角效果;- 添加了自定义 CSS 功能,添加了侧边栏和顶部栏的模糊效果,修复了模糊度不为 0px 时旧前端头像下拉框被遮挡的问题。---> 脚本及本文均使用 DeepSeek V4.1 Flash 辅助编写,保证本人贡献大于 AI 贡献。