[Userscript] Like Counter

Oh, alright, cool. Good that you figured it out

1 Like

So, for me, the like counter disappeared entirely. The script is still installed. Not sure what’s going on, 


Maybe you’re having the same problem as jnk. Could you open up the console (ctrl+shift+j) and check for errors?

So it’s showing up at home (not sure how right it is, 0 likes, N/A next) with no console errors. It was my work computer that had it not showing at all, so remind me tomorrow to check!

Okay that’s not right. It’s only supposed to be N/A when you still have all your likes. I’ll look into it as soon as I get out of bed

Well I know I don’t have all my likes but I don’t think I’m currently out. Close though, because I was out around 5-6 hours ago. Let me know if you need anything tested.

Could you open up the console, input localStorage.getItem('WKFlikeCounter') and DM me the output?

Thank you. I see the problem. Which version are you on? I believe the most recent version (0.5.15) should fix that right away

Geez, somehow I’m waaaaaaay behind. Guess I followed the wrong link? Let me update and that should help. Also WK thinks I should reply to more people in this thread
 :rofl:

1 Like

Okay, updated to most recent and lost the counter entirely. Console error does indeed exist, waitForKeyElements not defined.

Could be that your script handler doesn’t update automatically, or that it only does so once a week or something like that. That bug was a recent introduction, after all.

The problem you describe is the one JNK had, so try their solution and replace

// @require      https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012

with 

// @require      https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js

That did the trick! I mean, it’s wrong, but I know it takes like 24 hours to catch up so that’s should be fine. Thank you!!

1 Like

v.1.0.0. Released

Yay! Okay, it seems to be as accurate as it’s going to get now so it’s time for the full release. I haven’t messed much with what was already there, I only moved some stuff around and optimised a few things. However
 we have some new features. v.1.0.0. brings tooltips!

image image

But wait, there’s more! I also added an optional counter for likes received in the past 24 hours!

image

Aaaand
 that’s it. Nothing else. Although I should mention that the likes received counter is disabled by default since that’s not the main purpose of the script, it can be enabled by changing showLikesReceivedCounter to true in the script. There is also an option for whether you want to show the relative time seen in the Next Like tooltip to be shown in 12-hour or 24-hour format. The default is 12-hour but it is easily changed.

image

4 Likes

When you delete a few posts

image

3 Likes

Apparently I’m really good at breaking this script
 :smile:

After clearing my browser cache at the request of someone trying to help me in the BunPro thread, the script stopped functioning at all, and began throwing Undefined Type exceptions when attempting to reference array dailyLikes at line 220.

if (dailyLikes[dailyLikes.length - 1][0] + 1000*60*60*24 < Date.now() || dailyLikes.length == 0) {

After some poking and prodding, it seemed that after resetting my browser cache, dailyLikes became an array of length 0. And so when it attempted to run the above instruction of dailyLikes.length -1, it would throw an error and stop.

In order to remedy the situation, I changed line 220 to the following:

if (dailyLikes.length == 0 || dailyLikes[dailyLikes.length - 1][0] + 1000*60*60*24 < Date.now()) {

This way it would evaluate for a length of 0 before attempting to perform operations on the length of the array, which allowed the script to run again.

Worth noting, though, once I was able to get the script to run once, returning line 220 to it’s original form did not break the script again. So I don’t know if this is just an issue when browser cache is cleared or what. :confused:

Just thought I’d let you know.

Edit: I just realized that clearing my browser cache also seemed to fix my Forums Level Badge. o.O Sweet.

1 Like

Ah, of course. How you did it is how I should have done it from the start, I’ll update it right away

1 Like

The count is 75 for members (50 for basics). Are you seeing numbers above 75? It should recognise that you’re not longer a regular but I have not been able to test that.

1 Like

No, I think I worked it out, I had like 73-74 likes, so I assumed 100 was the number I had come from. Oh well, thankyou :slight_smile:

Installed this one now as well. Thank you @Kumirei, you’re the best!

girls%20und%20panzer%20-%20anglerfish

3 Likes

psssst, @Kumirei, not sure if you saw that some work might be needed on the counter


(I don’t know how/who has been affected though, so might be impossible for you to realistically take into account)

1 Like