infinite-scroll icon indicating copy to clipboard operation
infinite-scroll copied to clipboard

Rating of a topic and infinite scroll

Open madromas opened this issue 1 year ago • 1 comments

After new batch of topics load up, my rating of a topics stops working. How do I initialize a function every time it loads more topics?

icms.rating.onDocumentReady();

Where do I place it, so it will run every time infinite scroll loads more topics?

madromas avatar Feb 23 '24 21:02 madromas

Fancybox for gallery also stops working after new topics load. How to reinitialize that?

madromas avatar Feb 27 '24 12:02 madromas

for initializing a function every time it loads more topics you should add the functionality in the method defined for the path attribute of infinite scroll

ac-mmi avatar Jun 16 '24 17:06 ac-mmi

for initializing a function every time it loads more topics you should add the functionality in the method defined for the path attribute of infinite scroll

This didn't help at all....

madromas avatar Jun 16 '24 20:06 madromas

need code to understand better

ac-mmi avatar Jun 17 '24 05:06 ac-mmi

icms.rating.onDocumentReady();

I have presented it above.

Here is what I did:

  history: false,
  scrollThreshold: 500,
});
$('.content_list').one('click', function(){
      icms.rating.onDocumentReady();
    }); 

Everything works. but, there is this extra click I have to do. Lets say I want to vote up, I have to click arrow twice for it to log the vote. And same with every post.

madromas avatar Jun 17 '24 12:06 madromas

you are using this infinite scroll in the conversations list page

ac-mmi avatar Jun 19 '24 06:06 ac-mmi

No, on the post list page here glonks.com

madromas avatar Jun 19 '24 12:06 madromas

Reason for your vote-up not working is that your event a.vote-up.click won't work for dynamically generated elements in order to rectify that you should use $(document).on('click', 'a.vote-up', function(){ //function defintion }); It allows you to attach an event handler to a parent element that is always present (like document).

ac-mmi avatar Jun 19 '24 17:06 ac-mmi

What about on vote-down?

You see here. I appreciate the help, but I fail to understand.

Like this?

$(document).on('click', 'a.vote-up', function(){  
icms.rating.onDocumentReady();
});

$(document).on('click', 'a.vote-down', function(){  
icms.rating.onDocumentReady();
});

madromas avatar Jun 19 '24 21:06 madromas

Yes,The reason is that when you load more posts, the click event isn't bound to the newly generated vote-up/down buttons. By using $(document).on,the document is searched for the vote-up/down button every time it gets clicked, thereby binding the event dynamically to both existing and newly added buttons.

ac-mmi avatar Jun 20 '24 06:06 ac-mmi

It works good. Only one tiny issue. Is there a way to make that one extra click to disappear?

Example: When new row of topics load up and you try to vote-up or vote-down, you have to click it twice the first time for it to register a vote. Like in order for vote system to work one extra click has to be made... Not a big deal, just wondering.

madromas avatar Jun 20 '24 12:06 madromas

Maybe remove the function from rating.js that might be causing the problem.

Also one question i saw your esoTalk-v3 there i tried to change the default.master.php file from core/views but the same weren't reflected in the browser

ac-mmi avatar Jun 20 '24 12:06 ac-mmi

Also, on the new posts that loads, the pictures become not clickable anymore.....

esoTalk-v3 there i tried to change the default.master.php file from core/views

Let me take a look, refresh my memory. What are you trying to do there?

madromas avatar Jun 20 '24 12:06 madromas

The only reason why changes will not update in the browser is if you placed a JS code that has errors in it.

madromas avatar Jun 20 '24 12:06 madromas

when loading new images there is this one class .ajax-modal-ready missing that might not opening the modal Cause i tried to add this class in the newly loaded post and it worked Something in the backend you need to correct while rendering

ac-mmi avatar Jun 20 '24 13:06 ac-mmi

That's the thing. Modal loads in the beginning when site loads, Than when new posts load, modal is missing. Gotta include that modal in there somehow. No big deal, I will try to figure it out....

And If I were you, I would not use that EsoTalk. There is an error there, that I cannot figure out, and it will only work on 8.1. I think some tables not installing during installation. Anyway its a headache.

madromas avatar Jun 20 '24 13:06 madromas

I fixed the missing .ajax-modal-ready , they open fine, just not in MODAL window... uuugggghhh

Need to load modal.js upon new post load. But that's not important....

Thank you for your help

madromas avatar Jun 20 '24 13:06 madromas

Could you please close this issue? It would be helpful for me as I am new to this platform.

ac-mmi avatar Jun 20 '24 13:06 ac-mmi

Could you please close this issue? It would be helpful for me as I am new to this platform.

In esoTalk, change this line to FALSE

https://github.com/madromas/esoTalk-v3/commit/39ed584726878ac1641f02a6228bfae1e822f34f

SO it will look like this:

$config["esoTalk.aggregateCSS"] = false; $config["esoTalk.aggregateJS"] = false;

Let me know if it works. I will close this issue...

madromas avatar Jun 20 '24 20:06 madromas

Could you please close this issue? It would be helpful for me as I am new to this platform.

I just checked EsoTalk and everything now working

And to edit default.master. Each Skin has it's own default master here:

addons/skins/Dark/views/default.master.php

If you have any questions, let me know. I'm closing this issue....

madromas avatar Jun 20 '24 21:06 madromas