1/*********************************************** 2* Random Order Content (from DIVs) script- by JavaScript Kit (www.javascriptkit.com) 3* This notice must stay intact for usage 4* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and 100s more 5***********************************************/ 6 7 8 9if (document.getElementById) 10document.documentElement.className = 'jsclass'; //hide content for DOM capable browsers 11 12 13var randomordercontentdisplay={ 14 divholders:new Object(), 15 masterclass: "randomordercontent", 16 17 init:function(){ 18 if (!document.getElementById) 19 return 20 var alldivs=document.getElementsByTagName("div") 21 var randomcontentsearch=new RegExp(this.masterclass+"\\s+(group\\d+)", "i") //check for CSS class="randomordercontent groupX" (x=integer) 22 for (var i=0; i<alldivs.length; i++){ 23 if (randomcontentsearch.test(alldivs[i].className)){ 24 if (typeof this.divholders[RegExp.$1]=="undefined"){ //if object to hold this group of divs doesn't exist yet 25 this.divholders[RegExp.$1]=new Object() //create object 26 this.divholders[RegExp.$1].ref=[] //create array to hold each div within group 27 this.divholders[RegExp.$1].contents=[] //create array to hold each div's content within group 28 } 29 this.divholders[RegExp.$1].ref.push(alldivs[i]) //add this div to the array 30 this.divholders[RegExp.$1].contents.push(alldivs[i].innerHTML) //add this div's content to the array 31 } 32 } 33 this.scrambleorder() 34 }, 35 36 scrambleorder:function(){ 37 for (group in this.divholders){ //loop thru each array within object 38 this.divholders[group].contents.sort(function() {return 0.5 - Math.random()}) //scramble contents array 39 for (var i=0; i<this.divholders[group].ref.length; i++){ 40 this.divholders[group].ref[i].innerHTML=this.divholders[group].contents[i] 41 this.divholders[group].ref[i].style.display="block" 42 } 43 } 44 } 45} 46 47
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.