PageSourceSearch

https://search.npb.go.jp/js/heightLine.js?ver=1.0.0

js npb.go.jp collected 2026-10-02 04:10:14 UTC 4,072 bytes, 118 lines download raw bytes

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