
花了一点点时间,写了一个非常简单的油猴脚本,可以显示帖子回复用户的注册时间,希望在这个诸君情绪都不稳定的时代,给大家多一点的辨认信息。
// ==UserScript== // @name Aparecium // @namespace http://tampermonkey.net/ // @version 0.1 // @description Shows User's create time in V2ex. // @author FledgeShiu // @copyright No License // @match *://*.v2ex.com/t/* // @match *://v2ex.com/t/* // @icon https://v2ex.com/static/icon-192.png // @grant none // ==/UserScript== (function() { 'use strict'; async function run() { let comment_nodes = document.querySelectorAll("div[id^=r_].cell"); comment_nodes.forEach(async function(node){ const user = node.querySelectorAll("tr>td:last-child")[0]; const user_info_url = user.querySelectorAll("strong>a")[0].href; const user_name = user_info_url.split('/').at(-1); const respOnse= await fetch(`https://${window.location.host}/api/members/show.json?username=${user_name}`); const jsOnData= await response.json(); const date = new Date(jsonData.created * 1000).toLocaleDateString() const age_element = user.getElementsByClassName("ago")[0]; const next_element = age_element.nextSibling const empty_text = document.createTextNode('\u00A0 \u00A0'); user.insertBefore(empty_text, next_element); let new_element = document.createElement("span"); new_element.innerHTML = date; new_element.classList.add("ago"); user.insertBefore(new_element, next_element); }); } run() })(); 1 westoy 2023 年 5 月 23 日 站长喜提 CC |
3 lisongeee 2023 年 5 月 23 日 api/members/show.json 接口获得的信息可以保存在本地,key 是 id 而根据头像链接可以直接获得用户 id ,所以每个用户实际上只需要一次请求就行 |
4 shyangs 2023 年 5 月 23 日 建加一存,把查的存起, 先本存,不要反反覆覆路求 API. |
5 christin 2023 年 5 月 24 日 这算是查成分吗? |