I set up a script (based on 
http://www.consideropen.com/blog/2008/07/toggle-o-matic-for-mootools-12/),
to individually slide excerpts of multiple dynamically generated rss
feeds using SimplePie with the "newsblocks 2.0 demo" (http://
simplepie.org/wiki/tutorial/how_to_replicate_popurls).

Everything works great, but my excerpt slide script significantly
slows page load. The more "newsblocks" on the page, the slower the
loading - to an unacceptable level.

To better understand this problem, please compare this page:
http://clubwager.net/poker_blogs.html to this one:
http://clubwager.net/poker_blogs_noexcerptslide.html

Note that the only difference between these two pages is that the
first page has a "plus" sign after the titles which slides open
excerpts for that "newsblock" while the second page does not.

It appears to me that the slowness is caused by the script getting
each unique class and applying a unique slide to it. If I add more
feeds so that there are more than 50 or so items to slide, it slows
down to the point of causing a slow script warning in ie7.

Here is the slide excerpts script I am using:


window.addEvent('domready', function(){
var storeT = [];
var toggleAll = $('oContainer').getElements('[class^=n_]');
        toggleAll.each(function(item){
                item.set('html', '&nbsp;<img src="http://images.clubwager.net/
switch_plus.gif" width="11" height="11" alt="" />');
                var toggleAllClass = item.getProperty('class');
                toggleAllClass = toggleAllClass.replace("n_", "");
                var slideAllClass = "r_" + toggleAllClass;
                var abc = $('oContainer').getElements('.' + slideAllClass);
                storeT[abc] = abc.slide('hide');
                        $(item).addEvent('click', function(){
                        abc.slide();
                        item.toggleClass('shex');
                        if(item.hasClass('shex')) item.set('html', '&nbsp;<img 
src="http://
images.clubwager.net/switch_minus.gif" width="11" height="11" alt="" /
>');
                        else item.set('html', '&nbsp;<img 
src="http://images.clubwager.net/
switch_plus.gif" width="11" height="11" alt="" />');
                        });
        });
});


I was thinking that the new element storage of mootools 1.2 (
http://mootools.net/blog/2008/01/22/whats-new-in-12-element-storage/ )
might be a way to speed it up and perhaps make it work faster on a
large number of items? But, I have not been able to figure out how to
do that. If anyone thinks it would work I would appreciate some
guidance or help to re-write it.

I would appreciate any and all other insights or ideas on how to speed
this all up. I've been struggling with this for months!

Thanks in advance for any replies.

Reply via email to