I’m so excited about this, I just had to share
Good choice! Welcome to the club. Now we both just need to join the super special level 60 club and get the shiny gold medals
Thanks! Yes, my plan is to get to level 60, savour it a bit, and then reset to one.
It’s quite the club, I’ll tell you!
Every once in a while, someone even does or says something, it’s crazy!
Wow! I want to do that too!
I also upgraded to lifetime! Exciting!
Aaaaaaaaand I’m a lifetime member. Any tips on how to celebrate?
Just adding a bit of blue to this purple fest.
Print your bank statement!
Still beautiful, thank you!
And now you’ve added more rainbow.
Oh my… there needs to be a userscript for this!
Just think, you’re over halfway to this pinnacle of excitement!
FYI, you can eliminate the mutation observer and use only CSS:
code (click to open)
function rainbowify(user_id) {
$('head').append(
'<style user-id="'+user_id+'">'+
' [data-user-id="'+user_id+'"] .avatar-flair {'+
' color: rgb(42,42,42) !important;'+
' background: linear-gradient(-45deg, #f9c4fb , #dab3fc, #bdd6ff, #c3fdd2, #fcfec2, #f8d4a6, #f8b9b9) !important;'+
' }'+
'</style>'
);
}
function unrainbowify(user_id) {
$('style[user-id="'+user_id+'"]').remove();
}
Oh really? I’m new to JS so I’m a bit embarrassed to have people look at my code, I’m happy as long as it works. I understand that it adds the css, but how does that work when the flair isn’t a descendant of anything relating to the username?
edit: nvm, I see now. That’s clever, I wouldn’t have thought of it.
Just some tricks I learned along the way.
Always glad to help
I have no idea what any of anything means and you made something that creates beautiful rainbows. I think you have zero reasons to be embarrassed! I love it and thanks for making it!
Hmm, I wonder though. I’m also using the mutation observer to attach a function to avatars when you load new posts. Your trick definitely makes the script simpler, but I don’t think I could remove the mutation observer
I just did the thing and went lifer