PageSourceSearch

https://luxury-textile.ru/js/scripts.js?v=11

js luxury-textile.ru collected 2026-10-02 20:32:45 UTC 54,925 bytes, 1,792 lines download raw bytes

1function ModuleLoaderClass()
2{
3    this.loaded_modules = {};
4    
5    this.all_modules = 
6    {
7        'inputmask': {js:['/js/jquery.inputmask.js']},
8        'photoswipe': {js:['/js/photoswipe.min.js', '/js/photoswipe-ui-default.min.js'], css: ['/css/default-skin/default-skin.css', '/css/photoswipe.css']},
9        'typeahead': {js: ['/js/typeahead.bundle.js']},
10        'ya_share2': {js:['//yastatic.net/es5-shims/0.0.2/es5-shims.min.js', '//yastatic.net/share2/share.js']},
11        'good_size_popup': {
12            js: ['/js/good_size_popup_module.js?r=0'],
13            css: ['/css/good_size_popup_module.css?r=0'],
14            require: ['bootstrap'],
15            define: ['show_listcart_size_selector_popup', 'show_good_size_selector_popup', 'show_catalog_sizes_modal', 
16                'show_catalog_color_selector_modal', 'show_color_selector_modal']
17        },
18        'bootstrap': {
19            js: ['/js/bootstrap/js/bootstrap.min.js'],
20            css: ['/js/bootstrap/css/bootsrap.custom.css']
21        },
22        'topsearch': {
23            js: ['/js/typeahead.bundle.js'],
24            css: ['/css/topsearch.css']
25        },
26        'bx_slider': {js:['/js/jquery.bxslider_new.js'], 'css': ['/css/jquery.bxslider.css'], 
27            check: function() { return typeof($.fn.bxSlider) === 'function'; }},
28        'opinion_slider': {css: ['/css/opinion_slider.css'], el_id: 'opinion_slider-module'},
29        'module_popup': {
30            js: ['//spim.ru/components/js/module_popup.js', '/js/bootstrap/js/bootstrap.min.js'],
31            css: ['/js/bootstrap/css/bootsrap.custom.css']
32        },
33        'pickpoint_popup': {
34            js:['/js/PickpointMap.js'],
35            css:['/css/pickpoint_map.css'],
36            define: ['showPickpointMap']
37        },
38        'good_slider': {'css': ['/css/good_slider_module.css', '/css/catalog_v2.css'], require: ['bx_slider']},
39        'dragable_native_scroll': {js: ['https://clever-mattress.ru/js/dragable_native_scroll.js']}
40    };
41
42    var ctx = this;
43
44    $.each(this.all_modules, function(m_name, module) 
45    {
46        if(module.define)
47        {
48            $.each(module.define, function(key, func_name)
49            {
50                window[func_name] = function() 
51                {
52                    var fn_name = func_name;
53
54                    var func_ctx = this;
55                    var func_args = arguments;
56
57                    ctx.load(m_name, function() 
58                    {
59                        window[fn_name].apply(func_ctx, func_args);
60                    });
61
62                    return false;
63                };
64            });
65        }
66    });
67
68    var load_counter = 0;
69
70    if(!$.fn.dragableNativeScroll)
71    {
72        $.fn.dragableNativeScroll = function ()
73        {
74            if (load_counter++ > 0)
75                return;
76
77            module_loader.load('dragable_native_scroll', function () {
78                $(this).dragableNativeScroll();
79            }, this);
80        };
81    }
82}
83
84ModuleLoaderClass.prototype.loadCSS = function(path, fn)
85{
86    var head = document.getElementsByTagName('head')[0],
87        link = document.createElement('link');
88
89    link.setAttribute('href', path);
90    link.setAttribute('rel', 'stylesheet');
91    link.setAttribute('type', 'text/css');
92
93    var sheet, cssRules;
94
95    if ('sheet' in link) {
96        sheet = 'sheet';
97        cssRules = 'cssRules';
98    } else {
99        sheet = 'styleSheet';
100        cssRules = 'rules';
101    }
102
103    var interval_id = setInterval(function ()
104    {
105        try
106        {
107            if (link[sheet] && link[sheet][cssRules].length)
108            {
109                clearInterval(interval_id);
110                clearTimeout(timeout_id);
111
112                if (fn)
113                    fn(true, link);
114            }
115        } catch (e) {} finally {}
116
117    }, 10),
118    timeout_id = setTimeout(function () 
119    {
120        clearInterval(interval_id);
121        clearTimeout(timeout_id);
122        head.removeChild(link);
123
124        if (fn)
125            fn(false, link);
126
127        head.appendChild(link);
128    }, 15000);
129    head.appendChild( link );
130    return link;
131};
132
133if (navigator.userAgent.match(/Mac/) && navigator.maxTouchPoints && navigator.maxTouchPoints > 2 )
134{
135    function getCookie(name) {
136      const value = `; ${document.cookie}`;
137      const parts = value.split(`; ${name}=`);
138      if (parts.length === 2) return parts.pop().split(';').shift();
139    }     
140    
141    if( typeof(getCookie('was_on_mobile')) === 'undefined' )
142        goMobileVersion();
143}
144
145ModuleLoaderClass.prototype.loadJS = function(path, fn)
146{
147    var head = document.getElementsByTagName('head')[0];
148    
149    var scriptTag = document.createElement('script');
150    scriptTag.src = path;
151 
152    if (scriptTag.readyState) {
153        scriptTag.onreadystatechange = function () {
154            if (scriptTag.readyState == "loaded" ||
155                    scriptTag.readyState == "complete") {
156                scriptTag.onreadystatechange = null;
157                fn();
158            }
159        };
160    } else {  //Others
161        scriptTag.onload = function () {
162            fn();
163        };
164    }
165
166    head.appendChild(scriptTag);
167};
168
169ModuleLoaderClass.prototype.load = function(module_name, fn, scope)
170{
171    if(module_name in this.loaded_modules)
172    {
173        if(fn) fn.call(scope || window);
174    }
175    else
176    {
177        var ctx = this;
178        
179        var module = this.all_modules[module_name];
180        
181        if(!module)
182        {
183            console.log('module:' + module_name + ' not found');
184            
185            return;
186        }
187        
188        if(module.check && module.check())
189        {
190            if(module.init)
191                module.init();
192
193            if(fn)
194                fn.call(scope || window);
195
196            ctx.loaded_modules[module_name] = true;
197            
198            return;
199        }
200        
201        function load()
202        {
203            if(module.before_load)
204                module.before_load();
205            
206            if(module.define)
207            {
208                for(var key in module.define)
209                {
210                    var def = module.define[key];
211                    
212                    window[def] = null;
213                }
214            }
215            
216            if((module.css || false) || (module.js || false))
217            {
218                var qnt = (module.css || []).length + 
219                    (module.js ? 1 : 0);
220
221
222                function module_load_tick()
223                {
224                    qnt--;
225
226                    if(qnt === 0)
227                    {
228                        if(module.init)
229                            module.init();
230
231                        if(fn)
232                            fn.call(scope || window);
233
234                        ctx.loaded_modules[module_name] = true;
235                    }
236                }
237
238                if(module.css)
239                {
240                    for(var key in module.css)
241                    {
242                        ctx.loadCSS(module.css[key], function() {
243                            module_load_tick();
244                        });
245                    }
246                }
247
248                if(module.js)
249                {
250                    var i = 0;
251                    
252                    function r_js_load()
253                    {                       
254                        ctx.loadJS(module.js[i++], function() 
255                        {
256                            if(i === module.js.length)
257                                module_load_tick();
258                            else
259                                r_js_load();
260                        });
261                    }
262                    
263                    r_js_load();
264                }
265            }
266        }
267        
268        if(module.require || false)
269        {
270            var i = 0;
271            
272            function r_m_load()
273            {
274                ctx.load(module.require[i++], function() 
275                {
276                    if(i === module.require.length)
277                        load();
278                    else
279                        r_m_load();
280                });
281            }
282            
283            r_m_load();
284        }
285        else
286            load();
287    }
288};
289
290window.module_loader = new ModuleLoaderClass();
291
292function goodChangeSize(sender)
293{
294    var option = $('option:selected', sender);
295
296    var url = option.attr('data-url');
297    var price = option.attr('data-price');
298    var oldprice = option.attr('data-old-price');
299    
300    var good = $(sender).closest('.good-item');
301    
302    $('a.good-url', good).attr('href', url);
303    
304    $('.old-price', good).text(oldprice);
305    $('.new-price span, .price span', good).text(price);
306}
307
308function AddonWindow( uri ) {
309    myWin = open(uri, "linkWindow", "width=800,height=700,status=no,toolbar=no,menubar=no, titlebar=no, scrollbars=yes, resizable=yes")
310}
311
312function ShowColor(id,idc,sz,ck,vp) {
313  var CBox = $('#clrimg' + id + '_' + sz + '_' + idc);
314  var span = $('#colorname' + id + '_' + sz + '_' + idc);
315  span.siblings().removeClass('active');
316  CBox.siblings().hide();
317  if (span.hasClass('active')) {
318    CBox.hide();
319    span.removeClass('active');
320  }
321  else {
322    CBox.show();
323    span.addClass('active').find('input').attr('checked', 'checked');
324  }  
325}
326
327function ColorBlockShow(el) {
328  var el = $(this);
329  ShowColor(el.attr("cid"), el.attr("ci"), el.attr("sz"), el.attr("ck"), el.attr("vp"));
330  
331  /*var img = el.attr('data-img');
332  
333  if(img)
334  {
335      $('#wrap img').attr('src', img);
336  }*/
337}
338
339function ColorBlockHide(el) {
340  var el = $(this);
341  var id = el.attr("cid");
342  var idc = el.attr("ci");
343  var sz = el.attr("sz");
344  var CBox = $('#clrimg' + id + '_' + sz + '_' + idc);
345  if (CBox.is(':visible')) {
346    ShowColor(id, idc, sz);
347  }
348}
349
350$(function() 
351{
352    var cycle = $('.cycle').not('.init');
353    
354    if(cycle.length)
355    {
356        var has_pager = typeof cycle.attr('has-pager') !== 'undefined';
357        
358        setTimeout(function() 
359        {
360            cycle.cycle({
361              fx: 'scrollLeft', 
362              delay: 1000,
363              timeout: 4000, 
364              pager:  has_pager ? '.cycle-container .pager' : null,
365              easing: 'easeInOutBack',
366              prev: '.btn.prev',
367              next: '.btn.next',
368              pause: 1
369            }).addClass('init');
370        }, 300);
371    }
372
373    if($('#menu').length)
374        customScrollFollow($('#menu'));
375
376
377});
378
379
380
381function customScrollFollow(element)
382{
383    var startPos = $(element).offset();
384    
385    function onScroll()
386    {
387        var pos = $(element).offset();
388        var topScroll = $(window).scrollTop();
389        
390        if(pos.top - topScroll < 0) 
391            $(element).addClass('scroll-follow');
392        
393        else if(pos.top <= startPos.top)
394            $(element).removeClass('scroll-follow');
395    }
396    
397    $(window).scroll(onScroll);
398}
399
400function getCookieDomain()
401{
402    return '.' + location.host.split('.').slice(-2).join('.');
403}
404
405function goMobileVersion()
406{
407    var base_domain = location.host.split('.').slice(-2).join('.');
408    $.cookie('is_mobile', true, { path: '/', domain: '.' + base_domain });
409    location = 'https://m.' + base_domain + location.pathname;
410    return false;
411}
412
413
414$(function()
415{ 
416    var jwi = $('#jivosite-widget-id');
417
418    if(jwi.length)
419    {
420        document.jivositeloaded=0;var widget_id = jwi.attr('data-id');var d=document;var w=window;function l(){var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = '//code.jivosite.com/script/widget/'+widget_id; var ss = document.getElementsByTagName('script')[0]; ss.parentNode.insertBefore(s, ss);}//ýòà ñòðîêà îáû÷íàÿ äëÿ êîäà JivoSite
421
422        function zy(){
423            //óäàëÿåì EventListeners
424            if(w.detachEvent){//ïîääåðæêà IE8
425                w.detachEvent('onscroll',zy);
426                w.detachEvent('onmousemove',zy);
427                w.detachEvent('ontouchmove',zy);
428                w.detachEvent('onresize',zy);
429            }else {
430                w.removeEventListener("scroll", zy, false);
431                w.removeEventListener("mousemove", zy, false);
432                w.removeEventListener("touchmove", zy, false);
433                w.removeEventListener("resize", zy, false);
434            }
435            //çàïóñêàåì ôóíêöèþ çàãðóçêè JivoSite
436            if(d.readyState=='complete'){l();}else{if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}
437            //Óñòàíàâëèâàåì êóêó ïî êîòîðîé îòëè÷àåì ïåðâûé è âòîðîé õèò
438            var cookie_date = new Date ( );
439            cookie_date.setTime ( cookie_date.getTime()+60*60*28*1000); //24 ÷àñà äëÿ Ìîñêâû
440            d.cookie = "JivoSiteLoaded=1;path=/;expires=" + cookie_date.toGMTString();
441        }
442
443        if (d.cookie.search ( 'JivoSiteLoaded' )<0){//ïðîâåðÿåì, ïåðâûé ëè ýòî âèçèò íà íàø ñàéò, åñëè äà, òî íàçíà÷àåì EventListeners íà ñîáûòèÿ ïðîêðóòêè, èçìåíåíèÿ ðàçìåðà îêíà áðàóçåðà è ñêðîëëèíãà íà ÏÊ è ìîáèëüíûõ óñòðîéñòâàõ, äëÿ îòëîæåííîé çàãðóçêå JivoSite.
444            if(w.attachEvent){// ïîääåðæêà IE8
445                w.attachEvent('onscroll',zy);
446                w.attachEvent('onmousemove',zy);
447                w.attachEvent('ontouchmove',zy);
448                w.attachEvent('onresize',zy);
449            }else {
450                w.addEventListener("scroll", zy, {capture: false, passive: true});
451                w.addEventListener("mousemove", zy, {capture: false, passive: true});
452                w.addEventListener("touchmove", zy, {capture: false, passive: true});
453                w.addEventListener("resize", zy, {capture: false, passive: true});
454            }
455        }
456        else {zy();}
457    }   
458});
459
460
461function is_2x_display()
462{
463    return (window.devicePixelRatio || 0) > 1.0;
464}
465
466function lazy_load_img(opts)
467{
468    var _ = $(this);
469    
470    var s = _.attr('src');
471    var ss = _.attr('srcset');
472    var ds = _.attr('data-src');
473    var dss = _.attr('data-srcset');
474    var dss2x = _.attr('data-srcset2x');
475    
476    if(is_2x_display() && dss2x)
477    {
478        dss = dss2x;
479    }
480    
481    if(opts && opts.preload)
482    {
483        var img = new Image();
484        
485        var ss_load = null;
486        
487        if(s && ss && !_.data('iloaded'))
488        {
489            _.data('iloaded', true);
490
491            ss_load = dss ? dss : s;
492            img.src = ss_load;
493        }
494        else if(ds)
495        {
496            img.src = ds;
497        }
498        
499        function img_loaded()
500        {
501            if(ss_load)
502                $(_).attr('srcset', ss_load);
503            
504            else
505                $(_).attr('src', ds);
506        }
507        
508        if(img.complete)
509            img_loaded();
510        else
511            img.onload = img_loaded;
512    }
513    else
514    {
515        if(s && ss && !_.data('iloaded'))
516        {
517            _.data('iloaded', true);
518
519            _.attr('srcset', dss ? dss : s);
520        }
521        else if(ds)
522            _.attr('src', ds);
523    }
524        
525}
526
527function lazy_load_child_imgs(el)
528{
529    $('img[data-src]', el).each(lazy_load_img); 
530    
531    return el;
532}
533
534$.fn.lazy_load_child_imgs = function() 
535{
536    return lazy_load_child_imgs($(this));
537};
538
539$(function() 
540{
541    var appearSelector = '.on-appear-event, .lazy-load-img';
542    
543    if($(appearSelector).length)
544    {
545        function on_appear_el(el)
546        {
547            var func_call = $(el).attr('appear-call-func');
548            
549            if(func_call && typeof(window[func_call]) === 'function')
550            {
551                window[func_call].call(el);
552            }
553            else if($(el).hasClass('lazy-load-img'))
554            {
555                var tag = $(el).prop("tagName");
556                
557                if(tag === 'IMG')
558                    lazy_load_img.call($(el));
559                
560                else
561                {
562                    lazy_load_child_imgs(el);
563                }   
564            }
565            else if($(el).hasClass('youtube-lazy-load'))
566                $(el).attr('src', $(el).attr('data-src'));
567            else if($(el).hasClass('appear-load-module'))
568                module_loader.load($(el).attr('data-module'))
569            else
570            {
571                var dc = $(el).attr('data-cls');
572                    
573                if(dc)
574                    $(el).addClass(dc);
575            }
576        }
577
578        function need_load_el(el, viewBottom) 
579        {
580            var offset = el.getAttribute('data-ll-offset');
581            offset = offset === null ? 256 : (parseFloat(offset) * window.innerHeight);
582            return ($(el).offset().top - offset) <= viewBottom;
583        }
584        
585        function appear_check() 
586        {
587            var items = document.querySelectorAll(appearSelector);
588            var viewBottom = $(window).scrollTop() + window.innerHeight;
589            
590            for (var i = 0; i < items.length; i++) 
591            {
592                var elem = items[i];
593                
594                if (need_load_el(elem, viewBottom)) 
595                {
596                    var el = $(elem);
597
598                    // Êîãäà-òî îíî íå ðàáîòàåò êàê íàäî
599                    el.trigger('on.appear');
600
601                    on_appear_el(el);
602                    
603                    el.removeClass('on-appear-event').
604                            removeClass('lazy-load-img');
605                }
606            }
607        }
608        
609        
610        if($(window).scrollTop() > 0)
611            appear_check();
612        else
613            setTimeout(appear_check, 200);
614
615        $(window).scroll(function(event) 
616        {
617            appear_check();
618        });
619        
620        window.appear_check = appear_check;
621    }
622    
623    $('.good-tile-item.good-has-images:not(.img-loaded)').mouseover(function() {
624        
625        $(this).addClass('img-loaded');
626        
627        $('.item-images img').each(function() 
628        {
629            var mini_img = $(this).attr('data-mini');
630            
631            if(mini_img && mini_img.length)
632                $(this).attr('src', mini_img);
633        });
634    });
635});
636
637function showCallbackForm(call_type = 'phone')
638{
639  
640  switch (call_type) {
641  case 'whatsapp':
642    $("#call_type").val("whatsapp");
643    c_tg = '';
644    c_whatsapp = 'checked';
645    c_phone = '';
646    c_max = '';
647    btn_text = "Íàïèøèòå ìíå â Whatsap";
648    break;
649  case 'phone':
650    $("#call_type").val("phone");
651    c_tg = '';
652    c_whatsapp = '';
653    c_phone = 'checked';
654    c_max = '';
655    btn_text = "Ïîçâîíèòå ìíå";
656    break;
657  case 'tg':
658    $("#call_type").val("tg");
659    c_tg = 'checked';
660    c_whatsapp = '';
661    c_phone = '';
662    c_max = '';
663    btn_text = "Íàïèøèòå ìíå â Telegram";
664    break;   
665  case 'max':
666    $("#call_type").val("max");
667    c_tg = '';
668    c_whatsapp = '';
669    c_phone = '';
670    c_max = 'checked';
671    btn_text = "Íàïèøèòå ìíå â MAX";
672    break;    
673  default:
674    $("#call_type").val("phone");
675    call_type = 'phone';
676    c_phone = 'checked';
677}  
678  
679var site = window.location.hostname;  
680  
681//<img class=whatsapp_radio_img src="//img.mebhome.ru/whatsapp.svg">\  
682  
683  var whatsapp_src = '<div class=whatsapp-callback>\
684          <div><input id=c_phone type=radio name=check onclick="$(\'#call_type\').val(\'phone\');" '+c_phone+'><label for=c_phone>Ïîçâîíèòå ìíå</label></div>\
685          <div class="cb-mess-block">\
686            <div><input id=c_whatsapp type=radio name=check onclick="$(\'#call_type\').val(\'whatsapp\');" '+c_whatsapp+'><label for=c_whatsapp>WhatsApp</label></div>\
687            <div><input id=c_tg type=radio name=check onclick="$(\'#call_type\').val(\'tg\');" '+c_tg+'><label for=c_tg>TG</label></div>\
688            <div><input id=c_max type=radio name=check onclick="$(\'#call_type\').val(\'max\');" '+c_max+'><label for=c_max>MAX</label></div>\
689          </div>\
690          <input type=hidden name=call_type id=call_type value="'+call_type+'">\
691          <input type=hidden name=site value="'+site+'">\
692        </div>';
693  
694    var src = '<form class=callback-form onsubmit="return callbackFromSubmit(this)">' +
695            '<div class="cb-header">' + 
696                'Çàêàç êîíñóëüòàöèè' +
697            '</div>' +
698            '<div class=cb-fields>' + 
699                '<div class=cb-col><div class=cb-field-name>Èìÿ</div><div><input type=text name=name class="cb-input cb-input-name" placeholder="Èâàí"/></div></div>' +
700                '<div class=cb-col><div class=cb-field-name>Òåëåôîí*</div><div><input type=text name=phone required class=cb-input placeholder="8-495-111-11-11"/></div></div>' +
701            '</div>' +
702            '<div class=cb-comment>' + 
703                '<div><div class=cb-field-name>Êîììåíòàðèè</div></div><div><textarea class=cb-input name=msg placeholder="âîïðîñû, óäîáíîå äëÿ çâîíêà âðåìÿ"/></div></div>' +
704            '</div>' +    
705            whatsapp_src +
706            '<div class="cb-footer">' + 
707                    '<input disabled type="submit" class="cb-send subs-send '+call_type+'" value="'+btn_text+'" />' +
708                    '<button type="button" class="cb-cancel" onclick="$.colorbox.close()">Îòìåíèòü</button>' + getConfidentialAgreement() +
709            '</div>' +
710        '</form><style>.cb-send.subs-send.whatsapp{background: #24C744;}</style>';
711
712        function getConfidentialAgreement()
713        {
714            return  '<div class="agreement-wrapper">'+
715                              '<input type="checkbox" class="check-agreement" id="check-agreement" name="check-agreement">'+
716                              '<label for="check-agreement" class="confidential-agreement">Ïîäòâåðäèòå <a href="https://policy.2236055.ru/cookie_policy_txt?d=luxury-textile.ru" target="_blank">ñîãëàñèå</a> íà îáðàáîòêó ïåðñîíàëüíûõ äàííûõ.'+
717                              '</label>'+
718                    '</div>';
719        }
720
721  $.colorbox(
722           { html: src, 
723             closeButton:false,
724             onComplete: function(){
725                $("#c_phone, #c_whatsapp, #c_tg, #c_max").on('click', function (){
726                  
727                  call_type = $("#call_type").val();
728                  
729                  $(".cb-send.subs-send").removeClass("whatsapp call-tg call-max").val("Ïîçâîíèòå ìíå");
730                  
731                  if (call_type == 'whatsapp'){
732                    $(".cb-send.subs-send").addClass("whatsapp").val("Íàïèøèòå ìíå â Whatsapp");
733                  }
734                  else if (call_type == 'tg'){
735                    $(".cb-send.subs-send").addClass("call-tg").val("Íàïèøèòå ìíå â Telegram");
736                  }
737                  else if (call_type == 'max'){
738                    $(".cb-send.subs-send").addClass("call-max").val("Íàïèøèòå ìíå â MAX");
739                  }                  
740                });
741                applyPhoneMaskForInput($('.callback-form input[name="phone"]'));
742                
743                loPdForm($('.cb-send'), $('.callback-form') );
744           }
745         }
746  );
747   
748   return false;        
749}
750
751function callbackFromSubmit(sender)
752{
753    var data = $(sender).serializeArray();
754    
755    var btn = $('.cb-send', sender).prop('disabled', true);
756    
757    data.push({'name': 'ref', 'value': location});
758    data.push({'name': 'ajax', 'value': true });
759    
760    console.log(data);
761    
762    $.post('/shop/callback.php', data, function(res) 
763    {
764        btn.prop('disabled', false);
765        callbackFormStatus(res === 'ok');
766    });
767    
768    return false;
769}
770
771function callbackFormStatus(success, message)
772{
773    if(!message)
774        message = success ? 
775            '<div>Íàøè ñîòðóäíèêè ñâÿæóòñÿ ñ âàìè â áëèæàéøåå âðåìÿ.</div>' : 
776                '<div>Îøèáêà ïðè ñîçäàíèè çàÿâêè :(<br>Ïîïðîáóéòå åùå ðàç.</div>';
777    
778    var src = '<div class=callback-form>' +
779            '<div class="cb-header">' + 
780                (success ? 'Ñïàñèáî çà çàÿâêó!' : 'Îøèáêà') +
781            '</div>' +
782            '<div class=cb-status>' + 
783                (success ? '<div class=cb-status-img-ok></div>' : '<div class=cb-status-img-fail></div>') +
784                message +
785                '<div style="clear:both"></div>' +
786            '</div>' +    
787            '<div class="cb-footer">' + 
788                    '<button type="button" class="btn cb-send" onclick="$.colorbox.close()">Çàêðûòü</button>' +
789            '</div>' +
790        '</div>';
791
792    $.colorbox({ html: src, closeButton:false});
793}
794// Opinions TEST
795$.fn.lazy_load_opinion_slider = function()
796{
797    $(this).each(function()
798    {
799        var _ = $(this);
800        module_loader.load('opinion_slider', function() {
801            _.lazy_load_slider_op({bx_options:{touchEnabled:false, nextSelector:null,prevSelector:null,nextText:'<i></i>',prevText:'',slideWidth:310}}); 
802        });
803    });
804};
805
806$.fn.lazy_load_article_slider = function()
807{
808    
809    $(this).each(function()
810    {
811        var _ = $(this);
812
813        _.on_appear(function() 
814        {
815            module_loader.load('bx_slider', function() 
816            {
817              
818                _.lazy_load_slider_art({bx_options:
819                {
820                    nextSelector:null,
821                    prevSelector:null,
822                    nextText:'<i></i>',
823                    prevText:'',
824                    pager:false,
825                    slideWidth:247,
826                    maxSlides:10,
827                    slideMargin:5,
828                    minSlides: 4,
829                    infiniteLoop:false
830                }});
831            });
832        });
833    });
834};
835
836$.fn.lazy_load_slider_op = function(opts)
837{
838    opts = $.extend({}, {size: -1, bx_options: {}, setup:null}, opts || {})
839    
840    var idgoods_arr = [];
841    
842    var sliders = $(this).each(function() 
843    {
844        var idgoods = $(this).attr('data-idgoods');
845
846        if(idgoods)
847        {
848            $(this).attr('data-idgoods', null);
849            idgoods_arr.push(idgoods);
850        }
851    });
852    
853    if(idgoods_arr.length)
854    {
855        $.get('/good_tile_slider_ajax.php', {idgoods_arr: idgoods_arr, size: opts.size}, function(res) 
856        {
857            if(res)
858            {
859                var res_items = res.split('###@@@###');
860
861                for(var key in res_items)
862                {
863                    var slider = sliders.eq(key);
864                    
865                    if(slider.hasClass('sert-block-lazy-load'))
866                    {
867                        slider.html(res_items[key]);
868                        
869                        $('.sertblock > a', slider).click(function() {
870                            return show_file_popup_viewer(this);
871                        });
872                    }
873                    else
874                    {
875                        $('ul.good-container', slider).html(res_items[key]);
876
877                        $(slider).good_tile_slider_init_op(opts.bx_options);
878                    }
879                }
880            }
881        });
882    }
883};
884
885$.fn.good_tile_slider_init_op = function(in_options)
886{
887    function initialize()
888    {
889        var container = $(this);
890        
891        container.addClass('initialized');
892        
893        var options = 
894        {
895            minSlides: 2,
896            maxSlides: 4,
897            slideWidth: 315,
898            pager: false,
899            infiniteLoop: false,
900            hideControlOnEnd: true,
901            nextSelector: $('.arrows-nav', container), nextText: '',
902            prevSelector: $('.arrows-nav', container), prevText: ''
903        };
904        
905        options = $.extend(options, in_options || {});
906        
907        var slider = $('.good-tile-slider-block-slider', container);
908        
909        if(slider.length === 0)
910        {
911            slider = $('.good-container', container);
912        }        
913        
914        if($('> div, > li', slider).length <= 3)
915            options.controls = false;
916        
917        slider.bxSlider(options);
918    }
919    
920    module_loader.load(window.___good_slider_version || 'good_slider', function() 
921    {
922        $(this).not('.initialized').each(initialize);
923    }, this);
924};
925
926$.fn.lazy_load_slider_art = function(opts)
927{
928    opts = $.extend({}, {size: -1, bx_options: {}, setup:null}, opts || {})
929    
930    var idgoods_arr = [];
931    
932    var sliders = $(this).each(function() 
933    {
934        var idgoods = $(this).attr('data-idgoods');
935
936        if(idgoods)
937        {
938            $(this).attr('data-idgoods', null);
939            idgoods_arr.push(idgoods);
940        }
941    });
942    
943    if(idgoods_arr.length)
944    {
945        $.get('/good_tile_slider_ajax.php', {idgoods_arr: idgoods_arr, size: opts.size}, function(res) 
946        {
947            if(res)
948            {
949                var res_items = res.split('###@@@###');
950
951                for(var key in res_items)
952                {
953                    var slider = sliders.eq(key);
954                    
955                    if(slider.hasClass('sert-block-lazy-load'))
956                    {
957                        slider.html(res_items[key]);
958                        
959                        $('.sertblock > a', slider).click(function() {
960                            return show_file_popup_viewer(this);
961                        });
962                    }
963                    else
964                    {
965                        $('ul.good-container', slider).html(res_items[key]);
966
967                        $(slider).good_tile_slider_init_art(opts.bx_options);
968                    }
969                }
970            }
971        });
972    }
973};
974
975$.fn.good_tile_slider_init_art = function(in_options)
976{
977    function initialize()
978    {
979        var container = $(this);
980        
981        container.addClass('initialized');
982        
983        var options = 
984        {
985            minSlides: 2,
986            maxSlides: 4,
987            slideWidth: 315,
988            pager: false,
989            infiniteLoop: false,
990            hideControlOnEnd: true,
991            nextSelector: $('.arrows-nav', container), nextText: '',
992            prevSelector: $('.arrows-nav', container), prevText: ''
993        };
994        
995        options = $.extend(options, in_options || {});
996        
997        var slider = $('.good-tile-slider-block-slider', container);
998        
999        if(slider.length === 0)
1000        {
1001            slider = $('.good-container', container);
1002        }        
1003        
1004        if($('> div, > li', slider).length <= 3)
1005            options.controls = false;
1006        
1007        slider.bxSlider(options);
1008    }
1009    
1010    module_loader.load(window.___good_slider_version || 'good_slider', function() 
1011    {
1012        $(this).not('.initialized').each(initialize);
1013    }, this);
1014};
1015
1016// End Opinions
1017
1018$.fn.good_tile_slider_init = function(in_options)
1019{
1020    function initialize()
1021    {
1022        var container = $(this);
1023        
1024        container.addClass('initialized');
1025        
1026        var options = 
1027        {
1028            minSlides: 2,
1029            maxSlides: 4,
1030            slideWidth: 315,
1031            pager: false,
1032            infiniteLoop: false,
1033            touchEnabled: false,
1034            hideControlOnEnd: true,
1035            nextSelector: $('.arrows-nav', container), nextText: '',
1036            prevSelector: $('.arrows-nav', container), prevText: ''
1037        };
1038        
1039        options = $.extend(options, in_options || {});
1040        
1041        $('.good-tile-slider-block-slider', container)
1042            .addClass('catalog-root').bxSlider(options);
1043    }
1044    
1045    module_loader.load('good_slider', function() {
1046        $(this).not('.initialized').each(initialize);
1047    }, this);
1048};
1049
1050$.fn.lazy_load_slider = function(opts)
1051{
1052    opts = $.extend({}, {size: -1}, opts || {})
1053    
1054    var idgoods_arr = [];
1055    
1056    var sliders = $(this).each(function() 
1057    {
1058        var idgoods = $(this).attr('data-idgoods');
1059
1060        if(idgoods)
1061        {
1062            $(this).attr('data-idgoods', null);
1063            idgoods_arr.push(idgoods);
1064        }
1065    });
1066    
1067    if(idgoods_arr.length)
1068    {
1069        $.get('/good_tile_slider_ajax.php', {idgoods_arr: idgoods_arr, size: opts.size}, function(res) 
1070        {
1071            if(res)
1072            {
1073                var res_items = res.split('###@@@###');
1074
1075                for(var key in res_items)
1076                {
1077                    var slider = sliders.eq(key);
1078                    
1079                    var slider_content = res_items[key];
1080                    
1081                    if(slider_content && slider_content.length)
1082                    {
1083                        $('ul.good-container', slider).html(res_items[key]);
1084
1085                        $(slider).good_tile_slider_init();
1086                    }
1087                    else
1088                        slider.remove();
1089                }
1090            }
1091        });
1092    }
1093};
1094
1095function showOpinionForm(idgood)
1096{
1097    var idgood = idgood || $('.vp').attr('data-id');
1098
1099    $.post('/shop/get_opinion.php', { idgood : idgood, 'new_form': true }, function(form_data)
1100    {
1101        if($('#opinion-modal').length)
1102            $('#opinion-modal').remove();
1103
1104        $('body').append(form_data);
1105        
1106        var modal = $('#opinion-modal');
1107        
1108        modal.modal();
1109
1110        if($('#recapcha-script-opinion').length)
1111            opinionRecapchaLoaded();
1112        else
1113            $('body').append("
vendor: 153 bytes, line 1113
1113<script id=recapcha-script-opinion src='https://www.google.com/recaptcha/api.js?onload=opinionRecapchaLoaded&render=explicit&hl=ru' async defer></script>
1113");
1114
1115        var rating_val =  $('#opinion-rating', modal);
1116        var rating_stars =  $('.opinion-rating .star', modal);
1117
1118        function restoreRating()
1119        {
1120            rating_stars.removeClass('on');
1121
1122            if(rating_val.val() > 0)
1123            {
1124                var rating = rating_val.val() - 1;
1125                
1126                rating_stars.eq(rating).addClass('on')
1127                    .prevAll().addClass('on');
1128            }
1129        }
1130
1131        rating_stars.hover(function() {
1132
1133            rating_stars.removeClass('on');
1134            
1135            $(this).addClass('on')
1136                .prevAll().addClass('on');
1137
1138        }, function() {
1139
1140            restoreRating()
1141
1142        }).click(function() {
1143
1144            $('#rating-error', modal).remove();
1145            rating_stars.removeClass('grey');
1146            var rating = rating_stars.index(this);
1147            rating_val.val(rating + 1);
1148            restoreRating();
1149        });
1150
1151        restoreRating();
1152//
1153//        $('.opinion-send', modal).click(function() {
1154//
1155//            //óäàëÿåì required ñ ïîëÿ îòçûâà åñëè èìåþòñÿ çàãðóæåííûå ôàéëû
1156//            if( $('.file-uploader .op_file').length > 1){
1157//              $(".opinion-desc").removeAttr("required");
1158//              $(".opinion-desc").removeClass("error");
1159//              $("#descr-error").remove();                    
1160//            }
1161//
1162//            var validator = $("form", modal).validate();
1163//
1164//            $.validator.messages.required = 'Çàïîëíèòå ïîëå';
1165//
1166//            var validationRes = validator.form();
1167//
1168//            if($('#opinion-rating', modal).val() == 0)
1169//            {
1170//                $('<label id="rating-error" class="error">Îöåíèòå òîâàð</label>').insertAfter($('#opinion-rating', modal));
1171//            }
1172//            else if(validationRes)
1173//            {
1174//              
1175//              var fd = new FormData;
1176//
1177//              var data = $('#opinion_form').serialize();
1178//
1179//              $(".op_file").each(function(index){
1180//                
1181//                  fd.append('img-'+index, $(this).prop('files')[0]);
1182//                  
1183//              }) 
1184//
1185//              $.ajax({
1186//                  url: '/shop/get_opinion.php?' + data + '&action=set_opinion',
1187//                  data: fd,
1188//                  processData: false,
1189//                  contentType: false,
1190//                  type: 'POST',
1191//                  success: function (res) {
1192//
1193//                    $('.modal-body', modal).html('<div class="res-succsess">' + res.message + '</div>');
1194//                    $('.modal-footer', modal).hide();
1195//                    setTimeout(function() { $('#opinion-modal', modal).modal('hide'); }, 3000);                  
1196//
1197//                  }
1198//              });
1199//
1200//              
1201//              return false;                            
1202//            }
1203//
1204//        });
1205
1206    });
1207}
1208
1209function showGoodQuestionForm(idgood){
1210  
1211  title = "Çàäàòü âîïðîñ";
1212  
1213  var site = window.location.hostname;  
1214
1215  window.popup_was_shown = true;
1216
1217      var src = '<form class=callback-form onsubmit="return goodQuestionFormSubmit(this)">' +
1218              '<div class="cb-header">' + 
1219                  (title || 'Çàêàç çâîíêà êîíñóëüòàíòà') +
1220              '</div>' +
1221              '<div class=cb-fields>' + 
1222              '<input type=hidden name=site value="'+site+'">'+              
1223              '<input type=hidden name=idgood value="'+idgood+'">'+              
1224              '<input type=hidden name=action value="set_question">'+              
1225                  '<div class=cb-col><div class=cb-field-name>Òåëåôîí</div><div><input type=text name=phone class=cb-input placeholder="8-495-111-11-11"/></div></div>' +
1226                  '<div class=cb-col><div class=cb-field-name>Email<span class="red">*</span></div><div><input type=text name=email class=cb-input required placeholder="Àäðåñ ýëåêòðîííîé ïî÷òû"/></div></div>' +
1227              '</div>' +
1228              '<div class=cb-comment>' + 
1229                  '<div><div class=cb-field-name>Âàø âîïðîñ <span class="red">*</span></div></div><div><textarea class=cb-input required name=descr placeholder=""/></div></div>' +
1230              '</div>' +    
1231              '<div class="cb-footer">' + 
1232                      '<input type="submit" class="cb-send" value="Îòïðàâèòü" />' +
1233                      '<button type="button" class="cb-cancel" onclick="$.colorbox.close()">Îòìåíèòü</button>' +
1234                      '<span class=confidential-agreement>' +
1235                          'Íàæèìàÿ íà êíîïêó, âû äàåòå <a href="/Konfidencialnost-i-zaschita-personalnyh-dannyh.html" target="_blank">ñîãëàñèå</a> íà îáðàáîòêó ñâîèõ ïåðñîíàëüíûõ äàííûõ.' +
1236                      '</span>' +
1237              '</div>' +
1238          '</form>';
1239
1240     $.colorbox({ html: src, closeButton:false});
1241
1242     return false;   
1243}
1244
1245function goodQuestionFormSubmit(sender)
1246{
1247    var data = $(sender).serialize();
1248    
1249    var btn = $('.cb-send', sender).prop('disabled', true);
1250    
1251    //prevent double submit
1252    //$(".callback-form").find("input[type=text], input[type=tel], textarea").val("");
1253    
1254    $.post('//spim.ru/shop/good_question.php', data, function(res) 
1255    {
1256        btn.prop('disabled', false);
1257        callbackFormStatus(res.success, res.message);
1258    });
1259    
1260    return false;
1261}
1262
1263function openYTBox(youtube_id){
1264  
1265  $.colorbox({
1266    href: 'https://www.youtube.com/embed/'+youtube_id+'?autoplay=1',
1267    width: '1024px',
1268    height: '768px',
1269    iframe: true
1270  });
1271  
1272}
1273
1274function article_data_popup(url) 
1275{
1276  
1277  window.popup_was_shown = true;
1278  
1279    if(url){
1280  
1281        $.colorbox({ 
1282          onOpen: function()
1283          {
1284           $("#colorbox").addClass("vp_box1");
1285          },
1286          onComplete : function() 
1287          { 
1288             $.colorbox.resize();
1289
1290             $('body').css({ overflow: 'auto' });
1291             
1292             on_all_img_loaded($("#cboxLoadedContent img"), function()
1293             {
1294                 $.colorbox.resize();
1295             });
1296          },
1297          speed: 200,
1298          scrolling: false,
1299          initialWidth: 900,
1300          initialHeight: 500,
1301          href:url,
1302          top: 10,
1303          innerWidth: 900, 
1304          opacity: 0.25});
1305        
1306    }
1307    
1308    return false;
1309}
1310
1311function applyPhoneMaskForInput(input)
1312{
1313    function keydown_clb(event)
1314    {
1315        if(event.key && '0123456789'.indexOf(event.key) >= 0)
1316        {
1317            var val = $(this).val();
1318
1319            var n = val ? val.match(/\d/g) : null;
1320
1321            if(n && n.length === 11 && n[1] === '8' && n[2] !== '8')
1322            {
1323                val = '+7 (' + n[2] + n[3] + n[4] + ') ' + n[5] + n[6] + n[7] +
1324                    '-' + n[8] + n[9] + '-' + n[10];
1325
1326                $(this).val(val); 
1327            }
1328        }
1329    }
1330    
1331    module_loader.load('inputmask', function()
1332    {
1333        $(input).inputmask('+7(999)-999-99-99');
1334        
1335        $(input).keydown(keydown_clb);
1336    });
1337}
1338
1339/*
1340function vp_img_popup($url, opts)
1341{
1342    opts = $.extend({}, {w:800, h:600},
1343        typeof opts === 'object' ? opts : {})
1344
1345    $(".reply-img-group").colorbox({ href:$url, innerWidth:opts.w, innerHeight:opts.h, previous: "<<<", next: ">>>", rel: "group1" });
1346
1347    return false;;
1348}
1349*/
1350$(function() {
1351    $("a.reply-img-group").colorbox({ title: function(){
1352        var url = $(this).attr('href');
1353        return '<a href="' + url + '" target="_blank">îòêðûòü â íîâîì îêíå</a>';
1354      }, innerWidth:800, innerHeight:600
1355    });
1356    
1357    if (navigator.cookieEnabled && !$.cookie('cookie_policy') && window.location.hostname.indexOf('luxury-textile.ru') >= 0 ) {
1358        $.ajax({
1359            url: "/shop/cookies_policy.php"
1360        }).done(function(data) {
1361            $('body').append(data);
1362        });
1363    }
1364    
1365    if (navigator.cookieEnabled && !$.cookie('cookie_policy') ) {
1366        console.log('cookies_policy');
1367        $.ajax({
1368            url: "https://policy.2236055.ru/cookie_policy"
1369        }).done(function(data) {
1370            $('body').append(data);
1371        });
1372    }
1373    
1374    function tgLabel()
1375    {
1376        
1377        var img = $('.article_text center:first img:first');
1378        var art_img_h = $(img).height();        
1379
1380        if(art_img_h > 150 || art_img_h == 0)
1381        { 
1382            art_img_h = 500;
1383            $(img).after('<a target="_blank" href="https://t.me/luxury_textile_ru" class="tg-label">LuxuryTextile</a>');
1384        }
1385    }
1386    
1387    if(window.location.hostname.indexOf('luxury-textile.ru') != -1)
1388        tgLabel();
1389    
1390});
1391
1392$.fn.on_appear = function(clb) {
1393    $(this).each(function() {
1394        if ($(this).hasClass('on-appear-event'))
1395            $(this).on('on.appear', clb);
1396        else
1397            clb.call(this);
1398    });
1399}
1400
1401
1402function update_vp_office_delivery_block()
1403{
1404    var data = window.__vp_office_delivery;
1405
1406    if(data)
1407    {
1408        var deliv_block = $('#vp-delivery-block, #vp-dn-delivery-block');
1409
1410        var block = deliv_block.find('.vp-deliv-date');
1411
1412        block.each(function()
1413        {
1414            var idregion = parseInt($(this).attr('data-idregion'));
1415
1416            var vp_size = $('.vp-size-pannel select[name="size"], #vp-size-select');
1417
1418            var idsize = -1;
1419
1420            if(vp_size.length)
1421                idsize = parseInt(vp_size.val());
1422
1423            var idcolor = parseInt($('.vp-color-pannel select[name="color"]').val() || 0);
1424
1425            var avail = (data.avail[idsize] || {})[idcolor];
1426
1427            if(avail)
1428            {
1429                var date = ((data.dates || {})[idregion] || {})[avail.id];
1430
1431
1432                if(date)
1433                {
1434                    date.nice_format2 = date.nice_format2.toLowerCase();
1435
1436                    $(this).parent().show();
1437                    $(this).show().html('<nobr title="Óêàçàíà îðèåíòèðîâî÷íàÿ äàòà äîñòàâêè, òî÷íàÿ äàòà ' +
1438                        'áóäåò íàçíà÷åíà ïîñëå îáðàáîòêè çàêàçà ìåíåäæåðîì">' + date.nice_format2 + '</nobr>');
1439                    $(this).attr('data-buy-button-date', date.nice_format_buy_button);
1440                }
1441                else {
1442                    $($(this).hide().parents('.vp-deliv-hide-when-outstore')[0]).parent().hide();
1443                }
1444            }
1445            else {
1446                $($(this).hide().parents('.vp-deliv-hide-when-outstore')[0]).parent().hide();
1447                $($(this).hide().parents('span')[0]).hide();
1448            }
1449        });
1450    }
1451}
1452
1453function init_vp_office_delivery(data)
1454{
1455    window.__vp_office_delivery = data;
1456
1457    update_vp_office_delivery_block();
1458}
1459
1460function createPickpointMapPopup()
1461{
1462    var src =
1463        '<div class="modal fade custom-modal vp-color-select-dialog" id="pp-modal" tabindex="-1"> \
1464            <div class="modal-dialog" role="document"> \
1465                <div class="modal-content"> \
1466                    <div class="modal-header"> \
1467                            <div class="modal-title">Ïóíêòû ñàìîâûâîçà</div> \
1468                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"></button> \
1469                    </div> \
1470                    <div class="modal-body" style="text-align: center; padding: 0"> \
1471                        <div id="ya-pickpoint-map" style="position: relative;height: 600px;"> \
1472                            <img class="pp-map-loading-img" style="position:absolute;top:0;left:0;right:0;bottom:0;margin:auto" src="/i5/ajax-loader.gif"/> \
1473                        </div> \
1474                    </div> \
1475                </div> \
1476            </div> \
1477        </div>';
1478
1479    $('body').append(src);
1480
1481    return $('#pp-modal');
1482}
1483
1484function openVendorInfoPopup(vendor_id) {
1485    let url = `//m.spim.ru/shop/vendor_info.php?vendor_id=${vendor_id}&action=get_vendor_info`;
1486
1487    $.get(url, function (res) {
1488        if (res) {
1489            let vendor = JSON.parse(res)['vendor'];
1490            module_loader.load('module_popup', function () {
1491                let modal;
1492
1493                let body = `<p>
1494                    Áðåíä:&nbsp;<b itemprop="brand">${vendor['name']}</b><br>
1495                    Ñòðàíà:&nbsp;${vendor['country']}
1496                </p>`;
1497                if (vendor['logo']) {
1498                    body += `<p><img src="${vendor['logo']}" style="width: unset;mix-blend-mode: multiply; float: none; max-width: 100%;"/></p>`
1499                }
1500                if (vendor['comment']) {
1501                    body += `<p>${vendor['comment']}</p>`;
1502                }
1503
1504                if (vendor['descr']) {
1505                    body = vendor['descr'];
1506                    if (vendor['logo']) {
1507                        body = `<p><img src="${vendor['logo']}" style="display: block; margin: auto; width: unset;mix-blend-mode: multiply; float: none; max-width: 100%;"/></p>` + body;
1508                    }
1509                }
1510
1511                body = `<div class="vendor-popup-description">${body}</div>`;
1512
1513                modal = new Modal({
1514                    name: 'vendor-modal',
1515                    title: vendor.name,
1516                    body: body,
1517                    show: {
1518                        footer: false,
1519                    }
1520                });
1521
1522                modal.createModal();
1523            });
1524        }
1525    })
1526}
1527
1528function openPhotoSwipe(img_selector, slide_change)
1529{
1530    var carousel = $(this);
1531
1532    function addPhotoswipeHtml() {
1533        $('#vp-photo-swipe').remove();
1534        var html = "<div class='pswp' id='vp-photo-swipe' tabindex='-1' role='dialog' aria-hidden='true' style='display:none'>\
1535            <div class='pswp__bg'></div>\
1536            <div class='pswp__scroll-wrap'>\
1537                <div class='pswp__container'>\
1538                    <div class='pswp__item'></div>\
1539                    <div class='pswp__item'></div>\
1540                    <div class='pswp__item'></div>\
1541                </div>\
1542                <div class='pswp__ui pswp__ui--hidden'>\
1543                    <div class='pswp__top-bar'>\
1544                        <div class='pswp__counter'></div>\
1545                        <button class='pswp__button pswp__button--close' title='Close (Esc)'></button>\
1546                        <button class='pswp__button pswp__button--share' title='Share'></button>\
1547                        <button class='pswp__button pswp__button--fs' title='Toggle fullscreen'></button>\
1548                        <button class='pswp__button pswp__button--zoom' title='Zoom in/out'></button>\
1549                        <div class='pswp__preloader'>\
1550                            <div class='pswp__preloader__icn'>\
1551                                <div class='pswp__preloader__cut'>\
1552                                    <div class='pswp__preloader__donut'></div>\
1553                                </div>\
1554                            </div>\
1555                        </div>\
1556                    </div>\
1557                    <div class='pswp__share-modal pswp__share-modal--hidden pswp__single-tap'>\
1558                        <div class='pswp__share-tooltip'></div> \
1559                    </div>\
1560                    <button class='pswp__button pswp__button--arrow--left' title='Previous (arrow left)'>\
1561                    </button>\
1562                    <button class='pswp__button pswp__button--arrow--right' title='Next (arrow right)'>\
1563                    </button>\
1564                    <div class='pswp__caption'>\
1565                        <div class='pswp__caption__center'></div>\
1566                    </div>\
1567                </div>\
1568            </div>\
1569        </div>";
1570        $('body').append(html);
1571    }
1572
1573    addPhotoswipeHtml();
1574    
1575    var psElement = $('#vp-photo-swipe');
1576
1577    if(!img_selector)
1578        img_selector = $('#vp-carousel img.img-responsive');
1579
1580    function getGalleyImages()
1581    {
1582        var index = 0;
1583        var activeID = 0;
1584        var slides = new Array();
1585        
1586        $(img_selector).each(function() 
1587        {
1588            var img = $(this);
1589
1590            var width = img.prop('naturalWidth');
1591            var height = img.prop('naturalHeight');
1592
1593            var img_src = img.attr('data-img-src') || img.attr('data-src') || img.attr('src');
1594
1595            if( $(img).hasClass('gal-video') )
1596            {
1597                
1598                slides.push({w: 720, h:540, title: img.attr('alt'), 
1599                    idcolor: $(this).data('idcolor'), src: img.attr('poster'), 
1600                    idcolor: $(this).data('idcolor'), img_src: img.attr('src'), 
1601                    vid_src: img.attr('src'), video: 1});                  
1602                
1603                if($(this).parent().hasClass('active') || 
1604                    $(this).parent().parent().hasClass('active') || 
1605                    $(this).hasClass('active') || 
1606                    $(this).closest('div.image-map').parent().parent().hasClass('active') )
1607                {
1608                    activeID = index;
1609                }
1610
1611                index++;                
1612
1613                return;
1614            }
1615
1616            slides.push({w: width, h:height, img_src: img_src, src: img.attr('data-src') || img.attr('src')});
1617            
1618            if($(this).parent().hasClass('active'))
1619                activeID = index;
1620            
1621            index++;
1622        });
1623
1624        return {slides: slides, index: parseInt(activeID)};
1625    }
1626    
1627    // PS video integration
1628    function removeVideo(psElement) {
1629        
1630        if ($('.videoHolder', psElement).length > 0) { 
1631            if ($('#video', psElement).length > 0) {
1632                $('video', psElement)[0].pause();
1633                $('video', psElement)[0].src = "";
1634                $('.videoHolder').remove();
1635                $('.pswp__img').css('visibility','visible');
1636            } else {
1637                $('.videoHolder').remove();
1638            }
1639        }
1640    }    
1641        
1642    function addVideo(item) {
1643        
1644        var videofile = item.img_src;
1645        
1646        item.w = 720;
1647        item.h = 540;
1648        
1649        var v = $('<div />', {
1650            class: 'videoHolder',
1651            css: ({'position': 'absolute', 'width': item.w, 'height': item.h})
1652
1653        });
1654        v.one('click touchstart', (function () {
1655            var playerCode = '<video id="video" width="' + item.w + '" height="' + item.h + '" autoplay controls>' +
1656                    '<source src="' + videofile + '" type="video/mp4"></source>' +
1657                    '</video>';
1658            $(this).html(playerCode);
1659            $('.pswp__img').css('visibility', 'hidden');
1660            $('.pswp__error-msg').css('visibility', 'hidden');
1661
1662        }));
1663        v.appendTo('.pswp__scroll-wrap');
1664        $(v).trigger('click');
1665    }
1666
1667    function updateVideoPosition(o) {
1668//        var item = o.currItem;
1669//        var vp = o.viewportSize;
1670//        var top = (vp.y - item.h)/2;
1671//        var left = (vp.x - item.w)/2;
1672//        console.log({position:'absolute',top:top, left:left});
1673//        $('.videoHolder').css({position:'absolute',top:top, left:left});
1674//        console.log(vp);
1675//        console.log(left);
1676        $('.videoHolder').css({margin:'10% auto 0 auto',position:'relative'});
1677    }    
1678    // End PS video integration
1679    
1680    if(typeof(img_selector) === 'object' && img_selector.slides)
1681        var images = img_selector;
1682    else
1683        var images = getGalleyImages();
1684
1685
1686    var pswpElement = psElement.show().get(0);
1687    
1688    var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, images.slides, {index:images.index, history: false, focus: false, shareEl: false});
1689    
1690    if(slide_change || 0)
1691    {
1692        gallery.listen('afterChange', function() { 
1693            carousel.carousel(gallery.getCurrentIndex());
1694        });
1695    }
1696    
1697    gallery.listen('gettingData', function(index, item) {
1698
1699        if(item.img_src !== null)
1700        {
1701            var img = new Image();
1702
1703            img.onload = function() 
1704            {
1705                item.w = this.width; 
1706                item.h = this.height;
1707                item.src = this.src;
1708                
1709                item.img_src = null;
1710
1711                gallery.invalidateCurrItems();
1712                gallery.updateSize(true);
1713            };
1714
1715            img.src = item.img_src;
1716        }
1717    });
1718
1719    function detectVideo(gallery) {
1720        
1721        var src = gallery.currItem.src;
1722        
1723        if (src && src.indexOf('video')>= 0) {
1724            
1725            addVideo(gallery.currItem);
1726            updateVideoPosition(gallery);
1727        }
1728    }
1729
1730    gallery.listen('afterChange', function() {
1731        detectVideo(gallery);
1732    }); 
1733    
1734    gallery.listen('beforeChange', function() {
1735        removeVideo(pswpElement);
1736     });
1737    gallery.listen('resize', function() {
1738        if ($('.videoHolder').length > 0) updateVideoPosition(gallery);
1739    });
1740    gallery.listen('close', function() {
1741        removeVideo(pswpElement);
1742    });
1743    
1744    
1745
1746    var listener = function (event) {
1747        if (event.deltaY < 0)
1748        {
1749            //console.log('scrolling up');
1750            gallery.next();
1751        }
1752        else if (event.deltaY > 0)
1753        {
1754            //console.log('scrolling down');
1755            gallery.prev();
1756        }
1757    };
1758
1759    window.addEventListener('wheel', listener, false);
1760    gallery.listen('close', function() { window.removeEventListener('wheel', listener, false); });
1761
1762    gallery.init();
1763    return gallery;
1764}
1765
1766function loPdForm(button, form, input_name = '.cb-input-name')
1767{
1768  console.log(button);
1769  console.log(form);
1770  
1771  $(form).on('submit', function(e) {
1772     if($( 'input[class^="check-agreement"]:checked', form).length === 0) {
1773        $(button, form).prop('disabled', true);
1774        e.preventDefault();
1775     }
1776  });
1777
1778  $('#check-agreement', form).on('change', function(e) {
1779    var checked = $(this).is(":checked");
1780
1781    if(checked)
1782      $(button, this).prop('disabled', false);
1783    else
1784      $(button, this).prop('disabled', true);
1785
1786  });
1787
1788  $(input_name, form).on('input', function(){
1789    this.value = this.value.replace(/\s/g, '')
1790  });
1791
1792};   

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.