Open Darknesskight opened 9 years ago
Thanks Kight, this really speeds the process up :)
There is a small bug with your code though, it is only launchable twice before it triggers the else-clause after every second ID-page until the EQD-page is reset. This happens both with your code as posted and the code when put into functions.
For this function it isn't that noticable because it mostly gets only launched once anyway but it might affect other codes where this function is used in.
Hmm. Its probably because I didn't remove it out of the array properly. I was thinking about it this morning and just setting the value to undefined will not work as the length of the array stays the same. Trying doing the below and see if that fixes it. I can take an extra look at it when I get home.
Replace id_action_list['page_load'][lastAction] = undefined with id_action_list['page_load'].pop();
Yap, that works.
Thanks a lot :)
No problem. I will need to double check but ID may not append the functions to the end of the array or may be reorganizing it after adding the function. Pop may not work if ID does either of the previously mentioned things. I will update this issue when I find out.
I updated the gist with the fix. I moved the inline function code into the count comment function and registered the comment function itself to ID. This allows me to use indexOf to find it and use splice to remove it.
Registering a function:
id_add_action('page_load', countCommentThreads);
Unregistering the function
var commentCountIndex = id_action_list['page_load'].indexOf(countCommentThreads); id_action_list['page_load'].splice(commentCountIndex, 1);
You mentioned that you had issues with knowing when comments are loaded. I have already solved this in PonyDebate as I needed to know when to place refresh buttons. I created a gist for you to look at so that you can have the counting go by much faster. I hope it helps you out.
Counting comment threads
You can see other api options available to you here. You can view PonyDebate or ask me on how to use them. IntenseDebate hooks and filters