1/* 2DezinerFolio.com Simple Accordians. 3 4Author : G.S.Navin Raj Kumar 5Website : http://dezinerfolio.com 6 7*/ 8 9/* 10* The Variable names have been compressed to achive a higher level of compression. 11*/ 12 13// Prototype Method to get the element based on ID 14function getElementId(d){ 15 return document.getElementById(d); 16} 17 18// set or get the current display style of the div 19function dsp(d,v){ 20 if(v==undefined){ 21 return d.style.display; 22 }else{ 23 d.style.display=v; 24 } 25} 26 27// set or get the height of a div. 28function sh(d,v){ 29 // if you are getting the height then display must be block to return the absolute height 30 if(v==undefined){ 31 if(dsp(d)!='none'&& dsp(d)!=''){ 32 return d.offsetHeight; 33 } 34 viz = d.style.visibility; 35 d.style.visibility = 'hidden'; 36 o = dsp(d); 37 dsp(d,'block'); 38 r = parseInt(d.offsetHeight); 39 dsp(d,o); 40 d.style.visibility = viz; 41 return r; 42 }else{ 43 d.style.height=v; 44 } 45} 46/* 47* Variable 'S' defines the speed of the accordian 48* Variable 'T' defines the refresh rate of the accordian 49*/ 50s=7; 51t=10; 52 53//Collapse Timer is triggered as a setInterval to reduce the height of the div exponentially. 54function ct(d){ 55 d = getElementId(d); 56 if(sh(d)>0){ 57 v = Math.round(sh(d)/d.s); 58 v = (v<1) ? 1 :v ; 59 v = (sh(d)-v); 60 sh(d,v+'px'); 61 d.style.opacity = (v/d.maxh); 62 d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');'; 63 }else{ 64 sh(d,0); 65 dsp(d,'none'); 66 clearInterval(d.t); 67 } 68} 69 70//Expand Timer is triggered as a setInterval to increase the height of the div exponentially. 71function et(d){ 72 d = getElementId(d); 73 if(sh(d)<d.maxh){ 74 v = Math.round((d.maxh-sh(d))/d.s); 75 v = (v<1) ? 1 :v ; 76 v = (sh(d)+v); 77 sh(d,v+'px'); 78 d.style.opacity = (v/d.maxh); 79 d.style.filter= 'alpha(opacity='+(v*100/d.maxh)+');'; 80 }else{ 81 sh(d,d.maxh); 82 clearInterval(d.t); 83 } 84} 85 86// Collapse Initializer 87function cl(d){ 88 if(dsp(d)=='block'){ 89 clearInterval(d.t); 90 d.t=setInterval('ct("'+d.id+'")',t); 91 } 92} 93 94//Expand Initializer 95function ex(d){ 96 if(dsp(d)=='none'){ 97 dsp(d,'block'); 98 d.style.height='0px'; 99 clearInterval(d.t); 100 d.t=setInterval('et("'+d.id+'")',t); 101 } 102} 103 104// Removes Classname from the given div. 105function cc(n,v){ 106 s=n.className.split(/\s+/); 107 for(p=0;p<s.length;p++){ 108 if(s[p]==v+n.tc){ 109 s.splice(p,1); 110 n.className=s.join(' '); 111 break; 112 } 113 } 114} 115//Accordian Initializer 116function Accordian(d,s,tc){ 117 // get all the elements that have id as content 118 l=getElementId(d).getElementsByTagName('div'); 119 c=[]; 120 for(i=0;i<l.length;i++){ 121 h=l[i].id; 122 if(h.substr(h.indexOf('-')+1,h.length)=='content'){c.push(h);} 123 } 124 sel=null; 125 //then search through headers 126 for(i=0;i<l.length;i++){ 127 h=l[i].id; 128 if(h.substr(h.indexOf('-')+1,h.length)=='header'){ 129 d=getElementId(h.substr(0,h.indexOf('-'))+'-content'); 130 d.style.display='none'; 131 d.style.overflow='hidden'; 132 d.maxh =sh(d); 133 d.s=(s==undefined)? 7 : s; 134 h=getElementId(h); 135 h.tc=tc; 136 h.c=c; 137 // set the onclick function for each header. 138 h.onclick = function(){ 139 for(i=0;i<this.c.length;i++){ 140 cn=this.c[i]; 141 n=cn.substr(0,cn.indexOf('-')); 142 if((n+'-header')==this.id){ 143 ex(getElementId(n+'-content')); 144 n=getElementId(n+'-header'); 145 cc(n,'__'); 146 n.className=n.className+' '+n.tc; 147 }else{ 148 cl(getElementId(n+'-content')); 149 cc(getElementId(n+'-header'),''); 150 } 151 } 152 } 153 154 if(h.className.match(/selected+/)!=undefined){ sel=h;} 155 } 156 } 157 if(sel!=undefined){sel.onclick();} 158}
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.