PageSourceSearch

https://gardenwood.ru/t/v267/images/js/main.js

js gardenwood.ru collected 2026-10-05 00:06:47 UTC 5,243 bytes, 181 lines download raw bytes

1(function($) {
2    $.fn.getMaxHeight = function() {
3        var max = 0;
4        this.each(function() {
5            var $this = $(this),
6            height,
7            minHeight = $this.css('min-height');
8            $this.css('min-height', 0);
9            height = $this.height();
10            if (height > max) {
11                max = height;
12            }
13            $this.css('min-height', minHeight);
14        });
15        return max;
16    };
17
18    $.fn.eachRow = function(processing, deleteMarginRight) {
19        var elements = this,
20        wrap = elements.parent(),
21        wrapWidth,
22        elementWidth,
23        inRow,
24        left,
25        right,
26        i = 0;
27
28        if (wrap.get(0) && elements.get(0)) {
29            wrapWidth = wrap.width();
30            elementWidth = elements.outerWidth(true);
31            if (deleteMarginRight) {
32                wrapWidth += parseFloat(elements.css('margin-right'));
33            }
34            inRow = Math.floor(wrapWidth / elementWidth);
35            if (inRow > 1) {
36                for (; i < elements.length; i += inRow) {
37                    left = i;
38                    right = i + inRow;
39                    if (right > elements.length) {
40                        right = elements.length;
41                    }
42                    processing(elements.slice(left, right), elements.eq(left), elements.eq(right - 1));
43                }
44            }
45        }
46        return elements;
47    };
48})(jQuery);
49
50function setHeightProductItems() {
51
52    function setHeightProductItemsInit() {
53        var productItem = '.product-item-thumb',
54        productItemNew = '.new-item-thumb',
55        productTop = '.product-top',
56        productBot = '.product-bot';
57
58        function initHeight(group, first, last, outerMargin) {
59            var maxHeight = group.getMaxHeight();
60
61            group.each(function() {
62                var item = $(this),
63                productBotHeight = item.find(productBot).outerHeight(true);
64
65                item.css('min-height', maxHeight);                
66                item.find(productTop).css('min-height', (maxHeight - outerMargin) - productBotHeight);
67            });
68            last.css('margin-right', 0);
69        }
70        $(productItem).eachRow(function(group, first, last) {
71            initHeight(group, first, last, 0);
72        },
73        true);
74        $(productItemNew).eachRow(function(group, first, last) {
75            initHeight(group, first, last, 40);
76        },
77        true);
78    }
79
80    setHeightProductItemsInit();
81
82    $(window).resize(setHeightProductItemsInit);
83
84    if (shop2 && shop2.product && shop2.product.reload) {
85        var reload = shop2.product.reload;
86
87        shop2.product.reload = function(node, pageType, cb) {
88            if (pageType == 'product') {
89                reload.call(this, node, 'product', cb);
90            } else {
91                if (!cb) {
92                    cb = setHeightProductItemsInit;
93                }
94                reload.call(this, node, null, cb);
95            }
96        }
97    }
98}
99
100function ProductCarousel() {
101    $('.special-offer .product-list').jCarouselLite({
102        btnNext: '.next',
103        btnPrev: '.prev',
104        circular: false,
105        speed: 500,
106        visible: 3,
107        scroll: 1
108    });
109}
110
111$(function() {
112    //document_ready_start
113
114    ProductCarousel();
115
116    setHeightProductItems();
117
118    $('.slider').megaSlider({
119        animation: 'slideLeft',
120        interval: 4000
121    });
122
123    shopClient.Cart = {
124        check: function() {
125            var amount = $('#cart_total_amount'),
126            cart = $('.basket');
127
128            if (amount.get(0)) {
129                if (parseFloat(amount.html()) > 0) {
130                    cart.addClass('basket-full');
131                } else {
132                    cart.removeClass('basket-full');
133                }
134            }
135        }
136    };
137
138    // toggle
139    (function() {
140        var toggleHeader = '.toggle-title';
141
142        $(toggleHeader).each(function() {
143            var toggle = $(this),
144            next = toggle.next(),
145            toggleCookie = toggle.attr('id'),
146            toggleCookieValue = readCookie(toggleCookie);
147
148            if (toggleCookieValue == '0') {
149                next.hide();
150            } else if (toggleCookieValue == '1') {
151                next.show();
152            }
153
154        });
155
156        $(toggleHeader).click(function() {
157            var toggle = $(this),
158            next = toggle.next(),
159            toggleCookie = toggle.attr('id');
160
161            if (next.is(':hidden')) {
162                next.slideDown();
163                toggle.addClass('open');
164                if (toggleCookie != undefined) createCookie(toggleCookie, 1, 90);
165            } else {
166                next.not(':animated').slideUp();
167                toggle.removeClass('open');
168                if (toggleCookie != undefined) createCookie(toggleCookie, 0, 90);
169            }
170        });
171
172    })();
173
174    //document_ready_end
175});
176
177hs.captionId = 'the-caption';
178hs.outlineType = 'rounded-white';
179window.onload = function() {
180    hs.preloadImages(5);
181}

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.