PageSourceSearch

https://www.louislouise.com/modules/ets_lookbook/views/js/lookbook-front.js?v=2

js louislouise.com collected 2026-09-26 19:43:02 UTC 15,877 bytes, 376 lines download raw bytes

1/**
2 * Copyright ETS Software Technology Co., Ltd
3 *
4 * NOTICE OF LICENSE
5 *
6 * This file is not open source! Each license that you purchased is only available for 1 website only.
7 * If you want to use this file on more websites (or projects), you need to purchase additional licenses.
8 * You are not allowed to redistribute, resell, lease, license, sub-license or offer our resources to any third party.
9 *
10 * DISCLAIMER
11 *
12 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
13 * versions in the future.
14 *
15 * @author ETS Software Technology Co., Ltd
16 * @copyright  ETS Software Technology Co., Ltd
17 * @license    Valid for 1 website (or project) for each purchase of license
18 */
19function ScaleLookbook() {
20    $('.lookbook').css({
21        'width': parseInt(ETS_LB_WIDTH_IMAGE) > 0 ? ETS_LB_WIDTH_IMAGE : 1170,
22        'height': parseInt(ETS_LB_HEIGHT_IMAGE) > 0 ? ETS_LB_HEIGHT_IMAGE : 450
23    });
24    var objscale = $('.show-popup.active .lookbook-item-content').length > 0 ? $('.show-popup.active .lookbook-item-content') : $('.lookbook-item-content');
25    var ratio = (parseInt(ETS_LB_WIDTH_IMAGE) > 0 ? objscale.width() / ETS_LB_WIDTH_IMAGE : 1);
26    var height = ratio * ETS_LB_HEIGHT_IMAGE;
27    if (parseInt(ETS_LB_WIDTH_IMAGE) > 0 && objscale.width() <= ETS_LB_WIDTH_IMAGE) {
28        objscale.css('height', height + 'px');
29        objscale.children('div.lookbook').css('transform', 'scale(' + ratio + ')');
30        objscale.parent('.lookbook-item').parent().children('.product-list').css('max-height', height + 'px');
31    } else {
32        objscale.children('div.lookbook').css('transform', 'scale(1)');
33        objscale.css('height', 'auto');
34    }
35}
36
37function Lb_slider(){
38    var _lookbooks = null, _lookbook_other = null;
39    var _mobile = (typeof ETS_LB_ITEM_ON_MOBILE !== 'undefined' && parseInt(ETS_LB_ITEM_ON_MOBILE) > 0 ? parseInt(ETS_LB_ITEM_ON_MOBILE) : 1);
40    var _tablet = (typeof ETS_LB_ITEM_ON_TABLET !== 'undefined' && parseInt(ETS_LB_ITEM_ON_TABLET) > 0 ? parseInt(ETS_LB_ITEM_ON_TABLET) : 2);
41    var _desktop = (typeof ETS_LB_ITEM_ON_DESKTOP !== 'undefined' && parseInt(ETS_LB_ITEM_ON_DESKTOP) > 0 ? parseInt(ETS_LB_ITEM_ON_DESKTOP) : 4);
42    if (typeof ETS_LB_HOOK_TO !== 'undefined' && (ETS_LB_HOOK_TO == 'displayleftcolumn' || ETS_LB_HOOK_TO == 'displayrightcolumn')) {
43        _mobile = _tablet = _desktop = 1;
44    }
45    if (_mobile && _tablet && _desktop && (typeof ETS_LB_LOOKBOOK_TYPE !== 'undefined' && ETS_LB_LOOKBOOK_TYPE == 'carousel')) {
46        _lookbooks = $('.ets-lookbooks.lb-carousel:not(.loaded)').owlCarousel({
47            loop: false,
48            margin: 30,
49            responsiveClass: true,
50            autoplay: (typeof ETS_LB_AUTO_PLAY_SLIDER !== 'undefined' && parseInt(ETS_LB_AUTO_PLAY_SLIDER) > 0 ? true : false),
51            autoplayHoverPause: (typeof ETS_LB_STOP_WHEN_HOVER_SLIDER !== 'undefined' && parseInt(ETS_LB_STOP_WHEN_HOVER_SLIDER) > 0 ? true : false),
52            autoplaySpeed: (typeof ETS_LB_SPEED_SLIDER !== 'undefined' && parseInt(ETS_LB_SPEED_SLIDER) > 0 ? ETS_LB_SPEED_SLIDER : 5000),
53            responsive: {
54                0: {
55                    items: _mobile,
56                    nav: true
57                },
58                767: {
59                    items: _tablet,
60                    nav: false
61                },
62                1199: {
63                    items: _desktop,
64                    nav: true,
65                }
66            },
67            navText: ['', ''],
68            nav: true,
69            rewindNav: false,
70            callbacks: true,
71        }).addClass('loaded');
72        if (typeof ETS_LB_STOP_WHEN_HOVER_SLIDER !== 'undefined' && parseInt(ETS_LB_STOP_WHEN_HOVER_SLIDER) > 0) {
73            $('.ets-lookbooks.lb-carousel').mouseover(function () {
74                _lookbooks.trigger('stop.owl.autoplay');
75            });
76            $('.ets-lookbooks.lb-carousel').mouseleave(function () {
77                _lookbooks.trigger('play.owl.autoplay', [(parseInt(ETS_LB_SPEED_SLIDER) > 0 ? ETS_LB_SPEED_SLIDER : 5000)]);
78            });
79        }
80    }
81    if ($('.lookbook-other .lookbook-list').length > 0) {
82        _lookbook_other = $('.lookbook-other .lookbook-list').owlCarousel({
83            loop: false,
84            margin: 30,
85            responsiveClass: true,
86            autoplay: true,
87            autoplayHoverPause: true,
88            autoplaySpeed: 3000,
89            responsive: {
90                0: {
91                    items: 1,
92                    nav: true
93                },
94                600: {
95                    items: 2,
96                    nav: false
97                },
98                1000: {
99                    items: 4,
100                    nav: true,
101                    //loop:true
102                }
103            },
104            navText: ['', ''],
105            nav: true,
106            rewindNav: false,
107            callbacks: true,
108        });
109        $('.lookbook-other .lookbook-list').mouseover(function () {
110            _lookbook_other.trigger('stop.owl.autoplay');
111        });
112        $('.lookbook-other .lookbook-list').mouseleave(function () {
113            _lookbook_other.trigger('play.owl.autoplay', [3000]);
114        });
115    }
116}
117$(document).ready(function () {
118    ScaleLookbook();
119    $(window).load(function () {
120        ScaleLookbook();
121    });
122
123    $(window).resize(function () {
124        ScaleLookbook();
125    });
126
127    Lb_slider();
128});
129/*
130$(document).on('click', '.lookbook-list li, .ets-lookbooks li', function (e) {
131    e.preventDefault();
132    var ele = $(this);
133    if (typeof ETS_LB_OPEN_LOOKBOOK_ON_POPUP !== 'undefined' && parseInt(ETS_LB_OPEN_LOOKBOOK_ON_POPUP) > 0) {
134        if (!$(this).hasClass('ajaxActive')) {
135            $.ajax({
136                url: url_ajax_lookbook,
137                dataType: 'json',
138                type: 'get',
139                data: {
140                    id_lookbook: ele.data('id-lookbook'),
141                    show_popup: 1,
142                    mls_object: 'LB_Lookbook',
143                },
144                beforeSend: function () {
145                    $('.lb_loading').addClass('loading');
146                    ele.addClass('ajaxActive');
147                },
148                success: function (json) {
149                    if (!json.hasError) {
150                        $('.show-popup').addClass('active').parents('body').addClass('ets_show_popup');
151                        $('.lb-table-cell').html(json.layoutHTML);
152                        ScaleLookbook();
153                        if (typeof productListingComments !== "undefined") {
154                            productListingComments.load();
155                        }
156                        // $('html').addClass('lb_fancybox_margin');//lb_fancybox_lock
157                    }
158                },
159                complete: function () {
160                    $('.lb_loading').removeClass('loading');
161                    ele.removeClass('ajaxActive');
162                }
163            });
164        }
165    } else {
166        window.location.href = $(this).data('url');
167    }
168});
169*/
170
171$(document).keyup(function (e) {
172    e.preventDefault();
173    if (e.keyCode === 27 && !($('.quickview').length > 0 || $('.fancybox-overlay').length > 0)) {
174        if (($('#layer_cart').length != 0 && $('#layer_cart').css("display") != "none") || ($('#layer_cart_lookbook').length != 0 && $('#layer_cart_lookbook').css("display") != "none")) {
175            $('#layer_cart,.layer_cart_overlay,#layer_cart_lookbook').hide();
176        } else {
177            if ($('#blockcart-modal').length != 0) {
178                if ($('#blockcart-modal').css("display") == "none") {
179                    $('html').removeClass('lb_fancybox_margin lb_fancybox_lock');
180                    $('.show-popup').removeClass('active').parents('body').removeClass('ets_show_popup');
181                }
182            } else {
183                $('html').removeClass('lb_fancybox_margin lb_fancybox_lock');
184                $('.show-popup').removeClass('active').parents('body').removeClass('ets_show_popup');
185            }
186        }
187    } else {
188        $('.fancybox-overlay').remove();
189    }
190});
191
192
193$(document).on('click', '.close-lb-popup,.show-popup.active', function (e) {
194    e.preventDefault();
195    $('html').removeClass('lb_fancybox_margin lb_fancybox_lock');
196    $('.show-popup').removeClass('active').parents('body').removeClass('ets_show_popup');
197});
198
199$(document).on('click', '.lb-table-cell', function (event) {
200    event.stopPropagation();
201});
202
203$(document).on('click', '.layer_cart_lookbook_content .cross, .btn-continue', function (e) {
204    e.preventDefault();
205    $('#layer_cart_lookbook').fadeOut(500);
206});
207
208$(document).on('click', '.layer_cart_lookbook_content .clearfix', function (event) {
209    event.stopPropagation();
210});
211
212$(document).on('click', '.ajax_add_all_to_cart_button', function (e) {
213    e.preventDefault();
214    var $this = $(this);
215    if (!$this.hasClass('active')) {
216        $.ajax({
217            type: 'POST',
218            headers: {"cache-control": "no-cache"},
219            url: LB_ETS_URL_LBCART,
220            async: true,
221            cache: false,
222            dataType: "json",
223            data: 'add=1&ajax=true&token=' + LB_ETS_STATIC_TOKEN + '&productIds=' + $this.data('ids'),
224            beforeSend: function () {
225                $this.addClass('active');
226            },
227            success: function (jsonData) {
228                if (LB_ETS_VER_17 <= 0) {
229                    if (!jsonData.hasError) {
230                        ajaxCart.updateCart(jsonData);
231                        $('#product_list').html(jsonData.renderHtml);
232                        $('#layer_cart_lookbook').fadeIn(500);
233
234                    } else {
235                        var errors = '';
236                        for (error in jsonData.errors)
237                            //IE6 bug fix
238                            if (error != 'indexOf')
239                                errors += $('<div />').html(jsonData.errors[error]).text() + "\n";
240                        alert(errors);
241                    }
242                } else {
243                    prestashop.blockcart = prestashop.blockcart || {};
244                    var showModal = prestashop.blockcart.showModal || function (modal) {
245                        var $body = $('body');
246                        $body.append(modal);
247                        $body.one('click', '#blockcart-modal', function (event) {
248                            if (event.target.id === 'blockcart-modal') {
249                                $(event.target).remove();
250                            }
251                        });
252                    };
253                    $('.blockcart').replaceWith($(jsonData.preview).find('.blockcart'));
254                    if (jsonData.modal) {
255                        showModal(jsonData.modal);
256                    }
257                }
258            },
259            error: function (XMLHttpRequest, textStatus, errorThrown) {
260                alert("Impossible to add the product to the cart.\n\ntextStatus: '" + textStatus + "'\nerrorThrown: '" + errorThrown + "'\nresponseText:\n" + XMLHttpRequest.responseText);
261            },
262            complete: function () {
263                $this.removeClass('active');
264            }
265        });
266    }
267
268});
269$(document).on('mouseover', '.lb_product_front', function () {
270    $(this).addClass('active_hover');
271    $('li.item-product[data-id-product=' + $(this).data('id-product') + '][data-id_product_attribute=' + $(this).data('id-product-attribute') + '] .productName').addClass('active_hover');
272    $('li.item-product[data-id-product=' + $(this).data('id-product') + '][data-id_product_attribute=' + $(this).data('id-product-attribute') + '] .product-thumbnail').addClass('active_hover');
273});
274$(document).on('mouseout', '.lb_product_front', function () {
275    $(this).removeClass('active_hover');
276    $('li.item-product[data-id-product=' + $(this).data('id-product') + '][data-id_product_attribute=' + $(this).data('id-product-attribute') + '] .productName').removeClass('active_hover');
277    $('li.item-product[data-id-product=' + $(this).data('id-product') + '][data-id_product_attribute=' + $(this).data('id-product-attribute') + '] .product-thumbnail').removeClass('active_hover');
278});
279$(document).on('click', '.tag_load', function () {
280    var _this = $(this),
281        route = _this.data('route'),
282        item = $('#lookbook-list-load-' + _this.data('id'))
283    ;
284    if (!_this.hasClass('active') && item.length > 0 && route !== '') {
285        if (item.find('.lb_loaded').length > 0) {
286            $(".lookbook-list-load, .tag_name").removeClass('active');
287            _this.addClass('active');
288            item.addClass('active');
289        } else {
290            $(".lookbook-list-load, .tag_name").removeClass('active');
291            _this.addClass('active');
292            item.addClass('active');
293            var tagName = $(this).data('tag');
294            $("#lookbook-loading").css('display', 'block');
295
296            if (tagName !== '' && !_this.hasClass('loading')) {
297                _this.addClass('loading');
298                $.ajax({
299                    url: url_ajax_lookbook,
300                    type: 'get',
301                    data: {
302                        action_load: route,
303                        tag: tagName,
304                    },
305                    dataType: 'json',
306                    success: function (json) {
307                        _this.removeClass('loading');
308                        if (json) {
309                            $("#lookbook-loading").css('display', 'none');
310                            if (json.html) {
311                                item.html(json.html);
312                            }
313                            Lb_slider();
314                        }
315                    },
316                    error: function (xhr, status, error) {
317                        $("#lookbook-loading").css('display', 'none');
318                        /*var err = eval("(" + xhr.responseText + ")");
319                        alert(err.Message);*/
320                        _this.removeClass('loading');
321                    }
322                });
323            }
324        }
325    } else {
326        if (!item.hasClass('active')) {
327            item.addClass('active');
328        }
329    }
330});
331$(document).on('click', '.tag_load_lookbook', function (e) {
332    var _this = $(this);
333    var cls = '#lookbook-list-load-' + _this.data('id');
334
335
336    $(".tag_name").each(function (index) {
337        $(this).css('color', '#000000');
338    });
339    $(this).css('color', '#2fb5d2');
340
341    $("#lookbook-list-all").css('display', 'none');
342    $(".lookbook-list-load").each(function (index) {
343        $(this).css('display', 'none');
344    });
345
346    var tag = $(this).data('loading');
347    if ($(cls).html() == '') {
348        $("#lookbook-loading").css('display', 'block');
349        if (tag != '') {
350            $.ajax({
351                url: url_ajax_lookbook,
352                type: 'post',
353                data: {
354                    load_tag_lookbook: tag,
355                },
356                success: function (json) {
357                    $("#lookbook-loading").css('display', 'none');
358                    $(cls).html(json.html);
359                    $(cls).css('display', 'block');
360
361                },
362                error: function (xhr, status, error) {
363                    $("#lookbook-loading").css('display', 'none');
364                    var err = eval("(" + xhr.responseText + ")");
365                    alert(err.Message);
366                }
367            });
368        }
369    } else {
370        $(cls).css('display', 'block')
371    }
372
373});
374
375
376

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.