PageSourceSearch

https://g-force.co.jp/js/rollover.js

js g-force.co.jp collected 2026-10-01 16:26:10 UTC 5,341 bytes, 192 lines download raw bytes

1rollover = new function()
2{
3
4
5    // 初期設定 --> START
6    
7    this.scrollLength   = 10;   // [ number ] スクロールさせる距離の間隔 
8                                // 1〜100 ( 単位 : % ) 推奨値 5〜10
9                                
10    this.scrollSpeed    = 10;   // [ number ] スクロールさせる時間の間隔
11                                // 推奨値 10〜100 ( 単位 : 1000 = 1秒 )
12                                
13    this.clickCheck     = 1;    // [ bool ]
14                                // リンクの監視 ( 1 -> Yes, 0 -> No )
15    
16    var useMoziHiVer    = 1;    // [ bool ]
17                                // 最近の Gecko でも動作させる ( 1 -> Yes, 0 -> No )
18
19    // 初期設定 <-- END
20    
21    
22    
23    
24    
25    var _this           = this;
26    var isIE            = !!(document.all && !window.opera);
27    var isDOM           = !!document.getElementById;
28    var isMHVer         = navigator.product == "Gecko" &&
29                          navigator.productSub > 20040000;
30    var ancz            = new Array();
31    var f_scroll        = "scroller";
32    var initFlag        = false;
33    var ancLen          = 0;
34    var timeId;
35    var winHeight;
36    var docHeight;
37    var pTopPos;
38    var pLeftPos;
39    var tgtTopPos;
40    var upFlag;
41    var isEvent;
42
43    var getAnchorNodes = function()
44    {
45        var ac = document.anchors;
46        if (initFlag || ac.length == ancLen) return;
47
48        for (var i=ancLen; i<ac.length; i++) {
49            if (ac[i].name.length > 1) ancz[ac[i].name] = ac[ancLen = i];
50        }
51    }
52
53    var fPath = function(_p) { return (_p.charAt(0) != "/")? "/"+ _p: _p }
54    
55    var getPosition = function()
56    {
57        if (isIE) { with (document.body)
58        {
59            winHeight   = clientHeight;
60            docHeight   = scrollHeight;
61            pTopPos     = scrollTop;
62            pLeftPos    = scrollLeft;
63        } }
64        else
65        {
66            winHeight   = window.innerHeight;
67            docHeight   = document.height || document.body.scrollHeight;
68            pTopPos     = window.pageYOffset;
69            pLeftPos    = window.pageXOffset;
70        }
71    }
72    
73    this[f_scroll] = function(_node, _e, _hash)
74    {
75        var targetName;
76        var oTarget;
77
78        if (timeId) timeId = clearInterval(timeId);
79        if (_hash) targetName = _hash.charAt(0) == "#"? _hash.substr(1): _hash;
80        else if (_node && _node.hash) targetName = _node.hash.substr(1);
81 
82        if (!targetName) return true;
83
84        getAnchorNodes();
85        getPosition();
86   
87        oTarget = ancz[targetName];  
88        if (!oTarget || !docHeight) return true;
89
90        tgtTopPos   = oTarget.offsetTop;
91        udFlag      = !!(tgtTopPos < _node.offsetTop);
92        timeId      = setInterval( _this.pScrolling, this.scrollSpeed );
93
94        if (_e)
95        {
96            if (isIE) event.cancelBubble = true;
97            else if (_e.stopPropagation) _e.stopPropagation();
98        }
99        return false;
100    }
101
102    if (isIE)
103    var getPageTopOffset = new Function(" return document.body.scrollTop ");
104    else
105    var getPageTopOffset = new Function(" return window.pageYOffset ");
106
107    
108    this.pScrolling = function()
109    {
110        var tempPTop = getPageTopOffset();
111        var endFlag=0;
112       
113        if (!udFlag) {
114            pTopPos += Math.ceil((tgtTopPos- tempPTop) * (_this.scrollLength/100));
115            if (tgtTopPos <= pTopPos) endFlag = 1;
116        }
117        else {
118            pTopPos -= Math.ceil((tempPTop- tgtTopPos)* (_this.scrollLength/100));
119            if (tgtTopPos >= pTopPos) endFlag = 1;
120        }
121        
122        if (endFlag) {
123            pTopPos = tgtTopPos;
124            timeId  = clearInterval(timeId);
125        }
126        scrollTo( pLeftPos, pTopPos );
127    }
128    
129    this.init = function()
130    {
131        if (initFlag) return;
132        
133        getAnchorNodes();
134        initFlag = 1;
135        autoScroll();
136        
137        if (_this.clickCheck) {
138        document.onclick = document.onclick? new checkClick: checkClick;
139        document.onkeyup = document.onkeyup? new checkClick: checkClick;
140        }
141    }
142
143    var autoScroll = function()
144    {
145        var aName = location.hash;
146        if (aName.length > 1)
147        _this[f_scroll]({
148            hash        : aName,
149            offsetTop   : getPageTopOffset()
150            });
151    }
152    
153    var checkClick = function(_e)
154    {
155        
156        if (timeId) timeId = clearInterval(timeId);
157        if (_e) {
158            _e = _e.target;
159            if (_e.nodeType && _e.nodeType != 1) _e = _e.parentNode;
160        }
161        else 
162            _e = event.srcElement;
163
164        
165        if (_e && _e.tagName == "A")
166        {   
167            if (_e.hash.length > 1 && fPath(location.pathname) == fPath(_e.pathname) )
168                return _this[f_scroll](_e);
169            else
170                return true;
171        }
172
173    }
174    
175
176    if ( !(isIE || isDOM) || (!useMoziHiVer && isMHVer) )
177    {
178        this[f_scroll]  = new Function(" return true ");
179        this.init       = new Function("");
180    }
181    
182    if (isIE || isDOM)
183    {
184        if (window.onload) window.onload = new this.init;
185        else window.onload = this.init;
186        
187        if (window.onerror) window.onerror = new this.init;
188        else window.onerror = this.init;
189    }
190}
191
192

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.