PageSourceSearch

https://germet.pro/g/templates/shop2/2.130.2/default-2/js/special_timer_popup.js

js germet.pro collected 2026-10-08 08:25:00 UTC 4,624 bytes, 133 lines download raw bytes

1$(function(){
2	var specialTimeOut;
3	var specialInitialized = false;
4	
5	$(window).on('scroll', function(){
6		if (specialTimeOut) {
7			clearTimeout(specialTimeOut);
8		};
9		if (!specialInitialized) {
10			specialTimeOut = setTimeout(function(){
11				specialInitialized = true;
12				specialPopupInit();
13				return specialInitialized;
14			}, 10);
15		};
16		
17		return specialInitialized;
18	});
19	
20	function specialPopupInit() {
21		var isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
22	
23		if ($('.remodal.special-popup').length) {
24			var $container = $('.special-popup__form');
25			var api_url = $container.data('api-url');
26			
27			var flag = 0;
28			var specialRemodal = $('[data-remodal-id=special-popup]').remodal({
29				hashTracking: false
30			});
31			
32			if (api_url) {
33				$.ajax({
34					url: api_url,
35					dataType: 'json',
36					success: function(response) {
37						if (!response.result.error) {
38							
39							$container.append(response.result.html);
40							
41							s3From.initForms();
42							grFormDatePicker.init();
43						}
44					}
45				});
46			};
47			
48			$('.special-popup__btn a, .special-popup__image a').on('click', function(e){
49				e.preventDefault();
50				
51				createCookie('gr_show_special', 1, specialHide);
52				specialRemodal.close();
53				
54				var href = $(this).attr('href');
55				
56				setTimeout(function(){
57					document.location = href;
58				}, 400);
59			});
60			
61			if ($('.remodal.special-popup').hasClass('mouseleave_popup')) {
62				if (!isMobile) {
63					$('html').mouseleave(function(){
64						setTimeout(function(){
65							if (!flag) {
66								specialRemodal.open();
67							};
68							return flag = 1;
69						}, 300);
70					});
71				}
72			} else {
73				var popupDelay = $('.remodal.special-popup').data('popup-delay');
74				
75				setTimeout(function(){
76					if (!flag) {
77						specialRemodal.open();
78					};
79					return flag = 1;
80				}, popupDelay);
81			};
82		
83			var specialHide = $('.remodal.special-popup').data('hide-time');
84			
85			$(document).on('closed', '.remodal.special-popup', function () {
86				createCookie('gr_show_special', 1, specialHide);
87			});
88			
89			var grTimerTemplate = function(wrap){
90		        var timerBlocksFirst = $(wrap+'.gr-timer'),
91		        $htmlLang = window._s3Lang.code;
92		        if ($htmlLang=='de' || $htmlLang=='en') {
93		            timerDays = 'days';
94		            timerHours = 'hours';
95		            timerMinutes = 'minutes';
96		            timerSeconds = 'seconds'
97		        } else {
98		            timerDays = 'Дней';
99		            timerHours = 'Часов';
100		            timerMinutes = 'Минут';
101		            timerSeconds = 'Секунд'
102		        };
103		        
104		        var outputFormat =  '<span class="gr-timer-elem gr-timer-days"> <span class="gr-timer-number">%d </span> <em>' + timerDays + '</em> </span> <span class="gr-timer-delim"><svg class="gr-svg-icon"><use xlink:href="#icon_shop_timer_dots"></use></svg><svg class="gr-svg-icon gr_small_icon"><use xlink:href="#icon_shop_timer_dots_small"></use></svg></span> <span class="gr-timer-elem"> <span class="gr-timer-number">%h </span> <em>' + timerHours + '</em> </span> <span class="gr-timer-delim"><svg class="gr-svg-icon"><use xlink:href="#icon_shop_timer_dots"></use></svg><svg class="gr-svg-icon gr_small_icon"><use xlink:href="#icon_shop_timer_dots_small"></use></svg></span> <span class="gr-timer-elem"> <span class="gr-timer-number">%m </span> <em>' + timerMinutes + '</em> </span> <span class="gr-timer-delim"><svg class="gr-svg-icon"><use xlink:href="#icon_shop_timer_dots"></use></svg><svg class="gr-svg-icon gr_small_icon"><use xlink:href="#icon_shop_timer_dots_small"></use></svg></span> <span class="gr-timer-elem"> <span class="gr-timer-number">%s </span> <em>' + timerSeconds + '</em> </span>' ;
105		
106		        if (timerBlocksFirst.length) {
107		            timerBlocksFirst.timer({
108		                format_in: "%d.%M.%y %h:%m:%s",
109		                format_out: outputFormat,
110		                wrapChar: 'ins class="timerWrapChar"',
111		                language: $htmlLang,
112		                update_time: 1000,
113		                onEnd: function() {
114		                    $('.special-timer').hide();
115		                }
116		            });
117		        }
118		    };
119		    grTimerTemplate('.special-timer__date');
120		    
121		    $(document).on('click', '.special-popup__form button', function(){
122		    	$.ajaxSetup({
123					complete: function() {
124						if ($('.special-popup__form .tpl-anketa-success-note').length>0) {
125							$('.special-popup__header, .special-popup__desc').remove();
126							createCookie('gr_special_form_sent', 1, 1);
127						}	
128					}
129				});
130		    });
131		}
132	};
133});

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.