PageSourceSearch

https://germet.pro/g/templates/shop2/2.130.2/default-3/js/top_timer_init.js

js germet.pro collected 2026-10-08 08:24:47 UTC 1,944 bytes, 76 lines download raw bytes

1(function(){
2	function animate_cust(options) {
3
4	  var start = performance.now();
5
6	  requestAnimationFrame(function animate(time) {
7	    // timeFraction от 0 до 1
8	    var timeFraction = (time - start) / options.duration;
9	    if (timeFraction > 1){
10	    	 timeFraction = 1;
11	    	 options.callback();
12	    }
13
14	    // текущее состояние анимации
15	    var progress = options.timing(timeFraction);
16	    
17	    options.draw(progress);
18
19	    if (timeFraction < 1) {
20	      requestAnimationFrame(animate);
21	    }
22
23	  });
24	}
25
26
27	function fn(){
28		
29		var timer_block = document.querySelector('.timer-block');
30		if( !timer_block ){
31			return;
32		}
33
34		var timerHide = timer_block.getAttribute('data-hide-time');
35
36		var timer_block_close = document.querySelector('.timer-block__close');
37		if( !!timer_block_close ){
38			timer_block_close.addEventListener('click', function(){
39				
40				
41				var timer_height = timer_block.getBoundingClientRect().height;
42			
43				animate_cust({
44					duration: 250,
45					timing: function(timeFraction) {
46						return Math.pow(timeFraction, 2)
47					},
48					draw: function(progress) {
49					  	timer_block.style.height = ( ( 1 - progress ) * 1) * timer_height + 'px';
50					},
51					callback: function(){
52						timer_block.style.display = 'none';
53					}
54				});
55		  
56				
57				createCookie('gr_show_timer', 1, timerHide);
58			});
59		};
60
61
62
63		var topTimer = new grTimer( {
64			element: timer_block.querySelector('.timer-block__date.gr-timer'),  // контейнер  класс
65			update_time : 1000,
66			language : window._s3Lang.code,
67			//template : '<div>**d** %d</div> <div>**h** %h</div> <div>**m** %m</div> <div>**s** %s</div> ', // Слова "**d** - дни **h** - часы **m** - минуты **s** - секунды" цифры %s
68			onEnd : function(element){
69				element.style.display = 'none';
70			}
71		});
72
73	}
74	fn();
75
76})();

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.