PageSourceSearch

http://www.kingsland.ru/manager/templates/kingsland/js/Anchor.js

js kingsland.ru collected 2026-10-08 20:34:33 UTC 1,679 bytes, 70 lines download raw bytes

1function anchorScroller(el, duration) {
2if (this.criticalSection) {
3return false;
4}
5  
6if ((typeof el != 'object') || (typeof el.href != 'string'))
7return true;
8  
9var address = el.href.split('#');
10if (address.length < 2)
11return true;
12  
13address = address[address.length-1];
14el = 0;
15  
16for (var i=0; i<document.anchors.length; i++) {
17if (document.anchors[i].name == address) {
18el = document.anchors[i];
19break;
20}
21}
22if (el === 0)
23return true;
24  
25this.stopX = 0;
26this.stopY = 0;
27do {
28this.stopX += el.offsetLeft;
29this.stopY += el.offsetTop;
30} while (el = el.offsetParent);
31  
32this.startX = document.documentElement.scrollLeft || window.pageXOffset || document.body.scrollLeft;
33this.startY = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
34  
35this. stopX = this.stopX - this.startX;
36this.stopY = this.stopY - this.startY;
37  
38if ( (this.stopX == 0) && (this.stopY == 0) )
39return false;
40  
41this.criticalSection = true;
42if (typeof duration == 'undefined')
43this.duration = 500;
44else
45this.duration = duration;
46  
47var date = new Date();
48this.start = date.getTime();
49this.timer = setInterval(function () {
50var date = new Date();
51var X = (date.getTime() - this.start) / this.duration;
52if (X > 1)
53X = 1;
54var Y = ((-Math.cos(X*Math.PI)/2) + 0.5);
55  
56cX = Math.round(this.startX + this.stopX*Y);
57cY = Math.round(this.startY + this.stopY*Y);
58  
59document.documentElement.scrollLeft = cX;
60document.documentElement.scrollTop = cY;
61document.body.scrollLeft = cX;
62document.body.scrollTop = cY;
63  
64if (X == 1) {
65clearInterval( this.timer);
66this.criticalSection = false;
67}
68}, 10);
69return false;
70}

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.