Warning: fopen(/www/sites/update.greasyfork.icu/index/store/temp/c86077cbd96492b916eb3071b663fcd3.js): failed to open stream: No space left on device in /www/sites/update.greasyfork.icu/index/scriptControl.php on line 65
// ==UserScript== // @name 知乎评论区显示momo/用户唯一ID // @namespace https://zhufn.fun // @version 1.8 // @license AGPL3 // @description 可配置显示所有用户id或只显示指定用户名(如momo)的。可切换使用人类可读id(需发送请求,可能有反爬)或一串16进制id // @author zhufengning // @match https://www.zhihu.com/* // @grant GM_registerMenuCommand // @grant GM_getValue // @grant GM_setValue // @grant GM_xmlhttpRequest // @run-at document-end // @downloadURL https://update.greasyfork.icu/scripts/526189/%E7%9F%A5%E4%B9%8E%E8%AF%84%E8%AE%BA%E5%8C%BA%E6%98%BE%E7%A4%BAmomo%E7%94%A8%E6%88%B7%E5%94%AF%E4%B8%80ID.user.js // @updateURL https://update.greasyfork.icu/scripts/526189/%E7%9F%A5%E4%B9%8E%E8%AF%84%E8%AE%BA%E5%8C%BA%E6%98%BE%E7%A4%BAmomo%E7%94%A8%E6%88%B7%E5%94%AF%E4%B8%80ID.meta.js // ==/UserScript== (function() { 'use strict'; let targetName = GM_getValue('targetName', 'momo'); let showAllUsers = GM_getValue('showAllUsers', false); let fetchHumanReadable = GM_getValue('fetchHumanReadable', true); let userIdCache = GM_getValue('userIdCache', {}); let maxIdLength = GM_getValue('maxIdLength', 4); function saveUserIdCache() { GM_setValue('userIdCache', userIdCache); } function clearUserIdCache() { userIdCache = {}; GM_setValue('userIdCache', userIdCache); alert('已清除用户ID缓存'); } function fetchHumanReadableID(userId, callback) { if (!fetchHumanReadable) { callback(userId.substring(0, maxIdLength)); return; } if (userIdCache[userId]) { callback(userIdCache[userId]); return; } GM_xmlhttpRequest({ method: 'GET', url: `https://www.zhihu.com/people/${userId}`, onload: function(response) { try { const jsonMatch = response.responseText.match(/