PageSourceSearch

https://stroy-mat54.ru/njs/glide.js

js stroy-mat54.ru collected 2026-10-04 00:12:34 UTC 9,418 bytes, 279 lines download raw bytes

1(function(e, t, n, r) {
2    function o(r, i) {
3        var o = this;
4        o.options = e.extend({}, s, i);
5        o.parent = r;
6        o.wrapper = o.parent.children();
7        o.slides = o.wrapper.children();
8        o.currentSlide = 0;
9        o.CSS3support = true;
10        o.options.beforeInit.call(o);
11        o.init();
12        o.build();
13        o.play();
14        if (o.options.touchDistance) {
15            o.swipe()
16        }
17        if (o.options.keyboard) {
18            e(n).on("keyup", function(e) {
19                if (e.keyCode === 39) o.slide(1);
20                if (e.keyCode === 37) o.slide(-1)
21            })
22        }
23        if (o.options.hoverpause) {
24            o.parent.add(o.arrows).add(o.nav).on("mouseover mouseout", function(e) {
25                o.pause();
26                if (e.type === "mouseout") o.play()
27            })
28        }
29        e(t).on("resize", function() {
30            o.init();
31            o.slide(0)
32        });
33        o.options.afterInit.call(o);
34        return {
35            current: function() {
36                return -o.currentSlide + 1
37            },
38            play: function() {
39                o.play()
40            },
41            pause: function() {
42                o.pause()
43            },
44            next: function(e) {
45                o.slide(1, false, e)
46            },
47            prev: function(e) {
48                o.slide(-1, false, e)
49            },
50            jump: function(e, t) {
51                o.slide(e - 1, true, t)
52            },
53            nav: function(e) {
54                if (o.navWrapper) {
55                    o.navWrapper.remove()
56                }
57                o.options.nav = e ? e : o.options.nav;
58                o.navigation()
59            },
60            arrows: function(e) {
61                if (o.arrowsWrapper) {
62                    o.arrowsWrapper.remove()
63                }
64                o.options.arrows = e ? e : o.options.arrows;
65                o.arrows()
66            }
67        }
68    }
69
70    function u(e) {
71        var i = false,
72            s = "Khtml ms O Moz Webkit".split(" "),
73            o = n.createElement("div"),
74            u = null;
75        e = e.toLowerCase();
76        if (o.style[e] !== r) i = true;
77        if (i === false) {
78            u = e.charAt(0).toUpperCase() + e.substr(1);
79            for (var a = 0; a < s.length; a++) {
80                if (o.style[s[a] + u] !== r) {
81                    i = true;
82                    break
83                }
84            }
85        }
86        if (t.opera) {
87            if (t.opera.version() < 13) i = false
88        }
89        return i
90    }
91    var i = "glide",
92        s = {
93            autoplay: 4e3,
94            hoverpause: true,
95            animationTime: 500,
96            arrows: true,
97            arrowsWrapperClass: "slider-arrows",
98            arrowMainClass: "slider-arrow",
99            arrowRightClass: "slider-arrow--right",
100            arrowRightText: "next",
101            arrowLeftClass: "slider-arrow--left",
102            arrowLeftText: "prev",
103            nav: true,
104            navCenter: true,
105            navClass: "slider-nav",
106            navItemClass: "slider-nav__item",
107            navCurrentItemClass: "slider-nav__item--current",
108            keyboard: true,
109            touchDistance: 60,
110            beforeInit: function() {},
111            afterInit: function() {},
112            beforeTransition: function() {},
113            afterTransition: function() {}
114        };
115    o.prototype.build = function() {
116        var e = this;
117        if (e.options.arrows) e.arrows();
118        if (e.options.nav) e.navigation()
119    };
120    o.prototype.navigation = function() {
121        var t = this;
122		console.log('length='+t.slides.length);
123        if (t.slides.length > 1) {
124            var n = t.options,
125                r = t.options.nav === true ? t.parent : t.options.nav;
126            t.navWrapper = e("<div />", {
127                "class": n.navClass
128            }).appendTo(r);
129            var i = t.navWrapper,
130                s;
131            for (var o = 0; o < t.slides.length; o++) {
132                s = e("<a />", {
133                    href: "#",
134                    "class": n.navItemClass,
135                    "data-distance": o
136                }).appendTo(i);
137                i[o + 1] = s
138            }
139            var u = i.children();
140            u.eq(0).addClass(n.navCurrentItemClass);
141            if (n.navCenter) {
142                i.css({
143                    left: "50%",
144                    width: u.outerWidth(true) * u.length,
145                    "margin-left": -i.outerWidth(true) / 2
146                })
147            }
148            u.on("click touchstart", function(n) {
149                n.preventDefault();
150                t.slide(e(this).data("distance"), true)
151            })
152        }
153    };
154    o.prototype.arrows = function() {
155        var t = this;
156        if (t.slides.length > 1) {
157            var n = t.options,
158                r = t.options.arrows === true ? t.parent : t.options.arrows;
159            t.arrowsWrapper = e("<div />", {
160                "class": n.arrowsWrapperClass
161            }).appendTo(r);
162            var i = t.arrowsWrapper;
163            i.right = e("<a />", {
164                href: "#",
165                "class": n.arrowMainClass + " " + n.arrowRightClass,
166                "data-distance": "1",
167                html: n.arrowRightText
168            }).appendTo(i);
169            i.left = e("<a />", {
170                href: "#",
171                "class": n.arrowMainClass + " " + n.arrowLeftClass,
172                "data-distance": "-1",
173                html: n.arrowLeftText
174            }).appendTo(i);
175            i.children().on("click touchstart", function(n) {
176                n.preventDefault();
177                t.slide(e(this).data("distance"), false)
178            })
179        }
180    };
181    o.prototype.slide = function(e, t, n) {
182        var r = this;
183        r.pause();
184        r.options.beforeTransition.call(r);
185        var i = t ? 0 : r.currentSlide,
186            s = -(r.slides.length - 1),
187            o = r.options.navCurrentItemClass,
188            u = r.slides.spread;
189        if (i === 0 && e === -1) {
190            i = s
191        } else if (i === s && e === 1) {
192            i = 0
193        } else {
194            i = i + -e
195        }
196        var a = u * i + "px";
197        if (r.CSS3support) {
198            r.wrapper.css({
199                "-webkit-transform": "translate3d(" + a + ", 0px, 0px)",
200                "-moz-transform": "translate3d(" + a + ", 0px, 0px)",
201                "-ms-transform": "translate3d(" + a + ", 0px, 0px)",
202                "-o-transform": "translate3d(" + a + ", 0px, 0px)",
203                transform: "translate3d(" + a + ", 0px, 0px)"
204            })
205        } else {
206            r.wrapper.stop().animate({
207                "margin-left": a
208            }, r.options.animationTime)
209        }
210        if (r.options.nav && r.navWrapper) {
211            r.navWrapper.children().eq(-i).addClass(o).siblings().removeClass(o)
212        }
213        r.currentSlide = i;
214        r.options.afterTransition.call(r);
215        if (n !== "undefined" && typeof n === "function") n();
216        r.play()
217    };
218    o.prototype.play = function() {
219        var e = this;
220        if (e.options.autoplay) {
221            e.auto = setInterval(function() {
222                e.slide(1, false)
223            }, e.options.autoplay)
224        }
225    };
226    o.prototype.pause = function() {
227        var e = this;
228        if (e.options.autoplay) {
229            e.auto = clearInterval(e.auto)
230        }
231    };
232    o.prototype.swipe = function() {
233        var e = this,
234            t, n, r, i, s, o, u, a, f, l = 180 / Math.PI,
235            c, h, p, d;
236        e.parent.on("touchstart", function(e) {
237            t = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
238            r = t.pageX;
239            i = t.pageY
240        });
241        e.parent.on("touchmove", function(e) {
242            t = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
243            s = t.pageX;
244            o = t.pageY;
245            c = s - r;
246            h = o - i;
247            p = Math.abs(c << 2);
248            d = Math.abs(h << 2);
249            u = Math.sqrt(p + d);
250            a = Math.sqrt(d);
251            f = Math.asin(a / u);
252            if (f * l < 32) e.preventDefault()
253        });
254        e.parent.on("touchend", function(i) {
255            t = i.originalEvent.touches[0] || i.originalEvent.changedTouches[0];
256            n = t.pageX - r;
257            if (n > e.options.touchDistance) {
258                e.slide(-1)
259            } else if (n < -e.options.touchDistance) {
260                e.slide(1)
261            }
262        })
263    };
264    o.prototype.init = function() {
265        var e = this,
266            t = e.parent.width();
267        e.slides.spread = t;
268        e.wrapper.width(t * e.slides.length);
269        e.slides.width(e.slides.spread);
270        if (!u("transition") || !u("transform")) e.CSS3support = false
271    };
272    e.fn[i] = function(t) {
273        return this.each(function() {
274            if (!e.data(this, "api_" + i)) {
275                e.data(this, "api_" + i, new o(e(this), t))
276            }
277        })
278    }
279})(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.