1/*--------------------------------------------------------------------------* 2 * 3 * heightLine JavaScript Library beta4 4 * 5 * MIT-style license. 6 * 7 * 2007 Kazuma Nishihata 8 * http://www.webcreativepark.net 9 * 10 *--------------------------------------------------------------------------*/ 11new function(){ 12 13 function heightLine(){ 14 this.className="heightLine"; 15 this.parentClassName="heightLineParent" 16 reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i"); 17 objCN =new Array(); 18 var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all; 19 for(var i = 0; i < objAll.length; i++) { 20 var eltClass = objAll[i].className.split(/\s+/); 21 for(var j = 0; j < eltClass.length; j++) { 22 if(eltClass[j] == this.className) { 23 if(!objCN["main CN"]) objCN["main CN"] = new Array(); 24 objCN["main CN"].push(objAll[i]); 25 break; 26 }else if(eltClass[j] == this.parentClassName){ 27 if(!objCN["parent CN"]) objCN["parent CN"] = new Array(); 28 objCN["parent CN"].push(objAll[i]); 29 break; 30 }else if(eltClass[j].match(reg)){ 31 var OCN = eltClass[j].match(reg) 32 if(!objCN[OCN]) objCN[OCN]=new Array(); 33 objCN[OCN].push(objAll[i]); 34 break; 35 } 36 } 37 } 38 39 //check font size 40 var e = document.createElement("div"); 41 var s = document.createTextNode("S"); 42 e.appendChild(s); 43 e.style.visibility="hidden" 44 e.style.position="absolute" 45 e.style.top="0" 46 document.body.appendChild(e); 47 var defHeight = e.offsetHeight; 48 49 changeBoxSize = function(){ 50 for(var key in objCN){ 51 if (objCN.hasOwnProperty(key)) { 52 //parent type 53 if(key == "parent CN"){ 54 for(var i=0 ; i<objCN[key].length ; i++){ 55 var max_height=0; 56 var CCN = objCN[key][i].childNodes; 57 for(var j=0 ; j<CCN.length ; j++){ 58 if(CCN[j] && CCN[j].nodeType == 1){ 59 CCN[j].style.height="auto"; 60 max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight; 61 } 62 } 63 for(var j=0 ; j<CCN.length ; j++){ 64 if(CCN[j].style){ 65 var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], ''); 66 var newheight = max_height; 67 if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px",""); 68 if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px",""); 69 if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px",""); 70 if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); 71 CCN[j].style.height =newheight+"px"; 72 } 73 } 74 } 75 }else{ 76 var max_height=0; 77 for(var i=0 ; i<objCN[key].length ; i++){ 78 objCN[key][i].style.height="auto"; 79 max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight; 80 } 81 for(var i=0 ; i<objCN[key].length ; i++){ 82 if(objCN[key][i].style){ 83 var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], ''); 84 var newheight = max_height; 85 if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px",""); 86 if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px",""); 87 if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","") 88 if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px",""); 89 objCN[key][i].style.height =newheight+"px"; 90 } 91 } 92 } 93 } 94 } 95 } 96 97 checkBoxSize = function(){ 98 if(defHeight != e.offsetHeight){ 99 changeBoxSize(); 100 defHeight= e.offsetHeight; 101 } 102 } 103 changeBoxSize(); 104 setInterval(checkBoxSize,1000) 105 window.onresize=changeBoxSize; 106 } 107 108 function addEvent(elm,listener,fn){ 109 try{ 110 elm.addEventListener(listener,fn,false); 111 }catch(e){ 112 elm.attachEvent("on"+listener,fn); 113 } 114 } 115 addEvent(window,"load",heightLine); 116 addEvent(window,"DOMContentLoaded",heightLine); 117 addEvent(window,"resize",heightLine); 118}
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.