显示用户注册时间的油猴脚本 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
xarthur

显示用户注册时间的油猴脚本

  •  
  •   xarthur 2023 年 5 月 23 日 1604 次点击
    这是一个创建于 1067 天前的主题,其中的信息可能已经有所发展或是发生改变。

    花了一点点时间,写了一个非常简单的油猴脚本,可以显示帖子回复用户的注册时间,希望在这个诸君情绪都不稳定的时代,给大家多一点的辨认信息。

    // ==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 条附言    2023 年 5 月 23 日

    更新了缓存和移动设备的支持。

    https://gist.github.com/FledgeXu/fba309a7d1a44ab09dc68c954c47a138

    5 条回复    2023-05-24 14:48:27 +08:00
    westoy
        1
    westoy  
       2023 年 5 月 23 日
    站长喜提 CC
    xarthur
        2
    xarthur  
    OP
       2023 年 5 月 23 日
    @westoy api 应该是有每小时限制的,所以应该没事?
    lisongeee
        3
    lisongeee  
       2023 年 5 月 23 日
    api/members/show.json 接口获得的信息可以保存在本地,key 是 id

    而根据头像链接可以直接获得用户 id ,所以每个用户实际上只需要一次请求就行
    shyangs
        4
    shyangs  
       2023 年 5 月 23 日
    建加一存,把查的存起,

    先本存,不要反反覆覆路求 API.
    christin
        5
    christin  
       2023 年 5 月 24 日
    这算是查成分吗?
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     892 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 31ms UTC 21:46 PVG 05:46 LAX 14:46 JFK 17:46
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86