PageSourceSearch

https://xn----dtbsggcmccbvh.xn--p1ai/wa-data/public/shop/themes/positive/shop.js?v2.12.0

js xn----dtbsggcmccbvh.xn--p1ai collected 2026-10-08 01:04:42 UTC 15,918 bytes, 392 lines download raw bytes

1var frm = null;
2var seThumbsHeight = function () {
3    var product_list_item_height = 0, h = 0;
4    $('#product-list ul.product-list li').each(function(i) {
5        h = $(this).height();
6        if (h > product_list_item_height) {
7            product_list_item_height = h;
8        }
9    });
10    if (product_list_item_height) {
11        $('#product-list ul.product-list li').css('height', product_list_item_height + 'px');
12    }
13}
14
15$(document).ready(function () {
16
17    //SLIDERS
18    var sslider_wrap = $('.sslider_wrap');
19    if (typeof(sslider_mode) != 'undefined' && sslider_wrap.length) {
20        sslider_wrap.sslider({
21            time: 2000,
22            loader: 'none',
23            overlayer: true,
24            //height: 'auto',
25            fx: sslider_mode ? sslider_mode : 'random',
26            onEndTransition: function() {
27                $('.sslider_wrap .sslider_caption').css('top', '-350px');
28                var idx = $('.sslider_wrap .sslider_target .ssliderSlide.sslidercurrent').index();
29                $('.sslider_wrap .sslider_caption:eq(' + idx + ')').animate({ top: 0 }, 300); // .css('top', 0);
30            }
31        });
32    }
33    $('.homepage-bxslider li:eq(0)').find('.bx-details-wrap').css('top', 0);
34    $('.homepage-bxslider').bxSlider({
35        mode: 'horizontal', auto: $('.homepage-bxslider li').length > 1, pause: 5000, autoHover: true, pager:$('.homepage-bxslider li').length > 1,
36        onSlideAfter: function(el, old_index) {
37            $('.homepage-bxslider .bx-details-wrap').css('top', '-350px');
38            $(el).find('.bx-details-wrap').css('top', 0); //animate({ top: 0 }, 300);
39        }
40    });
41    $('.homepage-bxslider').css('height','auto');
42    $('.promo-bxslider').bxSlider( { mode: 'horizontal', auto: true, pause: 5000, autoHover: true, pager: true });
43
44    $('.dialog').on('click', 'a.dialog-close', function () {
45        $(this).closest('.dialog').hide().find('.cart').empty();
46        return false;
47    });
48    $(document).keyup(function(e) {
49        if (e.keyCode == 27) {
50            $('.dialog:visible').hide().find('.cart').empty();
51        }
52    });
53    $('.content').on('submit', '.product-list form.addtocart', function () {
54        frm = $(this);
55        if (frm.data('url')) {
56            var d = $('#dialog');
57            var c = d.find('.cart');
58            c.load(frm.data('url'), function () {
59                c.prepend('<a href="#" class="dialog-close">&times;</a>');
60                d.show();
61                if ((c.height() > c.find('form').height())) {
62                    c.css('bottom', 'auto');
63                } else {
64                    c.css('bottom', '15%');
65                }
66            });
67            return false;
68        }
69        $.post(frm.attr('action') + '?html=1', frm.serialize(), function (response) {
70            if (response.status == 'ok') {
71                addToCart(frm, response);
72            } else if (response.status == 'fail') {
73                alert(response.errors);
74            }
75        }, 'json');
76        return false;
77    });
78
79    // countdown
80    if ($.fn.countdowntimer) {
81        $('.js-promo-countdown').each(function () {
82            var $this = $(this).html('');
83            var id = ($this.attr('id') || 'js-promo-countdown' + ('' + Math.random()).slice(2));
84            $this.attr('id', id);
85            var start = $this.data('start').replace(/-/g, '/');
86            var end = $this.data('end').replace(/-/g, '/');
87            $this.countdowntimer({
88                startDate: start,
89                dateAndTime: end,
90                size: 'md'
91            });
92        });
93    }
94
95    //PRODUCT FILTERING
96    var f = function () {
97
98        var ajax_form_callback = function (f) {
99            var fields = f.serializeArray();
100            var params = [];
101            for (var i = 0; i < fields.length; i++) {
102                if (fields[i].value !== '') {
103                    params.push(fields[i].name + '=' + fields[i].value);
104                }
105            }
106            var url = '?' + params.join('&');
107            $(window).lazyLoad && $(window).lazyLoad('sleep');
108            $('#product-list').html('<img src="' + f.data('loading') + '">');
109            $.get(url+'&_=_', function(html) {
110                var tmp = $('<div></div>').html(html);
111                $('#product-list').html(tmp.find('#product-list').html());
112                if (!!(history.pushState && history.state !== undefined)) {
113                    window.history.pushState({}, '', url);
114                }
115                $(window).lazyLoad && $(window).lazyLoad('reload');
116            });
117        };
118
119        $('.filters.ajax form input').change(function () {
120            ajax_form_callback($(this).closest('form'));
121        });
122        $('.filters.ajax form').submit(function () {
123            ajax_form_callback($(this));
124            return false;
125        });
126
127        $('.filters .slider').each(function () {
128            if (!$(this).find('.filter-slider').length) {
129                $(this).append('<div class="filter-slider"></div>');
130            } else {
131                return;
132            }
133            var min = $(this).find('.min');
134            var max = $(this).find('.max');
135            var min_value = parseFloat(min.attr('placeholder'));
136            var max_value = parseFloat(max.attr('placeholder'));
137            var step = 1;
138            var slider = $(this).find('.filter-slider');
139            if (slider.data('step')) {
140                step = parseFloat(slider.data('step'));
141            } else {
142                var diff = max_value - min_value;
143                if (Math.round(min_value) != min_value || Math.round(max_value) != max_value) {
144                    step = diff / 10;
145                    var tmp = 0;
146                    while (step < 1) {
147                        step *= 10;
148                        tmp += 1;
149                    }
150                    step = Math.pow(10, -tmp);
151                    tmp = Math.round(100000 * Math.abs(Math.round(min_value) - min_value)) / 100000;
152                    if (tmp && tmp < step) {
153                        step = tmp;
154                    }
155                    tmp = Math.round(100000 * Math.abs(Math.round(max_value) - max_value)) / 100000;
156                    if (tmp && tmp < step) {
157                        step = tmp;
158                    }
159                }
160            }
161            slider.slider({
162                range: true,
163                min: parseFloat(min.attr('placeholder')),
164                max: parseFloat(max.attr('placeholder')),
165                step: step,
166                values: [parseFloat(min.val().length ? min.val() : min.attr('placeholder')),
167                    parseFloat(max.val().length ? max.val() : max.attr('placeholder'))],
168                slide: function( event, ui ) {
169                    var v = ui.values[0] == $(this).slider('option', 'min') ? '' : ui.values[0];
170                    min.val(v);
171                    v = ui.values[1] == $(this).slider('option', 'max') ? '' : ui.values[1];
172                    max.val(v);
173                },
174                stop: function (event, ui) {
175                    min.change();
176                }
177            });
178            min.add(max).change(function () {
179                var v_min =  min.val() === '' ? slider.slider('option', 'min') : parseFloat(min.val());
180                var v_max = max.val() === '' ? slider.slider('option', 'max') : parseFloat(max.val());
181                if (v_max >= v_min) {
182                    slider.slider('option', 'values', [v_min, v_max]);
183                }
184            });
185        });
186    };
187    f();
188
189    // SWITCH VIEW MODE
190    $('.view-select .icon24').click(function() {
191        if ($(this).hasClass('selected')) {
192            return;
193        }
194        if ($(this).hasClass('thumbs')) {
195            document.cookie = 'view_select=thumbs; path=/;';
196        } else {
197            document.cookie = 'view_select=table; path=/;';
198        }
199        window.location.reload();
200    });
201    // MISC
202    var offers = $('.special-offers');
203    for (var i=0; i<offers.length; i++) {
204        var outer = $(offers[i]), inner = outer.find('li'), outer_width = outer.width(), inner_width = $(inner[0]).width() * inner.length;
205        if (inner_width > outer_width) {
206            outer.prev().prepend('<div class="offers-ctrl"><a class="offers-btn next"></a><a class="offers-btn prev disabled"></a></div>');
207        }
208    }
209    $('.offers-btn').click(function() {
210        var outer = $(this).parent().parent().next(), inner = outer.find('li'), outer_width = outer.width(), inner_width = $(inner[0]).width(),
211        off = Math.floor(outer_width / inner_width) * inner_width, scrollLeft = outer.scrollLeft();
212        if ($(this).hasClass('next')) {
213            outer.animate({scrollLeft: scrollLeft + off});
214            if (scrollLeft + off >= outer_width) {
215                $(this).addClass('disabled');
216            }
217            $('.offers-btn.prev').removeClass('disabled');
218        } else {
219            outer.animate({scrollLeft: scrollLeft - off});
220            if (scrollLeft - off <= 0) {
221                $(this).addClass('disabled');
222            }
223            $('.offers-btn.next').removeClass('disabled');
224        }
225    });
226    if (typeof(refresh_cart) != 'undefined' && typeof(Storage) != 'undefined') {
227        setInterval(function() {
228            if (!localStorage.getItem('cart_total')) {
229                localStorage.setItem('cart_total', $('#cart .cart-total').html());
230                localStorage.setItem('cart_count', $('#cart .cart-count').html());
231            } else {
232                $('#cart .cart-total').html(localStorage.getItem('cart_total'));
233                $('#cart .cart-count').html(localStorage.getItem('cart_count'));
234            }
235        }, 2000);
236    }
237
238    //LAZYLOADING
239    if ($.fn.lazyLoad) {
240        var paging = $('.lazyloading-paging');
241        if (!paging.length) {
242            return;
243        }
244
245        var times = parseInt(paging.data('times'), 10);
246        var link_text = paging.data('linkText') || 'Load more';
247        var loading_str = paging.data('loading-str') || 'Loading...';
248
249        // check need to initialize lazy-loading
250        var current = paging.find('li.selected');
251        if (current.children('a').text() != '1') {
252            return;
253        }
254        paging.hide();
255        var win = $(window);
256
257        // prevent previous launched lazy-loading
258        win.lazyLoad('stop');
259
260        // check need to initialize lazy-loading
261        var next = current.next();
262        if (next.length) {
263            win.lazyLoad({
264                container: '#product-list .product-list',
265                load: function () {
266                    win.lazyLoad('sleep');
267
268                    var paging = $('.lazyloading-paging').hide();
269
270                    // determine actual current and next item for getting actual url
271                    var current = paging.find('li.selected');
272                    var next = current.next();
273                    var url = next.find('a').attr('href');
274                    if (!url) {
275                        win.lazyLoad('stop');
276                        return;
277                    }
278
279                    var product_list = $('#product-list .product-list');
280                    var loading = paging.parent().find('.loading').parent();
281                    if (!loading.length) {
282                        loading = $('<div><i class="icon16 loading"></i>'+loading_str+'</div>').insertBefore(paging);
283                    }
284
285                    loading.show();
286                    $.get(url, function (html) {
287                        var tmp = $('<div></div>').html(html);
288                        if ($.Retina) {
289                            tmp.find('#product-list .product-list img').retina();
290                        }
291                        product_list.append(tmp.find('#product-list .product-list').children());
292                        var tmp_paging = tmp.find('.lazyloading-paging').hide();
293                        paging.replaceWith(tmp_paging);
294                        paging = tmp_paging;
295
296                        times -= 1;
297
298                        // check need to stop lazy-loading
299                        var current = paging.find('li.selected');
300                        var next = current.next();
301                        if (next.length) {
302                            if (!isNaN(times) && times <= 0) {
303                                win.lazyLoad('sleep');
304                                if (!$('.lazyloading-load-more').length) {
305                                    $('<a href="#" class="lazyloading-load-more">' + link_text + '</a>').insertAfter(paging)
306                                        .click(function () {
307                                            loading.show();
308                                            times = 1;      // one more time
309                                            win.lazyLoad('wake');
310                                            win.lazyLoad('force');
311                                            return false;
312                                        });
313                                }
314                            } else {
315                                win.lazyLoad('wake');
316                            }
317                        } else {
318                            win.lazyLoad('stop');
319                            $('.lazyloading-load-more').hide();
320                        }
321
322                        loading.hide();
323                        tmp.remove();
324                        seThumbsHeight();
325                    });
326                }
327            });
328        }
329    }
330});
331function addToCart(form, response) {
332    var cart_total = $('.cart-total'), cart_obj = $('#cart');
333    var cart_margin = cart_obj.hasClass('fixed') ? 0 : 15;
334    var cart_right = Math.round($(window).width() - cart_obj.offset().left - cart_obj.outerWidth() - cart_margin);
335    cart_total.closest('#cart').removeClass('empty');
336    cart_total.html(response.data.total);
337    $('.cart-count').html(response.data.count);
338    if (typeof(Storage) !== 'undefined') {
339        localStorage.setItem('cart_total', response.data.total);
340        localStorage.setItem('cart_count', response.data.count);
341    }
342    var d = $('.dialog:visible');
343    if (!d.length) {
344        var btn = form.find('input[type="submit"]').fadeOut(1000, function() {
345            btn.hide();
346            form.find('span.added2cart').fadeIn(300);
347        });
348        if (!window.matchMedia('only screen and (max-width: 800px)').matches) {
349            flyingCart(form, cart_total);
350        }
351    } else {
352        d.fadeOut(300, function() {
353            $('.dialog .cart').empty();
354            frm.find('input[type="submit"]').hide();
355            frm.find('span.added2cart').show();
356        });
357        if (window.matchMedia('only screen and (max-width: 800px)').matches) {
358            // mobile: show "added to cart" message
359            frm.find('input[type="submit"]').hide();
360            frm.find('span.added2cart').show();
361        } else {
362            flyingCart(form, cart_total);
363        }
364    }
365    cart_obj.css('right', cart_right + 'px').addClass('fixed');
366}
367function flyingCart(form, cart_total) {
368    // flying cart
369    var origin = form.find('.purchase');
370    if (!origin.length) {
371        origin = form;
372    }
373    var block = $('<div class="product-fly"></div>').append(origin.html());
374    block.css({
375        'z-index': 100500,
376        background: '#fff',
377        top: origin.offset().top,
378        left: origin.offset().left,
379        width: origin.width()+'px',
380        height: origin.height()+'px',
381        position: 'absolute',
382        overflow: 'hidden'
383    }).appendTo('body').css({'border':'2px solid #eee','padding':'20px','background':'#fff'}).animate({
384        top: cart_total.offset().top,
385        left: cart_total.offset().left,
386        width: '10px',
387        height: '10px',
388        opacity: 0.7
389    }, 700, function() {
390        block.remove();
391    });
392}

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.