PageSourceSearch

https://ototoy.jp/common/js/footerFixed.js

js ototoy.jp collected 2026-10-02 02:43:10 UTC 2,791 bytes, 77 lines download raw bytes

1/*--------------------------------------------------------------------------*
2 *
3 *  footerFixed.js
4 *
5 *  MIT-style license.
6 *
7 *  2007 Kazuma Nishihata [to-R]
8 *  http://blog.webcreativepark.net
9 *
10 *--------------------------------------------------------------------------*/
11
12 var fixFooter = new function() {
13    var footerId = "footer";
14    var contentId = "content";
15    /* メイン */
16    this.run = function() {
17        /* ドキュメントの高さ */
18        var dh = document.getElementsByTagName("body")[0].clientHeight;
19        /* フッターのtopからの位置 */
20        document.getElementById(footerId).style.top = "0px";
21        document.getElementById(contentId).style.top = "0px";
22        document.getElementById(contentId).style.minHeight = "0px";
23        /* フッターの高さ */
24        var ft = document.getElementById(footerId).offsetTop;
25        var mt = document.getElementById(contentId).offsetTop;
26        var fh = document.getElementById(footerId).offsetHeight;
27        /* ウィンドウの高さ */
28        if (window.innerHeight) {
29            var wh = window.innerHeight;
30        } else if (document.documentElement && document.documentElement.clientHeight != 0) {
31            var wh = document.documentElement.clientHeight;
32        }
33        if (ft+fh<wh) {
34            document.getElementById(contentId).style.minHeight = (wh-mt-fh)+"px";
35        }
36        ft = document.getElementById(footerId).offsetTop;
37        if (ft+fh<wh) {
38            document.getElementById(footerId).style.position = "relative";
39            document.getElementById(footerId).style.top = (wh-fh-ft-1)+"px";
40        }
41    };
42
43    /* 文字サイズ */
44    this.checkFontSize = function(func){
45        /* 判定要素の追加	 */
46        var e = document.createElement("div");
47        var s = document.createTextNode("S");
48        e.appendChild(s);
49        e.style.visibility="hidden"
50        e.style.position="absolute"
51        e.style.top="0"
52        document.body.appendChild(e);
53        var defHeight = e.offsetHeight;
54        /* 判定関数 */
55        function checkBoxSize(){
56            if(defHeight != e.offsetHeight){
57                func();
58                defHeight= e.offsetHeight;
59            }
60        }
61        setInterval(this.checkBoxSize,1000)
62    }
63
64    /* イベントリスナー */
65    this.addEvent = function(elm,listener,fn){
66        try{
67            elm.addEventListener(listener,fn,false);
68        } catch (e) {
69            elm.attachEvent("on"+listener,fn);
70        }
71    }
72    this.addEvent(window, "load", this.run);
73    this.addEvent(window, "load", function(){
74        fixFooter.checkFontSize(this.run);
75    });
76    this.addEvent(window,"resize", this.run);
77}

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.