PageSourceSearch

https://www.agroprodmash-expo.ru/common/2020/js/main.js

js agroprodmash-expo.ru collected 2026-10-02 06:47:45 UTC 9,930 bytes, 275 lines download raw bytes

1$(window).on('load', function () {
2    var hash = window.location.hash.substring(1);
3
4    if (hash != '' && $('[data-accordion-id="' + hash + '"]').length) {
5
6        var selectAccordion = $('.accordion').find('[data-accordion-id="' + hash + '"]'),
7            typeTab = selectAccordion.closest('[data-tab-panel]').data('tab-panel-type'),
8            selectTab,
9            selectPanel;
10
11        // если есть тип таба, открываем нужный
12        if (typeTab != '') {
13            selectTab = $('.tabs').find('[data-tab-link-type="' + typeTab + '"]'), selectPanel = $('.tabs__container').find('[data-tab-panel-type="' + typeTab + '"]');
14
15            if (!selectTab.hasClass('active')) {
16                $('.tabs').find('[data-tab-link]').removeClass('active');
17                selectTab.addClass('active');
18            }
19
20            if (!selectPanel.hasClass('active')) {
21                $('.tabs__container').find('[data-tab-panel]').removeClass('active');
22                selectPanel.addClass('active');
23            }
24        }
25
26        // скроллим к аккордеону по hash, открываем все внутренние подпункты
27        setTimeout(function () {
28            $('html, body').animate({ scrollTop: selectAccordion.offset().top-80 }, 500);
29
30            var $accordion = selectAccordion,
31                $accordionToogle = $accordion.find('[data-accordion-toogle]'),
32                $accordionContent = $accordionToogle.next('[data-accordion-content]');
33
34            $accordionContent.slideDown(400, function () {
35                $accordion.addClass('open');
36
37                $accordion.find('[data-accordion]').addClass('open');
38
39                //$('.slick').slick('init');
40                var sliderInnerAccordion = $accordionContent.find('[data-typical-slider]');
41                if (sliderInnerAccordion.length && sliderInnerAccordion.hasClass('slick-initialized')) {
42                    sliderInnerAccordion.slick('refresh');
43                }
44
45            });
46        }, 200);
47    }
48
49    // переход на вкладку Деловой программы
50    if (hash != '' && $('.schedule-tabs ul li a[href="#' + hash + '"]').length) {
51        $('.schedule-tabs ul li a[href="#' + hash + '"]').parent().click();
52    }
53
54	// ротатор баннеров при загрузке
55	var banner = new Array();
56	banner[0] = '<a href="/ru/participants/additional-features/protection-intellectual-property/"><img src="/common/2020/img/contrafact.jpg" alt=""></a>';
57    //banner[1] = '<a href="/ru/media/news/index.php?id4=12480"><img src="/common/img/uploaded/exhibitions/Moscow_sub_300x168.jpg" alt=""></a>';
58    //banner[1] = '<a href="/ru/media/news/index.php?id4=13970"><img src="/common/2020/img/grants_moscow.jpg" alt=""></a>';
59
60	var n = ~~(Math.random()*banner.length);
61    if ((document.getElementById('ban-rot') != null ) && !(document.getElementById('ban-rot').hasAttribute('data-banner'))) {document.getElementById('ban-rot').innerHTML = banner[n]};
62
63	// cookie
64	if (!$.cookie('cookie-read'))
65	{
66        $('[data-cookie-message]').show();
67    }
68    $('[data-cookie-message-close]').on('click', function () {
69        $('[data-cookie-message]').hide();
70        $.cookie('cookie-read', 'true', { expires: 365 });
71    });
72
73	// antivirus modal (раз в сутки)
74	if (!$.cookie('corona'))
75	{
76        $('#antivirus').modal('show')
77    }
78	$('#antivirus').on('hidden.bs.modal', function (e) {
79		$.cookie('corona', 'true', { expires: 1 });
80	});
81
82    // antivirus modal 2 (раз в 2 мин_полчаса)
83	if (!$.cookie('corona2'))
84	{
85        $('#antivirus2').modal('show')
86    }
87	$('#antivirus2').on('hidden.bs.modal', function (e) {
88
89        var date = new Date();
90        var minutes = 2;
91        date.setTime(date.getTime() + (minutes * 60 * 1000));
92
93		$.cookie('corona2', 'true', { expires: date });
94	});
95	
96	    // antivirus modal 3 (часто)
97	if (!$.cookie('corona3'))
98	//unset($_COOKIE['corona']);
99	{
100        $('#antivirus3').modal('show')
101    }
102	$('#antivirus').on('hidden.bs.modal', function (e) {
103		$.cookie('corona3', 'true', { expires: 1 });
104	});
105
106
107    // Круговые диаграммы
108    function $$(selector, context) {
109    context = context || document;
110    var elements = context.querySelectorAll(selector);
111    return Array.prototype.slice.call(elements);
112    }
113
114    $$('.pie').forEach(function(pie) {
115    var p = parseFloat(pie.textContent);
116    var NS = "http://www.w3.org/2000/svg";
117    var svg = document.createElementNS(NS, "svg");
118    var circle = document.createElementNS(NS, "circle");
119    var title = document.createElementNS(NS, "title");
120
121    circle.setAttribute("r", 16);
122    circle.setAttribute("cx", 16);
123    circle.setAttribute("cy", 16);
124    circle.setAttribute("stroke-dasharray", p + " 100");
125
126    svg.setAttribute("viewBox", "0 0 32 32");
127    title.textContent = pie.textContent;
128    // pie.textContent = '';
129    svg.appendChild(title);
130    svg.appendChild(circle);
131    pie.appendChild(svg);
132    });
133
134});
135
136
137$(document).ready(function(e) {
138
139// Примечания
140var btnNoteToggle = $('[data-btn-note-toggle]');
141    if (btnNoteToggle.length) {
142        btnNoteToggle.closest('[data-note-toggle]').each(function (index) {
143            var _this = $(this);
144            if (_this.hasClass('open')) {
145                _this.find('[data-content-note-toggle]').show();
146            }
147        });
148    }
149    $('.main_inner').on('click', '[data-btn-note-toggle]', function () {
150        var _this = $(this),
151            currContainer = _this.closest('[data-note-toggle]'),
152            currContent = currContainer.find('[data-content-note-toggle]');
153            currContainer.toggleClass('open');
154        if (currContainer.hasClass('open')) {
155            currContent.stop().slideDown();
156        } else {
157            currContent.stop().slideUp();
158        }
159    });
160
161var btnAttentionToggle = $('[data-btn-attention-toggle]');
162    if (btnAttentionToggle.length) {
163        btnAttentionToggle.closest('[data-attention-toggle]').each(function (index) {
164            var _this = $(this);
165            if (_this.hasClass('open')) {
166                _this.find('[data-content-attention-toggle]').show();
167            }
168        });
169    }
170    $('.main_inner').on('click', '[data-btn-attention-toggle]', function () {
171        var _this = $(this),
172            currContainer = _this.closest('[data-attention-toggle]'),
173            currContent = currContainer.find('[data-content-attention-toggle]');
174            currContainer.toggleClass('open');
175        if (currContainer.hasClass('open')) {
176            currContent.stop().slideDown();
177        } else {
178            currContent.stop().slideUp();
179        }
180    });
181
182
183// Init BLazy for lazy loading
184var bLazy = new Blazy({
185  container: '.slick' // Default is window
186});
187
188
189// Табы в навигации
190$('.tabs__nav').on('click', '.tabs__nav-item:not(.active)', function() {
191	$(this)
192      .addClass('active').siblings().removeClass('active')
193	  .closest('div.tabs').find('div.tabs__content').find('div.tabs__pane').removeClass('active').eq($(this).index()).addClass('active');
194	bLazy.revalidate();
195	$('.slick').slick('refresh');
196
197});
198
199
200// Таб photo-video
201$('.tab-photo-video li').click(function(){
202    $(this).addClass('active').siblings().removeClass('active')
203	.closest('div.container-fluid').find('div.tab-photo-video-content').removeClass('active').eq($(this).index()).addClass('active');
204
205	/*$('.yottie-widget-nav-list-item:first').addClass('yottie-active').click();
206	var mySwiper = document.querySelector('.swiper-container').swiper;
207	mySwiper.update();*/
208
209	// bLazy2.revalidate();
210
211	$('.slick-main').slick('refresh');
212});
213
214
215// Деловая программа. Events tabs fix
216$('.nav-tabs li').click(function(){
217//$('.nav-tabs li').on('click', '.nav-tabs li:not(.active)', function() {
218    //if !($(this).hasClass('active'))
219	//{
220	$(this).addClass('active').siblings().removeClass('active');
221	//$(this).toggleClass('active');
222		$('.tab-pane').removeClass('active');
223			$('.tab-pane').eq($(this).index()-1).addClass('active');
224		$('.event-date').hide();
225		$('.event-hr').hide();
226	//}
227});
228
229//$('.nav-tabs li:first').on('click', '.nav-tabs li:first:not(.active)', function() {
230$('.nav-tabs li:first').click(function(){
231	//$('.tab-pane').tab('show');
232	 $('.tab-pane').addClass('active');
233	$('.event-date').show();
234	$('.event-hr').show();
235});
236
237
238// Аккордеон
239$('.main_inner').on('click', '[data-accordion-toogle]', function (event, state) {
240
241    var $accordionToogle = $(this),
242        $accordion = $accordionToogle.closest('[data-accordion]'),
243        $accordionContent = $accordionToogle.next('[data-accordion-content]');
244
245    if ($accordion.hasClass('open')) {
246        $accordion.removeClass('open');
247        $accordionContent.slideUp(400);
248    } else {
249        $accordionContent.slideDown(400, function () {
250            $accordion.addClass('open');
251
252            var sliderInnerAccordion = $accordionContent.find('[data-typical-slider]');
253            if (sliderInnerAccordion.length && sliderInnerAccordion.hasClass('slick-initialized')) {
254                sliderInnerAccordion.slick('refresh');
255            }
256        });
257    }
258});
259
260
261// Скролл в моб. меню
262$('.nano').nanoScroller();
263
264
265// Доп. в формы заявок
266$('input[name*="email"]').attr('type', 'email' ).attr('autocapitalize', 'off' ).attr('autocorrect', 'off' ).attr('autocomplete', 'email' );
267
268$('label:contains("елефон")').next('input').attr('type', 'tel' ).attr('autocorrect', 'off' ).attr('autocomplete', 'tel' );
269
270$('label:contains("дрес")').next('input').attr('autocorrect', 'off' ).attr('autocomplete', 'address-line1');
271$('label:contains("дрес")').next('textarea').attr('autocorrect', 'off' ).attr('autocomplete', 'address-line1');
272
273$('label:contains("Регион")').next('input').attr('autocorrect', 'off' ).attr('autocomplete', 'address-level1');
274
275});

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.