PageSourceSearch

https://apograf.ru/wp-content/themes/creativeMag/js/jquery.nivo.slider.pack.js

js apograf.ru collected 2026-10-02 19:34:39 UTC 19,705 bytes, 418 lines download raw bytes

1/*
2 * jQuery Nivo Slider v2.4
3 * http://nivo.dev7studios.com
4 *
5 * Copyright 2011, Gilbert Pellegrom
6 * Free to use and abuse under the MIT license.
7 * http://www.opensource.org/licenses/mit-license.php
8 */
9(function (a) {
10    var A = function (s, v) {
11            var f = a.extend({}, a.fn.nivoSlider.defaults, v),
12                g = {
13                    currentSlide: 0,
14                    currentImage: "",
15                    totalSlides: 0,
16                    randAnim: "",
17                    running: false,
18                    paused: false,
19                    stop: false
20                },
21                e = a(s);
22            e.data("nivo:vars", g);
23            e.css("position", "relative");
24            e.addClass("nivoSlider");
25            var j = e.children();
26            j.each(function () {
27                var b = a(this),
28                    h = "";
29                if (!b.is("img")) {
30                    if (b.is("a")) {
31                        b.addClass("nivo-imageLink");
32                        h = b
33                    }
34                    b = b.find("img:first")
35                }
36                var c = b.width();
37                if (c == 0) c = b.attr("width");
38                var o = b.height();
39                if (o == 0) o = b.attr("height");
40                c > e.width() && e.width(c);
41                o > e.height() && e.height(o);
42                h != "" && h.css("display", "none");
43                b.css("display", "none");
44                g.totalSlides++
45            });
46            if (f.startSlide > 0) {
47                if (f.startSlide >= g.totalSlides) f.startSlide = g.totalSlides - 1;
48                g.currentSlide = f.startSlide
49            }
50            g.currentImage = a(j[g.currentSlide]).is("img") ? a(j[g.currentSlide]) : a(j[g.currentSlide]).find("img:first");
51            a(j[g.currentSlide]).is("a") && a(j[g.currentSlide]).css("display", "block");
52            e.css("background", 'url("' + g.currentImage.attr("src") + '") no-repeat');
53            for (var k = 0; k < f.slices; k++) {
54                var p = Math.round(e.width() / f.slices);
55                k == f.slices - 1 ? e.append(a('<div class="nivo-slice"></div>').css({
56                    left: p * k + "px",
57                    width: e.width() - p * k + "px"
58                })) : e.append(a('<div class="nivo-slice"></div>').css({
59                    left: p * k + "px",
60                    width: p + "px"
61                }))
62            }
63            e.append(a('<div class="nivo-caption"><p></p></div>').css({
64                display: "none",
65                opacity: f.captionOpacity
66            }));
67            if (g.currentImage.attr("title") != "") {
68                k = g.currentImage.attr("title");
69                if (k.substr(0, 1) == "#") k = a(k).html();
70                a(".nivo-caption p", e).html(k);
71                a(".nivo-caption", e).fadeIn(f.animSpeed)
72            }
73            var l = 0;
74            if (!f.manualAdvance && j.length > 1) l = setInterval(function () {
75                r(e, j, f, false)
76            }, f.pauseTime);
77            if (f.directionNav) {
78                e.append('<div class="nivo-directionNav"><a class="nivo-prevNav">Prev</a><a class="nivo-nextNav">Next</a></div>');
79                if (f.directionNavHide) {
80                    a(".nivo-directionNav", e).hide();
81                    e.hover(function () {
82                        a(".nivo-directionNav", e).show()
83                    }, function () {
84                        a(".nivo-directionNav", e).hide()
85                    })
86                }
87                a("a.nivo-prevNav", e).live("click", function () {
88                    if (g.running) return false;
89                    clearInterval(l);
90                    l = "";
91                    g.currentSlide -= 2;
92                    r(e, j, f, "prev")
93                });
94                a("a.nivo-nextNav", e).live("click", function () {
95                    if (g.running) return false;
96                    clearInterval(l);
97                    l = "";
98                    r(e, j, f, "next")
99                })
100            }
101            if (f.controlNav) {
102                p = a('<div class="nivo-controlNav"></div>');
103                e.append(p);
104                for (k = 0; k < j.length; k++) if (f.controlNavThumbs) {
105                    var t = j.eq(k);
106                    t.is("img") || (t = t.find("img:first"));
107                    f.controlNavThumbsFromRel ? p.append('<a class="nivo-control" rel="' + k + '"><img src="' + t.attr("rel") + '" alt="" /></a>') : p.append('<a class="nivo-control" rel="' + k + '"><img src="' + t.attr("src").replace(f.controlNavThumbsSearch, f.controlNavThumbsReplace) + '" alt="" /></a>')
108                } else p.append('<a class="nivo-control" rel="' + k + '">' + (k + 1) + "</a>");
109                a(".nivo-controlNav a:eq(" + g.currentSlide + ")", e).addClass("active");
110                a(".nivo-controlNav a", e).live("click", function () {
111                    if (g.running) return false;
112                    if (a(this).hasClass("active")) return false;
113                    clearInterval(l);
114                    l = "";
115                    e.css("background", 'url("' + g.currentImage.attr("src") + '") no-repeat');
116                    g.currentSlide = a(this).attr("rel") - 1;
117                    r(e, j, f, "control")
118                })
119            }
120            f.keyboardNav && a(window).keypress(function (b) {
121                if (b.keyCode == "37") {
122                    if (g.running) return false;
123                    clearInterval(l);
124                    l = "";
125                    g.currentSlide -= 2;
126                    r(e, j, f, "prev")
127                }
128                if (b.keyCode == "39") {
129                    if (g.running) return false;
130                    clearInterval(l);
131                    l = "";
132                    r(e, j, f, "next")
133                }
134            });
135            f.pauseOnHover && e.hover(function () {
136                g.paused = true;
137                clearInterval(l);
138                l = ""
139            }, function () {
140                g.paused = false;
141                if (l == "" && !f.manualAdvance) l = setInterval(function () {
142                    r(e, j, f, false)
143                }, f.pauseTime)
144            });
145            e.bind("nivo:animFinished", function () {
146                g.running = false;
147                a(j).each(function () {
148                    a(this).is("a") && a(this).css("display", "none")
149                });
150                a(j[g.currentSlide]).is("a") && a(j[g.currentSlide]).css("display", "block");
151                if (l == "" && !g.paused && !f.manualAdvance) l = setInterval(function () {
152                    r(e, j, f, false)
153                }, f.pauseTime);
154                f.afterChange.call(this)
155            });
156            var w = function (b, h) {
157                    var c = 0;
158                    a(".nivo-slice", b).each(function () {
159                        var o = a(this),
160                            d = Math.round(b.width() / h.slices);
161                        c == h.slices - 1 ? o.css("width", b.width() - d * c + "px") : o.css("width", d + "px");
162                        c++
163                    })
164                },
165                r = function (b, h, c, o) {
166                    var d = b.data("nivo:vars");
167                    d && d.currentSlide == d.totalSlides - 1 && c.lastSlide.call(this);
168                    if ((!d || d.stop) && !o) return false;
169                    c.beforeChange.call(this);
170                    if (o) {
171                        o == "prev" && b.css("background", 'url("' + d.currentImage.attr("src") + '") no-repeat');
172                        o == "next" && b.css("background", 'url("' + d.currentImage.attr("src") + '") no-repeat')
173                    } else b.css("background", 'url("' + d.currentImage.attr("src") + '") no-repeat');
174                    d.currentSlide++;
175                    if (d.currentSlide == d.totalSlides) {
176                        d.currentSlide = 0;
177                        c.slideshowEnd.call(this)
178                    }
179                    if (d.currentSlide < 0) d.currentSlide = d.totalSlides - 1;
180                    d.currentImage = a(h[d.currentSlide]).is("img") ? a(h[d.currentSlide]) : a(h[d.currentSlide]).find("img:first");
181                    if (c.controlNav) {
182                        a(".nivo-controlNav a", b).removeClass("active");
183                        a(".nivo-controlNav a:eq(" + d.currentSlide + ")", b).addClass("active")
184                    }
185                    if (d.currentImage.attr("title") != "") {
186                        var u = d.currentImage.attr("title");
187                        if (u.substr(0, 1) == "#") u = a(u).html();
188                        a(".nivo-caption", b).css("display") == "block" ? a(".nivo-caption p", b).fadeOut(c.animSpeed, function () {
189                            a(this).html(u);
190                            a(this).fadeIn(c.animSpeed)
191                        }) : a(".nivo-caption p", b).html(u);
192                        a(".nivo-caption", b).fadeIn(c.animSpeed)
193                    } else a(".nivo-caption", b).fadeOut(c.animSpeed);
194                    var m = 0;
195                    a(".nivo-slice", b).each(function () {
196                        var i = Math.round(b.width() / c.slices);
197                        a(this).css({
198                            height: "0px",
199                            opacity: "0",
200                            background: 'url("' + d.currentImage.attr("src") + '") no-repeat -' + (i + m * i - i) + "px 0%"
201                        });
202                        m++
203                    });
204                    if (c.effect == "random") {
205                        h = ["sliceDownRight", "sliceDownLeft", "sliceUpRight", "sliceUpLeft", "sliceUpDown", "sliceUpDownLeft", "fold", "fade", "slideInRight", "slideInLeft"];
206                        d.randAnim = h[Math.floor(Math.random() * (h.length + 1))];
207                        if (d.randAnim == undefined) d.randAnim = "fade"
208                    }
209                    if (c.effect.indexOf(",") != -1) {
210                        h = c.effect.split(",");
211                        d.randAnim = h[Math.floor(Math.random() * h.length)];
212                        if (d.randAnim == undefined) d.randAnim = "fade"
213                    }
214                    d.running = true;
215                    if (c.effect == "sliceDown" || c.effect == "sliceDownRight" || d.randAnim == "sliceDownRight" || c.effect == "sliceDownLeft" || d.randAnim == "sliceDownLeft") {
216                        var n = 0;
217                        m = 0;
218                        w(b, c);
219                        h = a(".nivo-slice", b);
220                        if (c.effect == "sliceDownLeft" || d.randAnim == "sliceDownLeft") h = a(".nivo-slice", b)._reverse();
221                        h.each(function () {
222                            var i = a(this);
223                            i.css({
224                                top: "0px"
225                            });
226                            m == c.slices - 1 ? setTimeout(function () {
227                                i.animate({
228                                    height: "100%",
229                                    opacity: "1.0"
230                                }, c.animSpeed, "", function () {
231                                    b.trigger("nivo:animFinished")
232                                })
233                            }, 100 + n) : setTimeout(function () {
234                                i.animate({
235                                    height: "100%",
236                                    opacity: "1.0"
237                                }, c.animSpeed)
238                            }, 100 + n);
239                            n += 50;
240                            m++
241                        })
242                    } else if (c.effect == "sliceUp" || c.effect == "sliceUpRight" || d.randAnim == "sliceUpRight" || c.effect == "sliceUpLeft" || d.randAnim == "sliceUpLeft") {
243                        m = n = 0;
244                        w(b, c);
245                        h = a(".nivo-slice", b);
246                        if (c.effect == "sliceUpLeft" || d.randAnim == "sliceUpLeft") h = a(".nivo-slice", b)._reverse();
247                        h.each(function () {
248                            var i = a(this);
249                            i.css({
250                                bottom: "0px"
251                            });
252                            m == c.slices - 1 ? setTimeout(function () {
253                                i.animate({
254                                    height: "100%",
255                                    opacity: "1.0"
256                                }, c.animSpeed, "", function () {
257                                    b.trigger("nivo:animFinished")
258                                })
259                            }, 100 + n) : setTimeout(function () {
260                                i.animate({
261                                    height: "100%",
262                                    opacity: "1.0"
263                                }, c.animSpeed)
264                            }, 100 + n);
265                            n += 50;
266                            m++
267                        })
268                    } else if (c.effect == "sliceUpDown" || c.effect == "sliceUpDownRight" || d.randAnim == "sliceUpDown" || c.effect == "sliceUpDownLeft" || d.randAnim == "sliceUpDownLeft") {
269                        var x = m = n = 0;
270                        w(b, c);
271                        h = a(".nivo-slice", b);
272                        if (c.effect == "sliceUpDownLeft" || d.randAnim == "sliceUpDownLeft") h = a(".nivo-slice", b)._reverse();
273                        h.each(function () {
274                            var i = a(this);
275                            if (m == 0) {
276                                i.css("top", "0px");
277                                m++
278                            } else {
279                                i.css("bottom", "0px");
280                                m = 0
281                            }
282                            x == c.slices - 1 ? setTimeout(function () {
283                                i.animate({
284                                    height: "100%",
285                                    opacity: "1.0"
286                                }, c.animSpeed, "", function () {
287                                    b.trigger("nivo:animFinished")
288                                })
289                            }, 100 + n) : setTimeout(function () {
290                                i.animate({
291                                    height: "100%",
292                                    opacity: "1.0"
293                                }, c.animSpeed)
294                            }, 100 + n);
295                            n += 50;
296                            x++
297                        })
298                    } else if (c.effect == "fold" || d.randAnim == "fold") {
299                        m = n = 0;
300                        w(b, c);
301                        a(".nivo-slice", b).each(function () {
302                            var i = a(this),
303                                y = i.width();
304                            i.css({
305                                top: "0px",
306                                height: "100%",
307                                width: "0px"
308                            });
309                            m == c.slices - 1 ? setTimeout(function () {
310                                i.animate({
311                                    width: y,
312                                    opacity: "1.0"
313                                }, c.animSpeed, "", function () {
314                                    b.trigger("nivo:animFinished")
315                                })
316                            }, 100 + n) : setTimeout(function () {
317                                i.animate({
318                                    width: y,
319                                    opacity: "1.0"
320                                }, c.animSpeed)
321                            }, 100 + n);
322                            n += 50;
323                            m++
324                        })
325                    } else if (c.effect == "fade" || d.randAnim == "fade") {
326                        var q = a(".nivo-slice:first", b);
327                        q.css({
328                            height: "100%",
329                            width: b.width() + "px"
330                        });
331                        q.animate({
332                            opacity: "1.0"
333                        }, c.animSpeed * 2, "", function () {
334                            b.trigger("nivo:animFinished")
335                        })
336                    } else if (c.effect == "slideInRight" || d.randAnim == "slideInRight") {
337                        q = a(".nivo-slice:first", b);
338                        q.css({
339                            height: "100%",
340                            width: "0px",
341                            opacity: "1"
342                        });
343                        q.animate({
344                            width: b.width() + "px"
345                        }, c.animSpeed * 2, "", function () {
346                            b.trigger("nivo:animFinished")
347                        })
348                    } else if (c.effect == "slideInLeft" || d.randAnim == "slideInLeft") {
349                        q = a(".nivo-slice:first", b);
350                        q.css({
351                            height: "100%",
352                            width: "0px",
353                            opacity: "1",
354                            left: "",
355                            right: "0px"
356                        });
357                        q.animate({
358                            width: b.width() + "px"
359                        }, c.animSpeed * 2, "", function () {
360                            q.css({
361                                left: "0px",
362                                right: ""
363                            });
364                            b.trigger("nivo:animFinished")
365                        })
366                    }
367                },
368                z = function (b) {
369                    this.console && typeof console.log != "undefined" && console.log(b)
370                };
371            this.stop = function () {
372                if (!a(s).data("nivo:vars").stop) {
373                    a(s).data("nivo:vars").stop = true;
374                    z("Stop Slider")
375                }
376            };
377            this.start = function () {
378                if (a(s).data("nivo:vars").stop) {
379                    a(s).data("nivo:vars").stop = false;
380                    z("Start Slider")
381                }
382            };
383            f.afterLoad.call(this)
384        };
385    a.fn.nivoSlider = function (s) {
386        return this.each(function () {
387            var v = a(this);
388            if (!v.data("nivoslider")) {
389                var f = new A(this, s);
390                v.data("nivoslider", f)
391            }
392        })
393    };
394    a.fn.nivoSlider.defaults = {
395        effect: "random",
396        slices: 15,
397        animSpeed: 500,
398        pauseTime: 3E3,
399        startSlide: 0,
400        directionNav: true,
401        directionNavHide: true,
402        controlNav: true,
403        controlNavThumbs: false,
404        controlNavThumbsFromRel: false,
405        controlNavThumbsSearch: ".jpg",
406        controlNavThumbsReplace: "_thumb.jpg",
407        keyboardNav: true,
408        pauseOnHover: true,
409        manualAdvance: false,
410        captionOpacity: 0.8,
411        beforeChange: function () {},
412        afterChange: function () {},
413        slideshowEnd: function () {},
414        lastSlide: function () {},
415        afterLoad: function () {}
416    };
417    a.fn._reverse = [].reverse
418})(jQuery);

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.