版本比较
军火库说是
正文
增加 70 行删除 0 行
1,741 行未改动全部展开174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819992 行未改动全部展开1,741 行未改动全部展开
})();```::::::info[复制 Markdown]```js// ==UserScript==// @name 洛谷专栏 Markdown 源码// @namespace https://www.luogu.com.cn/// @version 1.1.0// @description 从当前专栏页面复制原始 Markdown// @match https://www.luogu.com.cn/article/*// @match https://www.luogu.com/article/*// @run-at document-idle// @noframes// @grant GM_setClipboard// ==/UserScript==(() => { 'use strict'; const route = /^\/article\/([a-z0-9]+)\/?$/i; const label = '复制 MD'; if (!route.test(location.pathname)) return; function copy(txt) { const ctx = document.getElementById('lentille-context'); let art; try { art = JSON.parse(ctx?.textContent ?? 'null')?.data?.article; } catch { alert('页面内嵌数据解析失败。'); return; } if (typeof art?.content !== 'string') { alert('当前页面未提供 Markdown 源码。'); return; } if (art.lid !== location.pathname.match(route)?.[1]) { alert('文章地址已切换,请刷新当前页面后再复制。'); return; } GM_setClipboard(art.content, 'text', () => { txt.textContent = '已复制'; setTimeout(() => { txt.textContent = label; }, 1500); }); } function mount() { if (!route.test(location.pathname)) return; for (const bar of document.querySelectorAll('.article-content > .actions')) { if (bar.querySelector('.luogu-copy-md')) continue; const ref = [...bar.children].find(el => el.matches('.button-2line') && el.querySelector('.text')?.textContent.trim() === '不推荐'); if (!ref) continue; const btn = document.createElement('button'); btn.type = 'button'; btn.className = 'button-2line luogu-copy-md'; btn.style.cssText = 'border:0;background:none;padding:0;font:inherit;align-items:center;white-space:nowrap'; const icon = document.createElement('span'); icon.className = 'icon'; icon.textContent = '⎘'; icon.setAttribute('aria-hidden', 'true'); const txt = ref.querySelector('.text').cloneNode(false); txt.textContent = label; for (const attr of txt.getAttributeNames().filter(name => name.startsWith('data-v-'))) { btn.setAttribute(attr, ''); icon.setAttribute(attr, ''); } btn.append(icon, txt); btn.addEventListener('click', () => copy(txt)); ref.after(btn); } } new MutationObserver(mount).observe(document.body, {childList: true, subtree: true}); mount();})();```::::::info[anti-ai]```js// ==UserScript==// @name Luogu 反隐藏内容高亮显示992 行未改动全部展开