I made a userscript (eventually converted into a userstyle) so I could go sightseeing across lemmy and spot all you animals out in the wild. pawb.social, pawb.fun, and furry.engineer are pre-filled already, but you can add other servers to track as well!
Edit: Special mention to redyoshi49q@furry.engineer for this post, whose techniques resulted in CSS to achieve parity with my userscript. My older userscript should not be used anymore, as the CSS will do the same thing but more efficiently.
Instructions:
-
Install Stylus extension for firefox/chrome
-
“Write new style” in the addon settings
-
Copy paste the CSS code below in
-
Modify the code around line ~11 in order to reflect your homeserver and any additional frendservers that you want to highlight. Currently it’s set to pawb.social and the mastodon servers that pawb.social also operates, but feel free to add some of the furry instances below as well (post in the comments if you’ve got a good furry instance to add here!):
- yiffit.net
- meow.social
-
Modify the code around line ~19 to reflect your homeserver
-
(Optional) If you’d like your homeserver buddies to have a different marker, uncomment the various sections around line ~27 through ~50 by removing the
/*
and*/
bits -
(Optional) Play around with different markers and colors!
CSS/Userstyle: https://gist.github.com/redyoshi49q/f1b2d1da0a8f7536aba1f8c3110d2dd8
Edit: Okay, apparently you need to pick a language if you’re sending a message from lemmy to mastodon, otherwise you get eternal spinner.
Normal comment as follows:
You’re amazing. I had a gut feeling that CSS could solve this but I couldn’t find enough info myself. I’m a backend/integration guy and CSS scares me.
This solution is definitely better designed than mine, but I’m not sure if it can handle highlighting when you’re on a foreign server instance (e.g. literally on beehaw.org and not pawb.social). This isn’t a huge deal imo but I posted the script somewhere and someone immediately wanted that feature so I put it into mine. I did solve the shifting around issue - it wasn’t that hard to solve I just wasn’t expecting lemmy to reuse elements in such a weird way. When a post comes into the feed, all the elements change their values directly - nothing “moves” around in the DOM (at least that’s what I observed during 10 seconds of testing).
With your current CSS, there’s an issue where the star inserts itself on upvote counts for me after I’ve upvoted a post:
This should be fixable by using something like this (pls fix if I’m doing it wrong):
a.text-info[title$="@lemmy.blahaj.zone"] span::before { content: "❤ "; color: red !important; } a.text-info:not([title*="."])[href*="/u/"] span::before { content: "★ "; color: yellow !important; }
I can confirm both that my original version has the bug you described and that your fix does not produce that bug.
I don’t actually have a native Lemmy account, so I didn’t realize that upvoting would cause the upvote count to gain a CSS class that I used in my selector.
(Thankfully, the DOM changed to reflect given/taken upvotes in spite of me not being logged into the Lemmy server at all; I only got a “Not logged in.” error each time.)
(Also, you would not believe how often I’ve had to write user CSS to unbreak the broken CSS of websites.
A classic example is when the CSS defines dark text color without defining a background color. The browser I use derives color defaults from the OS, which uses light text on a dark background, and the page renders in dark text on a dark background, generally becoming nearly unreadable.
I’ve also (ab)used “display: none !important;” to snip out annoying “improvements” to pages.)
I’ve ended up with a style like this:
a.text-info[href*="/u/"][href$="@pawb.social"] span::before, a.text-info[href*="/u/"][href$="@pawb.fun"] span::before, a.text-info[href*="/u/"][href$="@furry.engineer"] span::before { content: "❤ "; color: red !important; } a.text-info[href*="/u/"]:not([href*="@"]) span::before { content: "★ "; color: yellow !important; }
Frustratingly, I can’t seem to check whether pawb.social is in the href of a relative href like
/u/yote_zip
. If I could do that, this could work on foreign instances, because I could add a qualifier that someone is not only a member of the instance I’m currently on, but also my specific homeserver. As-is, this can be limited to pawb.social and will work just fine.Try this:
@-moz-document domain(“pawb.social”), domain(“yiffit.net”) {
a.text-info[href*=“/u/”][href$=“@pawb.fun”] span::before,
a.text-info[href*=“/u/”][href$=“@furry.engineer”] span::before {
content: “❤ “;
color: red;
}
a.text-info[href*=”/u/”]:not([href*=“@”]) span::before {
content: "★ ";
color: yellow;
}
}
@-moz-document domain(“pawb.social”) {
a.text-info[href*=“/u/”]:not([href*=“@”]) span::before {
content: "❤ " !important;
color: red !important;
}
}
There’s three lists of domains at play here:
* The domains in the first @-moz-document are domains where hearts and stars appear at all.
* The domains in that section’s a.text-info block are the domains that get hearts.
* The domains in the second @-moz-document are the domains where the stars are overridden by hearts.
This lets you always have hearts on an instance, even if you’re already on that instance, while also letting you have stars show native accounts elsewhere.
I’m unsure if this is what you mean exactly, but I was able to use your techniques to get parity with my script’s logic (star removed for simplicity at the moment):
a.text-info[href*="/u/"][href$="@pawb.social"] span::before, a.text-info[href*="/u/"][href$="@pawb.fun"] span::before, a.text-info[href*="/u/"][href$="@furry.engineer"] span::before { content: "❤ "; color: red; } @-moz-document domain("pawb.social") { a.text-info[href*="/u/"]:not([href*="@"]) span::before { content: "❤ " !important; color: red !important; } }
This CSS is logically equivalent to what I was doing in my script:
So it works on all sites and highlights users from the first 3 sites (first is a user’s homeserver). On pawb.social specifically, it detects native users and adds a heart to them. In practice, this means everyone from those 3 servers should always have a heart next to them no matter where you go in the lemmyverse.