102
submitted 2 months ago by supakaity to c/main

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 comment's thread
view the rest of the comments
[-] 12510198 1 points 2 months ago

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();
this post was submitted on 24 Aug 2024
102 points (100.0% liked)

Blahaj Lemmy Meta

2321 readers
1 users here now

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

founded 2 years ago
MODERATORS