PageSourceSearch

http://www.rntk-imperia.ru/templates/tz_jollyany_joomla/js/nav.js

js rntk-imperia.ru collected 2026-10-06 06:14:53 UTC 4,131 bytes, 117 lines download raw bytes

1(function (d, c, a, e) {
2    var b = function (g, f) {
3        this.elem = g;
4        this.$elem = d(g);
5        this.options = f;
6        this.metadata = this.$elem.data("plugin-options");
7        this.$win = d(c);
8        this.sections = {};
9        this.didScroll = false;
10        this.$doc = d(a);
11        this.docHeight = this.$doc.height()
12    };
13    b.prototype = {defaults: {navItems: "a", currentClass: "current", changeHash: false, easing: "swing", filter: "", scrollSpeed: 750, scrollThreshold: 0.5, begin: false, end: false, scrollChange: false}, init: function () {
14        this.config = d.extend({}, this.defaults, this.options, this.metadata);
15        this.$nav = this.$elem.find(this.config.navItems);
16        if (this.config.filter !== "") {
17            this.$nav = this.$nav.filter(this.config.filter)
18        }
19        this.$nav.on("click.onePageNav", d.proxy(this.handleClick, this));
20        this.getPositions();
21        this.bindInterval();
22        this.$win.on("resize.onePageNav", d.proxy(this.getPositions, this));
23        return this
24    }, adjustNav: function (f, g) {
25        f.$elem.find("." + f.config.currentClass).removeClass(f.config.currentClass);
26        g.addClass(f.config.currentClass)
27    }, bindInterval: function () {
28        var g = this;
29        var f;
30        g.$win.on("scroll.onePageNav", function () {
31            g.didScroll = true
32        });
33        g.t = setInterval(function () {
34            f = g.$doc.height();
35            if (g.didScroll) {
36                g.didScroll = false;
37                g.scrollChange()
38            }
39            if (f !== g.docHeight) {
40                g.docHeight = f;
41                g.getPositions()
42            }
43        }, 250)
44    }, getHash: function (f) {
45        return f.attr("href").split("#")[1];
46
47    }, getPositions: function () {
48        var h = this;
49        var i;
50        var g;
51        var f;
52        h.$nav.each(function () {
53            i = h.getHash(d(this));
54            f = d("#" + i);
55            if (f.length) {
56                g = f.offset().top;
57                h.sections[i] = Math.round(g)
58            }
59        })
60    }, getSection: function (i) {
61        var f = null;
62        var h = Math.round(this.$win.height() * this.config.scrollThreshold);
63        for (var g in this.sections) {
64            if ((this.sections[g] - h) < i) {
65                f = g
66            }
67        }
68        return f
69    }, handleClick: function (j) {
70        var g = this;
71        var f = d(j.currentTarget);
72        var i = f.parent();
73        var h = "#" + g.getHash(f);
74        if (!i.hasClass(g.config.currentClass)) {
75            if (g.config.begin) {
76                g.config.begin()
77            }
78            g.adjustNav(g, i);
79            g.unbindInterval();
80            g.scrollTo(h, function () {
81                if (g.config.changeHash) {
82                    c.location.hash = h
83                }
84                g.bindInterval();
85                if (g.config.end) {
86                    g.config.end()
87                }
88            })
89        }
90        j.preventDefault()
91    }, scrollChange: function () {
92        var h = this.$win.scrollTop();
93        var f = this.getSection(h);
94        var g;
95        if (f !== null) {
96            g = this.$elem.find('a[href$="#' + f + '"]').parent();
97            if (!g.hasClass(this.config.currentClass)) {
98                this.adjustNav(this, g);
99                if (this.config.scrollChange) {
100                    this.config.scrollChange(g)
101                }
102            }
103        }
104    }, scrollTo: function (f, h) {
105        var g = d(f).offset().top;
106        d("html, body").animate({scrollTop: g-100}, this.config.scrollSpeed, this.config.easing, h)
107    }, unbindInterval: function () {
108        clearInterval(this.t);
109        this.$win.unbind("scroll.onePageNav")
110    }};
111    b.defaults = b.prototype.defaults;
112    d.fn.onePageNav = function (f) {
113        return this.each(function () {
114            new b(this, f).init()
115        })
116    }
117})(jQuery, window, document);

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.