osu! Nickname

Add a Nickname under name to help recognizing someone

  1. // ==UserScript==
  2. // @name osu! Nickname
  3. // @namespace http://wa.vg/
  4. // @version 0.1
  5. // @description Add a Nickname under name to help recognizing someone
  6. // @author ieb <1@wa.vg>
  7. // @match https://osu.ppy.sh/*
  8. // @match http://osu.ppy.sh/*
  9. // ==/UserScript==
  10.  
  11. $('.profile_friend a').each(function(){
  12. if ($(this).attr('href').match(/\/u\/(\d+)/)){
  13. if ($(this).text().replace(/\s/g,'')!=''){
  14. ID = $(this).attr('href').match(/\/u\/(\d+)/)[1];
  15. if (localStorage.getItem('/nick/' + ID)){
  16. console.log($(this).text());
  17. Nick = localStorage.getItem('/nick/' + ID)
  18. $(this).html($(this).html() + ' <span style="color:red">('+Nick+')</span>');
  19. }
  20. }
  21. }
  22. });
  23. $('a.postauthor').each(function(){
  24. if ($(this).attr('href').match(/\/u\/(\d+)/)){
  25. if ($(this).text().replace(/\s/g,'')!=''){
  26. ID = $(this).attr('href').match(/\/u\/(\d+)/)[1];
  27. if (localStorage.getItem('/nick/' + ID)){
  28. console.log($(this).text());
  29. Nick = localStorage.getItem('/nick/' + ID)
  30. $(this).html($(this).html() + '<br/><span style="font-weight:600;font-size:12px;color:#0077ff">('+Nick+')</span>');
  31. }
  32. }
  33. }
  34. });
  35. if ($('.profile-username')[0] !== null){
  36. t = $($('.profile-username')[0]);
  37. ID = userId;
  38. if (localStorage.getItem('/nick/' + ID)){
  39. console.log($(t).text());
  40. Nick = localStorage.getItem('/nick/' + ID);
  41. if (Nick.replace(/\s/g,'')=='') {
  42. localStorage.removeItem('/nick/' + ID);
  43. Nick = "Set Nickname";
  44. }
  45. }else{
  46. Nick = "Set Nickname"
  47. }
  48. $(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>');
  49. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址