PageSourceSearch

https://www.lustrof.ru/wa-data/public/shop/plugins/cityselect/js/frontend_65002400c1518.js

js lustrof.ru collected 2026-10-04 09:08:28 UTC 31,734 bytes, 946 lines download raw bytes

1/**
2 * Выбор города
3 *
4 * @class shopCityselectFrontend
5 *
6 * @global shop_cityselect
7 *
8 * @function onSetCity - callback функция для изменения пришедших данных
9 *
10 * @event cityselect__set_city - вызывается после смены города
11 *
12 * @example
13 *
14 * //Изменение массива данных перед обновлением данных в корзине и оформление заказа
15 * shop_cityselect.onSetCity = function(date){ ... ; return data}
16 *
17 * //Свои действия при изменение города
18 * $(document).on('cityselect__set_city', function (event, data) {...});
19 *
20 */
21function shopCityselectFrontend() {
22
23    var that = this;
24
25    that.token = '';
26    that.url = '';
27    that.lib = '';
28    that.bounds = 'city';
29
30    //отключение автоопределения
31    that.disable_auto = 0;
32
33    that.show_notifier = 'auto';
34
35    that.$notifiers = null;
36    that.notifier_type = 'notifier';
37    //modal - для разработки, если установлен bootstrap 4
38
39    that.is_open_modal = false;
40    that.modal_type = false;
41    that.remodal_instance = null;
42
43    that.is_detect = false;
44    that.by_detect = false;
45
46    //Включать подсказки в формах адреса
47    that.in_checkout = true;
48
49    //Оформление заказа в корзине
50    that.in_order = false;
51
52    //Включать подсказки в произвольных формах
53    that.in_custom_form = '.wa-signup-form-fields,.quickorder-form,#storequickorder .wa-form';
54    that.in_custom_city = '';
55
56    //Интеграция с плагином dp
57    that.plugin_dp = false;
58    that.is_redirecting = false;
59
60    //Текущая локация
61    that.location = null;
62
63    that.find = {
64        country: '[name$="country]"]',
65        region: '[name$="region]"]',
66        city: '[name$="city]"]',
67        zip: '[name$="zip]"]',
68        street: '[name$="street]"]'
69    };
70
71    that.save_street = null;
72
73    that.init = function (token, url, lib, bounds, show_notifier, in_checkout, plugin_dp, disable_auto) {
74        that.token = token;
75        that.url = url;
76        that.lib = lib;
77        that.bounds = bounds;
78        that.show_notifier = show_notifier;
79        that.in_checkout = !!in_checkout;
80        that.plugin_dp = !!plugin_dp;
81        that.disable_auto = !!disable_auto;
82        if (that.show_notifier == 'force') {
83            $(document).ready(function () {
84                that.showNotifiers();
85            })
86        }
87
88        $(document).ready(function () {
89
90            if (that.in_checkout) {
91                that.initWaAddress();
92            }
93
94            if (that.in_custom_form || that.in_custom_city) {
95                setInterval(function () {
96                    that.initWaCustom();
97                }, 500);
98                that.initWaCustom();
99            }
100
101            that.themeSupport();
102        });
103
104        if (that.plugin_dp) {
105
106            //Перехватываем вызов окна выбора города
107            $(document).on('click', '.js-dp-city-select', function (e) {
108                e.preventDefault();
109                e.stopImmediatePropagation();
110                that.changeCity();
111                return false;
112            });
113        }
114
115    };
116
117
118    that.initStreet = function ($street, $city, $postcode, $region) {
119
120        //выясняем ограничения
121        var locations = {};
122        if (!!that.location.constraints_street) {
123            locations.kladr_id = that.location.constraints_street;
124        } else {
125            if ($city.length) {
126                locations.city = String($city.val()).trim();
127            }
128
129            if ($region && $region.length) {
130                locations.kladr_id = $region.val();
131            }
132        }
133
134        $street.suggestions({
135            token: that.token,
136            type: "ADDRESS",
137            scrollOnFocus: false,
138            constraints: {
139                label: '',
140                locations: locations
141            },
142            restrict_value: true,
143            onSelect: function onSelect(suggestion) {
144
145                if (suggestion.data.postal_code && $postcode.length) {
146                    $postcode.val(suggestion.data.postal_code);
147                }
148
149                //Смена города (актуально для городов регионов)
150                if (suggestion.data.settlement) {
151                    if (suggestion.data.settlement != $city.val()) {
152                        $city.val(suggestion.data.settlement);
153                        that.updateStreetConstraints(suggestion, $street);
154                        that.setCity(suggestion.data, $city);
155                    }
156                } else if (suggestion.data.city) {
157                    if (suggestion.data.city != $city.val()) {
158                        $city.val(suggestion.data.city);
159                        that.updateStreetConstraints(suggestion, $street);
160                        that.setCity(suggestion.data, $city);
161                    }
162                }
163
164                $street.change();
165            }
166        });
167    };
168
169    that.initCity = function ($city) {
170
171        $city.addClass('i-cityselect__custom-city--init');
172
173        if ($city.length) {
174
175            $city.suggestions({
176                token: that.token, type: "ADDRESS", hint: false, bounds: that.bounds, constraints: {label: ''},
177                scrollOnFocus: false,
178                formatSelected: function (suggestion) {
179                    return suggestion.data.settlement ? suggestion.data.settlement : suggestion.data.city;
180                },
181                onSelect: function (suggestion) {
182                    if (!$city.data('cityselect-not-set')) {
183                        that.by_detect = false;
184                        that.setCity(suggestion.data);
185                    }
186                }
187            });
188        }
189    };
190
191    that.updateStreetConstraints = function (suggestion, $street) {
192        var sgt = $street.suggestions();
193        if (sgt) {
194
195            var locations = {};
196
197            //Ограничение по населенному пункту
198            if (suggestion.data.settlement) {
199                locations.kladr_id = suggestion.data.settlement_kladr_id;
200            } else {
201                locations.kladr_id = suggestion.data.city_kladr_id;
202            }
203
204            sgt.setOptions({
205                constraints: {
206                    locations: locations
207                }
208            });
209
210            sgt.fixData();
211        }
212    };
213
214    that.initAddress = function ($address) {
215        $address.addClass('i-cityselect__wa--init');
216
217        var $country = $address.find(that.find.country);
218        var $city = $address.find(that.find.city);
219        var $street = $address.find(that.find.street);
220        var $postcode = $address.find(that.find.zip);
221        var $region = $address.find(that.find.region);
222
223        //Присутсвует город
224        if ($city.length) {
225
226            var $city_params = {
227                token: that.token, type: "ADDRESS", hint: false, bounds: that.bounds, constraints: {label: ''},
228                formatSelected: function (suggestion) {
229                    return suggestion.data.settlement ? suggestion.data.settlement : suggestion.data.city;
230                },
231                onSelect: function (suggestion) {
232
233                    //Поле регион может меняться
234                    $region = $city.closest('.i-cityselect__wa--init').find(that.find.region);
235                    if ($region.length && suggestion.data.region_kladr_id) {
236
237                        //Смена региона
238                        var new_region = String(suggestion.data.region_kladr_id).substr(0, 2);
239
240                        if ($region.val() != new_region) {
241                            $region.val(new_region).change();
242
243                            //Устанавливаем приоритет города
244                            var sgt = $city.suggestions();
245                            sgt.setOptions({geoLocation: {kladr_id: new_region}});
246
247                        }
248                    }
249
250                    //Устанавливаем индекс
251                    if (suggestion.data.postal_code && $postcode.length) {
252                        $postcode.val(suggestion.data.postal_code);
253                    }
254
255                    //Устанавливаем ограничение на улицы
256                    if ($street.length) {
257                        that.updateStreetConstraints(suggestion, $street);
258                    }
259
260                    if (!$address.data('cityselect-not-set')) {
261                        that.by_detect = false;
262                        that.setCity(suggestion.data, $city);
263                    }
264                }
265            };
266
267            if ($region.length) {
268                $city_params.geoLocation = {kladr_id: String($region.val()).substr(0, 2)}
269            }
270
271            $city.suggestions($city_params);
272        }
273
274        if ($street.length) {
275            that.initStreet($street, $city, $postcode, $region);
276        }
277
278    };
279
280
281    that.initWaAddress = function () {
282        $('.wa-address,.wa-field-address').not('.i-cityselect__wa--init').each(function () {
283            that.initAddress($(this));
284        });
285
286        $('.wa-step-region-section').not('.i-cityselect__wa--init').each(function () {
287            that.initRegionAddress($(this));
288        });
289
290        $('.wa-step-details-section').not('.i-cityselect__wa--init').each(function () {
291            that.initDetailsAddress($(this));
292        });
293    };
294
295    that.themeSupport = function () {
296
297        //Выгодная покупка ()
298        var $profitbuy_icon = $('.base-menu .b-cityselect__wrapper--profitbuy i.fa,.base-menu .b-cityselect__wrapper--profitbuy1 i.fa');
299        if ($profitbuy_icon.length) {
300            $profitbuy_icon.replaceWith('<i class="material-icons"></i>');
301        }
302
303        var need_resize = false;
304
305        //InCart
306        var $incart__check = $('.b-cityselect__wrapper--incart,.b-cityselect__wrapper--incart1,.b-cityselect__wrapper--incart2');
307        if ($incart__check.length) {
308            $incart__check.find('.b-cityselect__city i').replaceWith('<div class="info-settings__icon"><svg class="icon icon-location" width="16" height="14"><use xlink:href="#icon-location"></use></svg></div>');
309            need_resize = true;
310        }
311
312        //InCart сверху
313        $incart__check = $('.top-bar__info-settings .b-cityselect__wrapper');
314        if ($incart__check.length) {
315            $incart__check.addClass('info-settings__btn info-settings__btn--account info-settings__btn--signed');
316            $incart__check.find('.b-cityselect__city .i-cityselect__city').addClass('info-settings__text');
317            $incart__check.find('.b-cityselect__city').removeClass('b-cityselect__city').addClass('info-settings__btn-inner');
318            need_resize = true;
319        }
320
321        if (need_resize) {
322            $('.top-menu__list').trigger('resize');
323        }
324
325    };
326
327    that.closeModal = function () {
328
329        if (that.modal_type == 'fancybox') {
330            $.fancybox.close(true);
331        }
332
333        if (that.modal_type == 'remodal') {
334            if (that.remodal_instance) {
335                that.remodal_instance.close();
336
337                //destroy нужен для совместимости с плагином stek35
338                if ($('.stek35-container').length) {
339                    that.remodal_instance.destroy();
340                    that.remodal_instance = null;
341                }
342            }
343        }
344
345        if (that.modal_type == 'magnificPopup') {
346            $.magnificPopup.instance.close();
347        }
348
349        that.modal_type = false;
350    };
351
352    //Для Shop-script 8
353    that.initRegionAddress = function ($address) {
354
355        $address.addClass('i-cityselect__wa--init');
356
357        var $country = $address.find(that.find.country);
358        var $region = $address.find(that.find.region);
359        var $city = $address.find(that.find.city);
360        var $postcode = $address.find(that.find.zip);
361
362        //Обрабатываем страну
363        if ($country.length) {
364
365            //Если не Россия то не обрабатываем адрес
366            if ($country.val() != 'rus') {
367                return false;
368            }
369
370        }
371
372        //Присутсвует город
373        if ($city.length) {
374
375            var $city_params = {
376                token: that.token, type: "ADDRESS", hint: false, bounds: that.bounds, constraints: {label: ''},
377                scrollOnFocus: false, triggerSelectOnBlur: false,
378                formatSelected: function (suggestion) {
379                    return suggestion.data.settlement ? suggestion.data.settlement : suggestion.data.city;
380                },
381                onSelect: function (suggestion) {
382                    //Поле регион может меняться
383                    var $region = $city.closest('.i-cityselect__wa--init').find(that.find.region);
384                    if ($region.length && suggestion.data.region_kladr_id) {
385
386                        //Смена региона
387                        var new_region = String(suggestion.data.region_kladr_id).substr(0, 2);
388
389                        if ($region.val() != new_region) {
390                            $region.val(new_region);
391
392                            //Устанавливаем приоритет города
393                            var sgt = $city.suggestions();
394                            sgt.setOptions({geoLocation: {kladr_id: new_region}});
395                        }
396
397                    }
398
399                    //Устанавливаем индекс
400                    if (suggestion.data.postal_code && $postcode.length) {
401                        $postcode.val(suggestion.data.postal_code);//.change();
402                    }
403
404                    that.by_detect = false;
405                    that.setCity(suggestion.data, $city);
406
407                }
408            };
409
410            if ($region.length) {
411                $city_params.geoLocation = {kladr_id: String($region.val()).substr(0, 2)}
412            }
413
414            $city.suggestions($city_params);
415        }
416    };
417
418    that.initDetailsAddress = function ($address) {
419        $address.addClass('i-cityselect__wa--init');
420
421        //Поле улицы
422        var $street = $address.find(that.find.street);
423
424        if ($street.length) {
425
426            //ищем город ограничитель
427            var $city = $('.wa-step-region-section .js-city-field');
428
429            //ищем индекс
430            var $postcode = $address.find(that.find.zip);
431
432            that.initStreet($street, $city, $postcode)
433        }
434    };
435
436    that.initChangeInput = function () {
437
438        $(".i-cityselect__input").suggestions({
439            token: that.token,
440            type: "ADDRESS",
441            hint: false,
442            bounds: that.bounds,
443            scrollOnFocus: false,
444            constraints: {
445                label: ""
446            },
447            formatSelected: function (suggestion) {
448                return suggestion.data.city;
449            },
450            onSelect: function (suggestion) {
451                that.by_detect = false;
452                that.setCity(suggestion.data, $(this));
453                that.closeModal();
454                that.hideNotifiers();
455            }
456        });
457    };
458
459    that.openByFancybox = function (url) {
460        that.modal_type = 'fancybox';
461
462        $.fancybox.open({
463            type: 'ajax',
464            href: url, //fancybox 2
465            src: url, //fancybox 3
466
467          touch: false,
468
469            afterShow: function () {
470                that.initChangeInput()
471            }, afterClose: function () {
472                that.modal_type = false;
473            }
474        });
475    };
476
477    that.openModal = function (url) {
478
479        //Конкретная тема
480        var $profitbuy__check = $('.b-cityselect__wrapper--profitbuy,.b-cityselect__wrapper--profitbuy1,.b-cityselect__wrapper--profitbuy2');
481
482        if ($profitbuy__check.length) {
483            return that.openByFancybox(url);
484        }
485
486        //Присутсвует reModal
487        if ($.remodal) {
488
489            that.modal_type = 'remodal';
490
491            //Удаляем Remodal и DOM
492            if (that.remodal_instance) {
493                that.remodal_instance.destroy();
494                that.remodal_instance = null;
495            }
496
497            if ($('#cityselect__change').length) {
498                $('#cityselect__change').remove();
499            }
500
501            $.get(url, function (response) {
502                $('body').append(response);
503
504                that.remodal_instance = $('#cityselect__change').on('opened', function () {
505                    that.initChangeInput();
506                }).on('closed', function () {
507                    //Удаляем instance при закрытие
508                    if (that.remodal_instance) {
509                        that.remodal_instance.destroy();
510                        that.remodal_instance = null;
511                    }
512                }).remodal();
513
514                that.remodal_instance.open();
515
516            })
517        } else if ($.fancybox) {
518            that.openByFancybox(url);
519        } else if ($.magnificPopup) {
520
521            that.modal_type = 'magnificPopup';
522
523            $.magnificPopup.open({
524                type: 'ajax',
525                overflowY: 'scroll',
526                closeBtnInside: true,
527                items: {
528                    src: url
529                },
530                callbacks: {
531                    parseAjax: function (mfpResponse) {
532                        mfpResponse.data = '<div class="b-cityselect__mfp">' + mfpResponse.data + '</div>';
533                    },
534                    ajaxContentAdded: function () {
535                        that.initChangeInput();
536                    }
537                }
538            });
539
540        } else {
541
542            var $link_css = $('<link/>', {
543                rel: 'stylesheet',
544                type: 'text/css',
545                href: that.lib + "jquery.fancybox.css"
546            });
547            $link_css.appendTo('head');
548            $link_css[0].onload = function () {
549                $.getScript(that.lib + "jquery.fancybox.pack.js", function () {
550                    that.openByFancybox(url);
551                });
552            };
553        }
554    };
555
556    that.updateCheckout = function (data) {
557
558
559        //ТОлько основные данные
560        if (data.country) {
561            $('[name$="[address.shipping][country]"]').val(data.country).change();
562            $('.js-country-field').val(data.country);
563        }
564
565        if (data.region) {
566            $('[name$="[address.shipping][region]"]').val(data.region).change();
567            $('.js-region-field').val(data.region);
568        }
569
570        if (data.city) {
571            $('[name$="[address.shipping][city]"]').val(data.city).change();
572            $('.js-city-field').val(data.city);
573
574            $('[name$="[address.shipping][zip]"]').val(data.zip ? data.zip : '').change();
575            $('[name$="[shipping_address][zip]"]').val(data.zip ? data.zip : '').change();
576            $('.js-zip-field').val(data.zip ? data.zip : '')
577        }
578
579        $('.js-city-field').trigger("region_change");
580
581    };
582
583    that.updateVariables = function (data) {
584
585        if (!data.variables) {
586            return;
587        }
588
589        for (var i in data.variables) {
590            var variable = data.variables[i];
591
592            var custom_change = false;
593
594            try {
595                var function_name = String(variable.code);
596                function_name = 'updateVariable' + function_name.charAt(0).toUpperCase() + function_name.slice(1);
597
598                if (that[function_name]) {
599                    that[function_name](variable);
600                    custom_change = true;
601                }
602
603            } catch (e) {
604                console.log(e);
605            }
606
607            if (!custom_change) {
608                $('.i-cityselect__var--' + variable['code']).replaceWith(variable.html);
609            }
610
611        }
612
613    };
614
615    that.changeCity = function () {
616        that.openModal(that.url + 'shop_cityselect/change_city');
617    };
618
619    that.setCity = function (data, $target) {
620
621        if (data !== false) {
622            var city = data.settlement ? data.settlement : data.city;
623            $('.i-cityselect__city').html(city);
624        } else {
625            data = {'set_default': 1}
626        }
627
628        data.route_params = that.route_params;
629
630        $.post(that.url + 'shop_cityselect/set_city', data, function (response) {
631            if (response.status && response.status === 'ok') {
632
633                that.location = response.data;
634
635                that.updateVariables(response.data);
636
637                if (that.onSetCity) {
638                    response.data = that.onSetCity(response.data);
639                }
640
641                if (response.data) {
642                    that.updateCheckout(response.data);
643                }
644
645                //Если объект не передан или не сущестует
646                if ((!$target) || (!$target.length) || (!$target.closest('body').length)) {
647                    $target = $(document);
648                }
649
650                //Обработка перенаправления
651                if (response.data.redirect) {
652
653                    that.is_redirecting = true;
654
655                    //Если по определению города
656                    if (that.by_detect) {
657
658                        //Отключаем показ
659                        that.show_notifier = 'none';
660
661                    }
662
663                    if (response.data.save_cookie) {
664
665                        var img = document.createElement('img');
666
667                        img.onload = function () {
668                            window.location.href = response.data.redirect_url;
669                        };
670
671                        img.onerror = function () {
672                            window.location.href = response.data.redirect_url;
673                        };
674
675                        var src = response.data.save_cookie + '?t=' + Math.random() + '&' + response.data.save_data;
676
677                        if (that.by_detect) {
678                            src += '&cityselect__force_notify=1';
679                        }
680
681                        img.src = src;
682                    }
683
684                }
685
686                if ((that.by_detect) && (that.show_notifier != 'none')) {
687                    that.showNotifiers();
688                }
689
690                $target.trigger('cityselect__set_city', response.data);
691            }
692        });
693    };
694
695    //Смещает уведомление чтобы не выходило за край
696    that.moveNotifier = function ($notifier, delta) {
697        $notifier.data('delta-right', delta);
698        $notifier.css('transform', 'translateX(' + delta + 'px)');
699        $notifier.find('.b-cityselect__notifier_triangle').css('transform', 'translateX(' + (-delta) + 'px)');
700    };
701
702    //Проверка выхода окна уведомления за край экрана
703    that.boundsNotifiers = function () {
704        if (that.$notifiers && that.$notifiers.length) {
705            that.$notifiers.each(function () {
706                var $notifier = $(this);
707
708                //Если смещение уже есть, снимаем его
709                if ($notifier.data('delta-right')) {
710                    that.moveNotifier($notifier, 0);
711                }
712
713                var right = $notifier.offset().left + $notifier.outerWidth(true) + 1;
714                if (right > $(window).width()) {
715                    var delta = $(window).width() - right;
716                    that.moveNotifier($notifier, delta)
717                }
718            })
719        }
720    };
721
722    //Показать уведомление
723    that.showNotifiers = function () {
724        if (that.notifier_type == 'modal') {
725            $('.i-cityselect__notifier--modal').first().appendTo('body').modal();
726        } else {
727            that.$notifiers = $('.b-cityselect__notifier');
728            that.$notifiers.show();
729            that.boundsNotifiers();
730        }
731
732        $.post(that.url + 'shop_cityselect/show_notifier');
733    };
734
735    that.hideNotifiers = function () {
736        if (that.notifier_type == 'modal') {
737            $('.i-cityselect__notifier--modal').modal('hide');
738        } else {
739            if (that.$notifiers && that.$notifiers.length) {
740                that.$notifiers.hide();
741            } else {
742                $('.b-cityselect__notifier').hide();
743            }
744        }
745    };
746
747    that.detectCity = function () {
748        var serviceUrl = "https://suggestions.dadata.ru/suggestions/api/4_1/rs/detectAddressByIp";
749        var params = {
750            type: "GET",
751            contentType: "application/json",
752            headers: {
753                "Authorization": "Token " + that.token
754            }
755        };
756        return $.ajax(serviceUrl, params);
757    };
758
759    that.findAddressByFiasId = function (fias_id) {
760        var serviceUrl = "https://suggestions.dadata.ru/suggestions/api/4_1/rs/findById/address";
761        var request = {
762            "query": fias_id
763        };
764        var params = {
765            type: "POST",
766            contentType: "application/json",
767            headers: {
768                "Authorization": "Token " + that.token
769            },
770            data: JSON.stringify(request)
771        };
772
773        return $.ajax(serviceUrl, params);
774    };
775
776    that.detect = function () {
777
778        //защита от двойного определения
779        if (that.is_detect) {
780            return;
781        }
782
783        that.is_detect = true;
784
785        //Отключение автоопределение и перенаправления
786        if (that.disable_auto) {
787            return;
788        }
789
790
791        that.detectCity().done(function (response) {
792
793            that.by_detect = true;
794
795            //Не удалось определить город
796            if (!response.location || !response.location.data) {
797
798                //false - установить город по умолчанию
799                that.setCity(false);
800
801            } else {
802
803                var locationData = response.location.data;
804
805                that.findAddressByFiasId(locationData.fias_id).done(function (response) {
806                    if (response.suggestions[0]) {
807                        locationData = response.suggestions[0].data;
808                    }
809                    that.setCity(locationData);
810
811                });
812            }
813        });
814    };
815
816    that.setLocation = function ($address) {
817        var $country = $address.find(that.find.country);
818        var $region = $address.find(that.find.region);
819        var $city = $address.find(that.find.city);
820        var $postcode = $address.find(that.find.zip);
821
822
823        if (that.location.country) {
824            $country.val(that.location.country);
825        }
826
827        if (that.location.region) {
828            $region.val(that.location.region);
829        }
830
831        if (that.location.city) {
832            $city.val(that.location.city);
833        }
834
835        if (that.location.zip) {
836            $postcode.val(that.location.zip);
837        }
838    };
839
840    that.initWaCustom = function () {
841
842        if (that.in_custom_form) {
843            $(that.in_custom_form).not('.i-cityselect__wa--init').each(function () {
844                that.initAddress($(this));
845                that.setLocation($(this));
846            });
847        }
848
849        if (that.in_custom_city) {
850            $(that.in_custom_city).not('.i-cityselect__custom-city--init').each(function () {
851
852                var $city = $(this);
853                that.initCity($city);
854
855                if (that.location.city) {
856                    $city.val(that.location.city);
857                }
858            });
859        }
860    };
861
862    $(document).on('click', '.i-cityselect__city_yes', function (e) {
863        e.preventDefault();
864        that.hideNotifiers();
865
866        $.post(that.url + 'shop_cityselect/say_yes');
867    });
868
869    $(document).on('click', '.i-cityselect__city_no', function (e) {
870        e.preventDefault();
871        that.hideNotifiers();
872
873        //вызываем выбор города
874        $('.i-cityselect__city_change').first().click();
875    });
876
877    $(document).on('click', '.i-cityselect__city_change', function (e) {
878        e.preventDefault();
879        that.hideNotifiers();
880        that.changeCity();
881    });
882
883    $(document).on('click', '.i-cityselect__change_close', function (e) {
884        e.preventDefault();
885        that.closeModal();
886    });
887
888    $(document).on('click', '.i-cityselect__set_city', function (e) {
889        e.preventDefault();
890        that.by_detect = false;
891        that.setCity($(this).data(), $(this));
892        that.closeModal();
893    });
894
895    //Интеграция с другими плагинами
896    $(document).on('cityselect__set_city', function (e) {
897        if (that.plugin_dp && window.shop_dp && !that.is_redirecting && !that.by_detect && !$(e.target).closest('.quickorder-form').length) {
898            location.reload();
899        }
900    });
901
902    //Обновление данных произвольных формы
903    $(document).on('cityselect__set_city', function (event, data) {
904        if (that.in_custom_form) {
905            $(that.in_custom_form).each(function () {
906                var $form = $(this);
907                $form.find(that.find.country).val(data.country || '');
908                $form.find(that.find.region).val(data.region || '');
909                $form.find(that.find.city).val(data.city || '');
910                $form.find(that.find.zip).val(data.zip || '');
911            });
912        }
913
914        if (that.in_custom_city) {
915            $(that.in_custom_city).each(function () {
916                $(this).val(data.city || '');
917            });
918        }
919    });
920
921
922    $(window).resize(function () {
923        that.boundsNotifiers();
924    });
925
926    $(document).on('wa_order_form_ready', function (e) {
927        if (that.in_checkout) {
928            that.initWaAddress();
929        }
930    });
931
932    $(document).on('wa_order_form_region_changed', function () {
933        if (that.in_checkout) {
934            that.initWaAddress();
935        }
936    });
937
938    $(document).on('wa_order_form_details_changed', function () {
939        if (that.in_checkout) {
940            that.initWaAddress();
941        }
942    });
943}
944
945//Глобальная переменная для доступа из вне
946var shop_cityselect = new shopCityselectFrontend();

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.