Hey all!

Our lemmy.blahaj.zone has been updated to v0.19.5.

Let us know if you notice any issues with the upgrade!

You are viewing a single thread.
View all comments
1 point

I made this userscript to put the vote count in comments back beside the vote button because the new one is kind of hard to see, its not the prettiest script (idk much about javascript), but I’ve tested it in Librewolf with Violentmonkey and it does work, hope it helps someone else!

// ==UserScript==
// @name        New script blahaj.zone
// @namespace   Violentmonkey Scripts
// @match       https://lemmy.blahaj.zone/post/*
// @grant       none
// @version     1.0
// @author      -
// @description 8/24/2024, 3:32:47 PM
// @run-at      document-idle
// ==/UserScript==

function main ()
{
	var parent_comments = document.getElementsByClassName("comment list-unstyled"); 
	for (var i = 0; i < parent_comments.length; /*i++*/)
	{
		/*console.log(i);*/
		var comments = parent_comments[i].getElementsByTagName("article");
		for (var j = 0; j < comments.length; j++)
		{
			var upvote_button = comments[j].getElementsByTagName("button")[1];
			
			if (upvote_button.attributes["vote_count_patched"] != null)
			{
				i++;
				continue;
			}
			
			var post_votes = upvote_button.attributes[2].textContent.split(' ')[0];
			upvote_button.append(' ' + String(post_votes));
			upvote_button.attributes["vote_count_patched"] = true;
			i++;
		}
	}
}
/*var mutation = null;
var mutation_observer = new MutationObserver(function(m) { mutation = m; console.log("new mutation logged yo");} );
mutation_observer.observe(document, { childList: true, subtree: true }); */

var mutation_observer = new MutationObserver(main);
mutation_observer.observe(document, { childList: true, subtree: true});

main();
permalink
report
reply

Blahaj Lemmy Meta

!main@lemmy.blahaj.zone

Create post

Blåhaj Lemmy is a Lemmy instance attached to blahaj.zone. This is a group for questions or discussions relevant to either instance.

Community stats

  • 14

    Monthly active users

  • 229

    Posts

  • 4K

    Comments