Topic: [Feature] Add a data attribute for voted status

Posted under Site Bug Reports & Feature Requests

Sorry if this has already been brought up, but I was having trouble finding a related forum thread.

It would be helpful to have a styling hook for voted status. I'd probably do this with a voted data attribute, similar to how favorites are. data-voted="" with possible values of up or down or false if the post hasn't be voted on. I'd like to use this as a styling hook to add a red or green underline to voted posts. Something like:

article.thumbnail[data-voted="down"] .desc {
  border-bottom: 3px solid var(--palette-text-red);
}

article.thumbnail[data-voted="up"] .desc {
  border-bottom: 3px solid var(--palette-text-green);
}

/* Unrelated, but I also make the following CSS change to easily see favorited posts */
article.thumbnail[data-is-favorited="true"] .desc {
  border-bottom: 3px solid var(--color-dtext-section);
}

The styling hook would help power users quickly identify posts they've already seen, or skip over posts they know they don't like but didn't have a good combination of tags to blacklist.

I'm not sure of the technical complexities of implementing this feature, as I'm just a front end developer and have no idea how the data is stored in the database, or what the impact would be for server performance, but I figured since there was a data attribute for favorites, it may not be too far of a stretch to ask for this too.

Kind of a separate issue, but I'd love to be able to easily whitelist upvoted posts from the blacklist, and blacklist downvoted posts. I think I read somewhere on the forum a few days ago that there were performance concerns around that though, or something. It would be nice to add voteddown:anything as a line item in the blocklist, and whitelist upvoted posts maybe by adding -votedup:anything to each line in the blacklist. Or maybe there could be a setting to hide downvoted posts and show upvoted posts regardless of any blacklist filter match.

The biggest issue this addresses is that the alternative, as best I can tell, is to just add -voteddown:anything to every search, which is a tad annoying. If there's a way to make a client side script to accomplish this, kindly point me in the right direction and I can write an implementation for myself.

Donovan DMC

Former Staff

A while back I internally suggested some changes that would make this possible, and got shot down due to performance concerns

We've been told before that even the favorited attribute may go away if it causes too many performance issues

arenliore said:
...

You don't have to literally type anything in -voteddown:anything, any text you put there will have the same effect. I just do -votedup:me for filtering out what I've seen for consistency with my bookmarks, but -votedup:. would work the same. Less typing required, that should make it less annoying.
As for blacklisting what you have downvoted, again this isn't nearly as convenient as your idea if it was implemented, but just add to your blacklist id:xxxxxxx if you come across a post you especially don't like.