PageSourceSearch

https://mymanikuroff.ru/local/php_interface/include/dwSlider.js?177021507113737

js mymanikuroff.ru collected 2026-10-04 08:18:56 UTC 13,737 bytes, 371 lines download raw bytes

1(function ($) {
2    jQuery.fn.dwSlider = function (options) {
3        var options = $.extend({
4            rightButton: ".sliderBtnRight",
5            leftButton: ".sliderBtnLeft",
6            afterResize: false,
7            responsive: true,
8            secondDots: false,
9            afterLoad: false,
10            timeLine: false,
11            autoMove: true,
12            delay: 3500,
13            severity: 8,
14            touch: true,
15            speed: 500
16        },
17            options
18        );
19
20        var link = $(this).css({
21            display: "block",
22            overflow: "hidden",
23            position: "relative"
24        });
25        var slideBox = link
26            .find(".slideBox")
27            .css({
28                position: "relative",
29                left: "0px",
30                padding: "0px",
31                cursor: options["touch"] ? "move" : "default",
32                margin: "0px"
33            });
34
35        //check for extra div
36        if (slideBox.children("div").length > 0) {
37            var slideElements = slideBox.children("div").children("li");
38        } else {
39            var slideElements = slideBox.children("li");
40        }
41
42        var leftButton = $(options["leftButton"]);
43        var rightButton = $(options["rightButton"]);
44        var currentPosition = 0;
45        var moveValueFx = 0;
46        var timeoutID = 0;
47        var moveValue = 0;
48
49        var timeLine = null;
50
51        if (options["secondDots"] != false) {
52            var secondDots = $(options["secondDots"]).children("li");
53        }
54
55        slideElements.css({
56            position: "relative",
57            "list-style": "none",
58            float: "left",
59            width: "100%"
60        });
61
62        //check length
63        options["touch"] = slideElements.length > 1 && options["touch"] == true ? true : false;
64
65        if (options["touch"]) {
66            var slideElementWidth = slideElements.width();
67            var slideBoxWidth = (slideElements.length - 1) * slideElementWidth;
68            var slideStartPosition = false;
69            var clickPositionX = false;
70            var clickPositionY = false;
71            var clickControl = false;
72        }
73
74        if (options["touch"]) {
75            slideBox.on("mousedown touchstart", function (e) {
76                timeoutID && clearTimeout(timeoutID);
77                slideElementWidth = slideElements.width();
78                slideBoxWidth = (slideElements.length - 1) * slideElementWidth;
79                slideStartPosition = parseInt(slideBox.css("left"), 10);
80                clickPositionX =
81                    e.type == "touchstart" ? e.originalEvent.touches[0].pageX : e.pageX;
82                clickPositionY =
83                    e.type == "touchstart" ? e.originalEvent.touches[0].pageY : e.pageY;
84                if (e.type == "mousedown") {
85                    e.preventDefault();
86                }
87                return (clickControl = true);
88            });
89
90            $(document).on("mousemove touchmove", function (e) {
91                if (clickControl == true) {
92                    var curTouchPosX =
93                        e.type == "touchmove" ? e.originalEvent.touches[0].pageX : e.pageX;
94                    var curTouchPosY =
95                        e.type == "touchmove" ? e.originalEvent.touches[0].pageY : e.pageY;
96                    if (Math.abs(clickPositionY - curTouchPosY) < 450) {
97                        var touchExpression = clickPositionX - curTouchPosX;
98                        if (Math.abs(touchExpression) == touchExpression) {
99                            var touchMoveEx = slideStartPosition - Math.abs(touchExpression);
100                            touchMoveEx =
101                                slideBoxWidth > Math.abs(touchMoveEx) ?
102                                    touchMoveEx :
103                                    -(
104                                        slideBoxWidth +
105                                        (Math.abs(touchMoveEx) - slideBoxWidth) / 6
106                                    );
107                            slideBox.finish().css({
108                                left: touchMoveEx + "px"
109                            });
110                        } else {
111                            var touchMoveEx = slideStartPosition + Math.abs(touchExpression);
112                            touchMoveEx = 0 > touchMoveEx ? touchMoveEx : touchMoveEx / 6;
113                            slideBox.finish().css({
114                                left: touchMoveEx + "px"
115                            });
116                        }
117                    }
118                }
119            });
120
121            $(document).on("mouseup touchend", function (e) {
122                if (clickControl == true) {
123                    clickControl = false;
124
125                    var boxPosition = parseInt(slideBox.css("left"), 10);
126
127                    if (Math.abs(Math.abs(slideStartPosition) - Math.abs(boxPosition)) < 10) {
128                        slideBox.finish().animate({
129                            left: slideStartPosition + "px"
130                        },
131                            200,
132                            "linear"
133                        );
134                    } else {
135                        var touchMoveEx =
136                            slideStartPosition - boxPosition > 0 ?
137                                -(Math.ceil(Math.abs(boxPosition) / slideElements.width()) * 100) :
138                                -(
139                                    Math.floor(Math.abs(boxPosition) / slideElements.width()) *
140                                    100
141                                );
142                        if (Math.abs(touchMoveEx) / 100 > slideElements.length - 1) {
143                            currentPosition = touchMoveEx = 0;
144                        } else if (boxPosition > 0) {
145                            touchMoveEx = -((slideElements.length - 1) * 100);
146                            currentPosition = slideElements.length - 1;
147                        } else {
148                            currentPosition = Math.abs(touchMoveEx) / 100;
149                        }
150
151                        slideBox.finish().animate({
152                            left: touchMoveEx + "%"
153                        },
154                            200,
155                            "linear"
156                        );
157
158                        if (slideElements.length > 1) {
159                            slideDotElements
160                                .removeAttr("class")
161                                .eq(currentPosition)
162                                .addClass("selected");
163                            if (options["secondDots"] != false) {
164                                secondDots
165                                    .removeAttr("class")
166                                    .eq(currentPosition)
167                                    .addClass("selected");
168                            }
169                        }
170                    }
171                }
172            });
173        }
174
175        if (options.responsive === true) {
176            var slidePictures = slideBox.find("span");
177        }
178
179        slideBox.width(slideElements.length * 100 + "%");
180        slideElements.width(100 / slideElements.length + "%");
181
182        if (slideElements.length > 1) {
183            link.append(
184                $("<ol>")
185                    .addClass("pager")
186                    .append(function () {
187                        var str = "";
188                        for (var i = 1; i <= slideElements.length; i++) {
189                            if (i == 1) {
190                                str = str + '<li class="selected"></li>';
191                            } else {
192                                str = str + "<li></li>";
193                            }
194                        }
195                        return str;
196                    })
197            );
198
199            if (options["timeLine"] === true) {
200                timeLine = $("<ins/>").addClass("timeLine").css({
201                    position: "absolute",
202                    display: "block",
203                    height: "2px",
204                    width: "0px",
205                    left: "0px",
206                    top: "0px"
207                });
208                link.append(timeLine);
209            }
210
211            var slideDotBox = link.find(".pager");
212            var slideDotElements = slideDotBox.children("li");
213            slideDotBox.css("margin-left", "-" + (slideElements.length * 22) / 2 + "px");
214        } else {
215            leftButton.hide();
216            rightButton.hide();
217        }
218
219        var slideAuto = function () {
220            if (timeLine) {
221                nextTimeLine(true);
222            }
223            slideMove(false);
224            clearTimeout(timeoutID);
225            timeoutID = setTimeout(function () {
226                slideAuto();
227            }, options.delay);
228        };
229
230        var slideMove = function (left) {
231            if (left == true) {
232                if (-1 == --currentPosition) {
233                    currentPosition = slideElements.length - 1;
234                }
235                moveValue = "-" + currentPosition * 100 + "%";
236            } else {
237                if (slideElements.length == ++currentPosition) {
238                    currentPosition = 0;
239                    moveValue = 0;
240                } else {
241                    moveValue = "-" + currentPosition * 100 + "%";
242                }
243            }
244            slideAnimate(moveValue);
245        };
246
247        var slideAnimate = function (value) {
248            slideBox.stop().animate({
249                left: value
250            },
251                options.speed,
252                "linear",
253                function () {
254                    if (slideElements.length > 1) {
255                        slideDotElements
256                            .removeAttr("class")
257                            .eq(currentPosition)
258                            .addClass("selected");
259                        if (options["secondDots"] != false) {
260                            secondDots.removeAttr("class").eq(currentPosition).addClass("selected");
261                        }
262                    }
263                }
264            );
265        };
266
267        var makeSlider = function (event) {
268            if (event.type == "ready") {
269                if (timeLine) {
270                    nextTimeLine(true);
271                }
272            }
273
274            if (options.responsive === true) {
275                var wW = $(window).outerWidth();
276                var ch = wW > 1350 ? "large" : "normal";
277                slidePictures.each(function (i, el) {
278                    $(el).css({
279                        "background-image": "url('" + $(el).data(ch) + "')"
280                    });
281                });
282            }
283
284            //callBack after resize
285            if (event.type == "resize") {
286                if (options["afterResize"] && typeof options["afterResize"] === "function") {
287                    options["afterResize"](link);
288                }
289            }
290        };
291
292        var nextTimeLine = function (enableAnimate) {
293            if (timeLine) {
294                timeLine.stop().css({
295                    width: "0%"
296                });
297
298                if (enableAnimate == true) {
299                    timeLine.animate({
300                        width: "100%"
301                    },
302                        options.delay,
303                        "linear"
304                    );
305                }
306            }
307        };
308
309        leftButton.on("click", function (e) {
310            clearTimeout(timeoutID);
311            slideMove(true);
312            e.preventDefault();
313        });
314
315        rightButton.on("click", function (e) {
316            clearTimeout(timeoutID);
317            slideMove(false);
318            e.preventDefault();
319        });
320
321        if (slideElements.length > 1) {
322            slideDotElements.on("click", function (e) {
323                clearTimeout(timeoutID);
324                currentPosition = $(this).index() - 1;
325                slideMove(false);
326            });
327            if (options["secondDots"] != false) {
328                secondDots.on("click", function (e) {
329                    clearTimeout(timeoutID);
330                    currentPosition = $(this).index() - 1;
331                    slideMove(false);
332                    e.preventDefault();
333                });
334            }
335        }
336
337        if (options.autoMove && slideElements.length > 1) {
338            timeoutID = setTimeout(function () {
339                slideAuto();
340            }, options.delay);
341        }
342
343        link.hover(
344            function () {
345                clearTimeout(timeoutID);
346                if (timeLine) {
347                    nextTimeLine(false);
348                }
349            },
350            function () {
351                if (options.autoMove && slideElements.length > 1) {
352                    timeoutID = setTimeout(function () {
353                        slideAuto();
354                    }, options.delay);
355                    if (timeLine) {
356                        nextTimeLine(true);
357                    }
358                }
359            }
360        );
361
362        $(window).on("ready resize", makeSlider);
363
364        //callBack after load
365        if (options["afterLoad"] && typeof options["afterLoad"] === "function") {
366            if (slideElements.length > 0) {
367                options["afterLoad"](link);
368            }
369        }
370    };
371})(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.