PDA

View Full Version : Block comment system


grimboy
11-08-2006, 05:35 PM
Hey I'm not a user of this, just a busybody whose seen it implemented on djangobook.com. Your block commenting system is pretty awesome. However it loads too slowly on http://www.djangobook.com/en/beta/chapter04/, this is unfortunate as I believe that this is a system that works best when used on long texts. I'm sure you already have an idea of how to fix it but I'm going to put forward my ridiculous suggestion anyway.

Have a function on a timer that sets a global named stop. Then, have the loop doing the bulk of the initialisation check said stop variable once every loop. Then, if it's true, it should save information about the current status to a global* and start another timer to recall the initialisation function which should start by checking if it has run before. If it has run before then it should resume from the point stated by the global. Then at the end of the initialisation clear all of the timer events and globals. There's probably a better way (and you being the expert in js probably know it) but those are my immediate thoughts on it. This is easier said than done obviously (especially in a language like javascript).

Anyway, just an idea for if you have time/care.

*I think it might be possible to get the timer that calls the initialisation function for the second time to pass the state of initialisation in. So that would be a cleaner alternative.

EDIT: I just read this through and it seems pretty stupid looking back but hey.

jack.slocum
11-08-2006, 08:12 PM
What takes too long? For me it loads about instantly even with 500+ comments. Even still, it doesn't stop the page from being usable, it loads in the background.

grimboy
11-09-2006, 06:15 PM
http://www.djangobook.com/en/beta/chapter04/ takes so long that on slower (1GHZ, 512MB) computers under firefox you get an unresponsive script error asking if you want the script to be terminated or continue onwards.

jack.slocum
11-09-2006, 07:24 PM
Not for me, it loads instantly - no delay at all actually.