// ==UserScript== // @name osu! Nickname // @namespace http://wa.vg/ // @version 0.1 // @description Add a Nickname under name to help recognizing someone // @author ieb <1@wa.vg> // @match https://osu.ppy.sh/* // @match http://osu.ppy.sh/* // @downloadURL none // ==/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() + ' ('+Nick+')'); } } } }); $('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() + '
('+Nick+')'); } } } }); 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() + '
'+Nick+''); }