nikrou / eventHandler

a dotclear plugin to manage events in your blog.
Other
2 stars 5 forks source link

Calendar Widget navigation #40

Closed onurb-taktile closed 5 years ago

onurb-taktile commented 5 years ago

Hello, I'm using eventhandler 2018.01.25 on dotclear 2.14.3 When I use the prev or next link, the first time, it switches to the according month, and loads the calendar through ajax request. The link's URL is ignored. The second time, it goes to the link's URL. I've investigated, and it looks like the $(target).replaceWith call in event-public-calc.js in eventHandlerQuery function erases all data and events. The weird thing is that just after that, the eventHandlerCalendar() function is called again, which should reset the click event handlers (lol) on the newly created links. But it has no effect. I haven't found any solution yet, but it is like if the target element is changed by the replaceWith and then target doesn't exist any more. Any clue? Thanks for your help Nurbo

onurb-taktile commented 5 years ago

I eventually found a way : The problem came from the replacement of the whole div, $(target) was not the same object anymore after the replaceWith(). My hack is a bit dirty, but works : In event-public-cal.js, I change line 51 by :

$html=$(data).find('calendar').text().replace(/<div[^>]*>/i," ").replace("/<\/div>/i"," ");
$(target).find("table").replaceWith($html);

It changes only the content of the div, not the div itself, and target remains the same. It was the only way I found to avoid modifying the server side function which generates the calendar. Hope it will help. Nurbo.

nikrou commented 5 years ago

I confirm the problem. Your solution works perfectly but I found another solution by removing the div around the table when content is returnent by the webservice.

Many thanks for reporting and suggesting a solution.

nikrou commented 5 years ago

Release 2019-02-22 will be available soon.