正文
增加 6 行删除 9 行
54 行未改动555657585960616263643 行未改动68697071727374757642 行未改动119120121122123124125126127128129130131132133293 行未改动全部展开427428429430431432433434435146 行未改动全部展开582583584585586587588589590590 行未改动全部展开11811182118311841185118611871188118938 行未改动54 行未改动```javascript// ==UserScript==// @name LGSinLG// @namespace https://www.luogu.com.cn/user/1816684// @version 1.0.3// @description 洛谷国内站:用户主页添加个人介绍卡片;陌生剪切板/文章通过 iframe + API 替换内容,支持 CP OAuth 自动登录和工作流更新;修复多实例刷新问题;替换文章分类、点赞收藏数(纯数字)并禁止交互;支持多操作栏;动态替换右侧目录(保留原生样式);修复加载卡死和跨域自动刷新;iframe 内非锚点链接在顶层跳转;修复 heading-anchor 锚点;安全页超时放弃接管,不再刷新;修改页面标题格式;头像链接放行保留抽屉菜单;修复时间显示偏差(UTC解析);使用全局事件委托彻底解决编辑按钮跳转;主页更新按钮宽度自适应;恢复点赞收藏数及禁用交互功能;检测自己主页不再追加个人介绍卡片;修复浏览器返回后页面不更新的问题;修复 getLoginUid 选择器以适配新版导航栏;修复未保存文章/剪切板时页面卡死在加载中,增加“保存”按钮,修复后退与重试// @author https://www.luogu.com.cn/user/1816684// @match *://*.luogu.com.cn/*// @match *://*.luogu.me/*// @grant GM_xmlhttpRequest3 行未改动(function() {'use strict';console.log('[LGSinLG] 脚本启动,版本 1.0.3', new Date().toISOString());window.addEventListener('unhandledrejection', function(event) {console.error('[LGSinLG] 未捕获的 Promise 拒绝:', event.reason);console.error('[LGSinLG] 当前 URL:', location.href);42 行未改动const m = location.pathname.match(/\/article\/([a-zA-Z0-9]+)/);return m ? m[1] : null;}function formatTime(isoStr) {if (!isoStr) return '未知';const normalized = isoStr.endsWith('Z') ? isoStr : isoStr + 'Z';const d = new Date(normalized);if (isNaN(d.getTime())) return '未知';const pad = n => String(n).padStart(2, '0');return `${d.getUTCFullYear()}-${pad(d.getUTCMonth()+1)}-${pad(d.getUTCDate())} ${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}`;}function forceExternalLinks(container) {if (!container) return;293 行未改动全部展开<button id="lgsinlg-retry-btn" style="margin-top:20px; padding:8px 20px; background:#3498db; color:#fff; border:none; border-radius:4px; cursor:pointer;">重试</button></div>`;// 修复:重试按钮改为直接刷新document.getElementById('lgsinlg-retry-btn').addEventListener('click', () => {location.reload();});146 行未改动全部展开<button id="lgsinlg-retry-btn" style="margin-top:20px; padding:8px 20px; background:#3498db; color:#fff; border:none; border-radius:4px; cursor:pointer;">重试</button></div>`;// 修复:重试按钮改为直接刷新document.getElementById('lgsinlg-retry-btn').addEventListener('click', () => {location.reload();});590 行未改动全部展开const app = document.querySelector('.main-container');if (app) observer.observe(app, { childList: true, subtree: true });else observer.observe(document.body, { childList: true, subtree: true });// 修复:popstate 中增加错误 UI 检测,直接刷新页面window.addEventListener('popstate', () => {console.log('[LGSinLG] popstate 触发,新路径:', location.pathname);const errorDiv = document.getElementById('lgsinlg-error');if (errorDiv && errorDiv.style.display !== 'none') {38 行未改动54 行未改动555657585960616263643 行未改动68697071727374757642 行未改动119120121122123124125126127128129130131132133293 行未改动全部展开427428429430431432433434146 行未改动全部展开581582583584585586587588590 行未改动全部展开1179118011811182118311841185118638 行未改动54 行未改动```javascript// ==UserScript==// @name LGSinLG// @namespace https://www.luogu.com.cn/user/1816684// @version 1.0.4// @description 洛谷国内站:用户主页添加个人介绍卡片;陌生剪切板/文章通过 iframe + API 替换内容,支持 CP OAuth 自动登录和工作流更新;修复多实例刷新问题;替换文章分类、点赞收藏数(纯数字)并禁止交互;支持多操作栏;动态替换右侧目录(保留原生样式);修复加载卡死和跨域自动刷新;iframe 内非锚点链接在顶层跳转;修复 heading-anchor 锚点;安全页超时放弃接管,不再刷新;修改页面标题格式;头像链接放行保留抽屉菜单;修复时间显示为本地时间;使用全局事件委托彻底解决编辑按钮跳转;主页更新按钮宽度自适应;恢复点赞收藏数及禁用交互功能;检测自己主页不再追加个人介绍卡片;修复浏览器返回后页面不更新的问题;修复 getLoginUid 选择器以适配新版导航栏;修复未保存文章/剪切板时页面卡死在加载中,增加“保存”按钮,修复后退与重试// @author https://www.luogu.com.cn/user/1816684// @match *://*.luogu.com.cn/*// @match *://*.luogu.me/*// @grant GM_xmlhttpRequest3 行未改动(function() {'use strict';console.log('[LGSinLG] 脚本启动,版本 1.0.4', new Date().toISOString());window.addEventListener('unhandledrejection', function(event) {console.error('[LGSinLG] 未捕获的 Promise 拒绝:', event.reason);console.error('[LGSinLG] 当前 URL:', location.href);42 行未改动const m = location.pathname.match(/\/article\/([a-zA-Z0-9]+)/);return m ? m[1] : null;}// 格式化时间为本地时间显示function formatTime(isoStr) {if (!isoStr) return '未知';const d = new Date(isoStr);if (isNaN(d.getTime())) return '未知';const pad = n => String(n).padStart(2, '0');return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;}function forceExternalLinks(container) {if (!container) return;293 行未改动全部展开<button id="lgsinlg-retry-btn" style="margin-top:20px; padding:8px 20px; background:#3498db; color:#fff; border:none; border-radius:4px; cursor:pointer;">重试</button></div>`;document.getElementById('lgsinlg-retry-btn').addEventListener('click', () => {location.reload();});146 行未改动全部展开<button id="lgsinlg-retry-btn" style="margin-top:20px; padding:8px 20px; background:#3498db; color:#fff; border:none; border-radius:4px; cursor:pointer;">重试</button></div>`;document.getElementById('lgsinlg-retry-btn').addEventListener('click', () => {location.reload();});590 行未改动全部展开const app = document.querySelector('.main-container');if (app) observer.observe(app, { childList: true, subtree: true });else observer.observe(document.body, { childList: true, subtree: true });window.addEventListener('popstate', () => {console.log('[LGSinLG] popstate 触发,新路径:', location.pathname);const errorDiv = document.getElementById('lgsinlg-error');if (errorDiv && errorDiv.style.display !== 'none') {38 行未改动