您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a Nickname under name to help recognizing someone
// ==UserScript== // @name osu! Nickname // @namespace http://wa.vg/ // @version 0.1 // @description Add a Nickname under name to help recognizing someone // @author ieb <[email protected]> // @match https://osu.ppy.sh/* // @match http://osu.ppy.sh/* // ==/UserScript== $('.profile_friend a').each(function(){ if ($(this).attr('href').match(/\/u\/(\d+)/)){ if ($(this).text().replace(/\s/g,'')!=''){ ID = $(this).attr('href').match(/\/u\/(\d+)/)[1]; if (localStorage.getItem('/nick/' + ID)){ console.log($(this).text()); Nick = localStorage.getItem('/nick/' + ID) $(this).html($(this).html() + ' <span style="color:red">('+Nick+')</span>'); } } } }); $('a.postauthor').each(function(){ if ($(this).attr('href').match(/\/u\/(\d+)/)){ if ($(this).text().replace(/\s/g,'')!=''){ ID = $(this).attr('href').match(/\/u\/(\d+)/)[1]; if (localStorage.getItem('/nick/' + ID)){ console.log($(this).text()); Nick = localStorage.getItem('/nick/' + ID) $(this).html($(this).html() + '<br/><span style="font-weight:600;font-size:12px;color:#0077ff">('+Nick+')</span>'); } } } }); if ($('.profile-username')[0] !== null){ t = $($('.profile-username')[0]); ID = userId; if (localStorage.getItem('/nick/' + ID)){ console.log($(t).text()); Nick = localStorage.getItem('/nick/' + ID); if (Nick.replace(/\s/g,'')=='') { localStorage.removeItem('/nick/' + ID); Nick = "Set Nickname"; } }else{ Nick = "Set Nickname" } $(t).html($(t).html() + '<br/><span style="font-weight:600;font-size:13px;color:#0077ff" onclick="localStorage.setItem(\'/nick/'+ ID + '\',prompt(\'Nickname\'));document.location.reload()">'+Nick+'</span>'); }