PageSourceSearch

https://www.townkamiita.jp/_themes/joruri/kamiita/js/heightLine.js

js townkamiita.jp collected 2026-10-02 17:32:16 UTC 4,719 bytes, 121 lines download raw bytes

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
15    this.className="heightLine";
16    this.parentClassName="heightLineParent"
17    reg = new RegExp(this.className+"-([a-zA-Z0-9-_]+)", "i");
18    objCN =new Array();
19    var objAll = document.getElementsByTagName ? document.getElementsByTagName("*") : document.all;
20    for(var i = 0; i < objAll.length; i++) {
21      try{
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        }catch( e ){
40          //
41        }
42    }
43
44    //check font size
45    var e = document.createElement("div");
46    var s = document.createTextNode("S");
47    e.appendChild(s);
48    e.style.visibility="hidden"
49    e.style.position="absolute"
50    e.style.top="0"
51    document.body.appendChild(e);
52    var defHeight = e.offsetHeight;
53
54    changeBoxSize = function(){
55      for(var key in objCN){
56        if (objCN.hasOwnProperty(key)) {
57          //parent type
58          if(key == "parent CN"){
59            for(var i=0 ; i<objCN[key].length ; i++){
60              var max_height=0;
61              var CCN = objCN[key][i].childNodes;
62              for(var j=0 ; j<CCN.length ; j++){
63                if(CCN[j] && CCN[j].nodeType == 1){
64                  CCN[j].style.height="auto";
65                  max_height = max_height>CCN[j].offsetHeight?max_height:CCN[j].offsetHeight;
66                }
67              }
68              for(var j=0 ; j<CCN.length ; j++){
69                if(CCN[j].style){
70                  var stylea = CCN[j].currentStyle || document.defaultView.getComputedStyle(CCN[j], '');
71                  var newheight = max_height;
72                  if(stylea.paddingTop)newheight -= stylea.paddingTop.replace("px","");
73                  if(stylea.paddingBottom)newheight -= stylea.paddingBottom.replace("px","");
74                  if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","");
75                  if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
76                  CCN[j].style.height =newheight+"px";
77                }
78              }
79            }
80          }else{
81            var max_height=0;
82            for(var i=0 ; i<objCN[key].length ; i++){
83              objCN[key][i].style.height="auto";
84              max_height = max_height>objCN[key][i].offsetHeight?max_height:objCN[key][i].offsetHeight;
85            }
86            for(var i=0 ; i<objCN[key].length ; i++){
87              if(objCN[key][i].style){
88                var stylea = objCN[key][i].currentStyle || document.defaultView.getComputedStyle(objCN[key][i], '');
89                  var newheight = max_height;
90                  if(stylea.paddingTop)newheight-= stylea.paddingTop.replace("px","");
91                  if(stylea.paddingBottom)newheight-= stylea.paddingBottom.replace("px","");
92                  if(stylea.borderTopWidth && stylea.borderTopWidth != "medium")newheight-= stylea.borderTopWidth.replace("px","")
93                  if(stylea.borderBottomWidth && stylea.borderBottomWidth != "medium")newheight-= stylea.borderBottomWidth.replace("px","");
94                  objCN[key][i].style.height =newheight+"px";
95              }
96            }
97          }
98        }
99      }
100    }
101
102    checkBoxSize = function(){
103      if(defHeight != e.offsetHeight){
104        changeBoxSize();
105        defHeight= e.offsetHeight;
106      }
107    }
108    changeBoxSize();
109    setInterval(checkBoxSize,1000)
110    window.onresize=changeBoxSize;
111  }
112
113  function addEvent(elm,listener,fn){
114    try{
115      elm.addEventListener(listener,fn,false);
116    }catch(e){
117      elm.attachEvent("on"+listener,fn);
118    }
119  }
120  addEvent(window,"load",heightLine);
121}

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.