Hmm I'm not sure how realistic it is to modify the script to write all the DIVs- including all of its settings such as the status icons- dynamically when the page loads, instead of having the script do that dynamically. It's possible I suppose, though quite a lot of changes to the script has to occur here, including integrating with your server side script in the backend.
You can increase the initialization time slightly by replacing the original "collectElementbyClass()" function inside switchcontent.js with the below version instead:
Code:
switchcontent.prototype.collectElementbyClass=function(classname){ //Returns an array containing DIVs with specified classname
var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i") //regular expression to screen for classname within element
this.headers=[], this.innercontents=[]
if (document.querySelectorAll)
var targetelements=document.querySelectorAll(this.filter_content_tag+'.'+classname)
else if (this.filter_content_tag!="") //If user defined limit type of element to scan for to a certain element (ie: "div" only)
var allelements=document.getElementsByTagName(this.filter_content_tag)
else //else, scan all elements on the page!
var allelements=document.all? document.all : document.getElementsByTagName("*")
var contentlength=targetelements? targetelements.length : allelements.length
for (var i=0; i<contentlength; i++){
if (targetelements || (typeof allelements[i].className=="string" && allelements[i].className.search(classnameRE)!=-1)){
var targetelement=targetelements? targetelements[i] : allelements[i]
if (document.getElementById(targetelement.id+"-title")!=null){ //if header exists for this inner content
this.headers[this.headers.length]=document.getElementById(targetelement.id+"-title") //store reference to header intended for this inner content
this.innercontents[this.innercontents.length]=targetelement //store reference to this inner content
}
}
}
}
Bookmarks