PageSourceSearch

https://hemoam.am.gov.br/js/jquery.lwtCountdown-1.0.js

js hemoam.am.gov.br collected 2026-10-07 11:18:43 UTC 5,021 bytes, 162 lines download raw bytes

1/*!
2 * jQuery Countdown plugin v1.0
3 * http://www.littlewebthings.com/projects/countdown/
4 *
5 * Copyright 2010, Vassilis Dourdounis
6 * 
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 * 
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 * 
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25(function($){
26
27	$.fn.countDown = function (options) {
28
29		config = {};
30
31		$.extend(config, options);
32
33		diffSecs = this.setCountDown(config);
34	
35		if (config.onComplete)
36		{
37			$.data($(this)[0], 'callback', config.onComplete);
38		}
39		if (config.omitWeeks)
40		{
41			$.data($(this)[0], 'omitWeeks', config.omitWeeks);
42		}
43
44		$('#' + $(this).attr('id') + ' .digit').html('<div class="top"></div><div class="bottom"></div>');
45		$(this).doCountDown($(this).attr('id'), diffSecs, 500);
46
47		return this;
48
49	};
50
51	$.fn.stopCountDown = function () {
52		clearTimeout($.data(this[0], 'timer'));
53	};
54
55	$.fn.startCountDown = function () {
56		this.doCountDown($(this).attr('id'),$.data(this[0], 'diffSecs'), 500);
57	};
58
59	$.fn.setCountDown = function (options) {
60		var targetTime = new Date();
61
62		if (options.targetDate)
63		{
64			targetTime = new Date(options.targetDate.month + '/' + options.targetDate.day + '/' + options.targetDate.year + ' ' + options.targetDate.hour + ':' + options.targetDate.min + ':' + options.targetDate.sec + (options.targetDate.utc ? ' UTC' : ''));
65		}
66		else if (options.targetOffset)
67		{
68			targetTime.setFullYear(options.targetOffset.year + targetTime.getFullYear());
69			targetTime.setMonth(options.targetOffset.month + targetTime.getMonth());
70			targetTime.setDate(options.targetOffset.day + targetTime.getDate());
71			targetTime.setHours(options.targetOffset.hour + targetTime.getHours());
72			targetTime.setMinutes(options.targetOffset.min + targetTime.getMinutes());
73			targetTime.setSeconds(options.targetOffset.sec + targetTime.getSeconds());
74		}
75
76		var nowTime = new Date();
77
78		diffSecs = Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);
79
80		$.data(this[0], 'diffSecs', diffSecs);
81
82		return diffSecs;
83	};
84
85	$.fn.doCountDown = function (id, diffSecs, duration) {
86		$this = $('#' + id);
87		if (diffSecs <= 0)
88		{
89			diffSecs = 0;
90			if ($.data($this[0], 'timer'))
91			{
92				clearTimeout($.data($this[0], 'timer'));
93			}
94		}
95
96		secs = diffSecs % 60;
97		mins = Math.floor(diffSecs/60)%60;
98		hours = Math.floor(diffSecs/60/60)%24;
99		if ($.data($this[0], 'omitWeeks') == true)
100		{
101			days = Math.floor(diffSecs/60/60/24);
102			weeks = Math.floor(diffSecs/60/60/24/7);
103		}
104		else 
105		{
106			days = Math.floor(diffSecs/60/60/24)%7;
107			weeks = Math.floor(diffSecs/60/60/24/7);
108		}
109
110		$this.dashChangeTo(id, 'seconds_dash', secs, duration ? duration : 800);
111		$this.dashChangeTo(id, 'minutes_dash', mins, duration ? duration : 1200);
112		$this.dashChangeTo(id, 'hours_dash', hours, duration ? duration : 1200);
113		$this.dashChangeTo(id, 'days_dash', days, duration ? duration : 1200);
114		$this.dashChangeTo(id, 'weeks_dash', weeks, duration ? duration : 1200);
115
116		$.data($this[0], 'diffSecs', diffSecs);
117		if (diffSecs > 0)
118		{
119			e = $this;
120			t = setTimeout(function() { e.doCountDown(id, diffSecs-1) } , 1000);
121			$.data(e[0], 'timer', t);
122		} 
123		else if (cb = $.data($this[0], 'callback')) 
124		{
125			$.data($this[0], 'callback')();
126		}
127
128	};
129
130	$.fn.dashChangeTo = function(id, dash, n, duration) {
131		  $this = $('#' + id);
132		 
133		  for (var i=($this.find('.' + dash + ' .digit').length-1); i>=0; i--)
134		  {
135				var d = n%10;
136				n = (n - d) / 10;
137				$this.digitChangeTo('#' + $this.attr('id') + ' .' + dash + ' .digit:eq('+i+')', d, duration);
138		  }
139	};
140
141	$.fn.digitChangeTo = function (digit, n, duration) {
142		if (!duration)
143		{
144			duration = 800;
145		}
146		if ($(digit + ' div.top').html() != n + '')
147		{
148
149			$(digit + ' div.top').css({'display': 'none'});
150			$(digit + ' div.top').html((n ? n : '0')).slideDown(duration);
151
152			$(digit + ' div.bottom').animate({'height': ''}, duration, function() {
153				$(digit + ' div.bottom').html($(digit + ' div.top').html());
154				$(digit + ' div.bottom').css({'display': 'block', 'height': ''});
155				$(digit + ' div.top').hide().slideUp(10);
156
157			
158			});
159		}
160	};
161
162})(jQuery);

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.