PageSourceSearch

https://ciudadanospormexico.org/wp-content/plugins/countdown-builder/assets/js/Countdown.js?ver=1.85

js ciudadanospormexico.org collected 2026-10-01 12:18:44 UTC 22,846 bytes, 846 lines download raw bytes

1function YcdCountdown() {
2	this.init();
3	this.options = {};
4	this.allOptions = {};
5}
6
7YcdCountdown.prototype = new YcgGeneral();
8
9YcdCountdown.prototype.setOptions = function(options) {
10	this.options = options;
11};
12
13YcdCountdown.prototype.getOptions = function() {
14	return this.options;
15};
16
17YcdCountdown.prototype.setAllOptions = function(allOptions) {
18	this.allOptions = allOptions;
19};
20
21YcdCountdown.prototype.getAllOptions = function() {
22	return this.allOptions;
23};
24
25YcdCountdown.prototype.init = function() {
26	this.startTimeCircle();
27	this.minicolors();
28	this.ionRangeSlider();
29	this.imageUpload();
30	this.responsive();
31	this.contentClick();
32	this.showingLimitation();
33	this.animations();
34	this.livePreview();
35};
36
37YcdCountdown.prototype.animations = function () {
38	var allOptions = this.allOptions;
39	var circles = jQuery('.time_circles');
40
41	if(!circles.length || !allOptions['ycd-countdown-showing-animation']) {
42		return false;
43	}
44	var animationEffect = allOptions['ycd-circle-showing-animation'];
45	var speed = allOptions['ycd-circle-showing-animation-speed'];
46    circles.data('effect', animationEffect);
47    circles.css({'animationDuration' : parseInt(speed)*1000+ 'ms'});
48    circles.addClass('ycd-animated '+animationEffect);
49};
50
51YcdCountdown.jsCookies = {
52
53	/* this gets a cookie and returns the cookies value, if no cookies it returns blank "" */
54    get: function(c_name) {
55        if (document.cookie.length > 0) {
56            var c_start = document.cookie.indexOf(c_name + "=");
57            if (c_start != -1) {
58                c_start = c_start + c_name.length + 1;
59                var c_end = document.cookie.indexOf(";", c_start);
60                if (c_end == -1) {
61                    c_end = document.cookie.length;
62                }
63                return unescape(document.cookie.substring(c_start, c_end));
64            }
65        }
66        return "";
67    },
68
69    /* this sets a cookie with your given ("cookie name", "cookie value", "good for x days") */
70    set: function(c_name, value, expiredays) {
71        var exdate = new Date();
72        exdate.setDate(exdate.getDate() + expiredays);
73        document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + exdate.toUTCString());
74    },
75
76    /* this checks to see if a cookie exists, then returns true or false */
77    check: function(c_name) {
78        c_name = jsCookies.get(c_name);
79        if (c_name != null && c_name != "") {
80            return true;
81        } else {
82            return false;
83        }
84    }
85
86};
87
88YcdCountdown.prototype.showingLimitation = function() {
89    var options = this.options;
90	if(!options) {
91		return false;
92	}
93    if(options['ycd-countdown-showing-limitation']) {
94        var id = this.allOptions['id'];
95        var expireTime = options['ycd-countdown-expiration-time'];
96
97        YcdCountdown.jsCookies.set('YcdDontShow'+id, 1, expireTime);
98	}
99};
100
101YcdCountdown.prototype.responsive = function() {
102    var scale = function () {
103        jQuery('.ycd-circle-wrapper').each(function () {
104            var scaleDegree =  jQuery(this).width()/jQuery('.ycd-time-circle', this).width();
105
106            if(jQuery('.ycd-time-circle', this).width() > jQuery(this).width()) {
107                jQuery('.ycd-time-circle', this).css({
108                    'transform': 'scale('+ scaleDegree +', '+scaleDegree+')'
109                });
110            }
111            else {
112                jQuery('.ycd-time-circle', this).css({
113                    'transform': 'scale('+ 1 +', '+1+')'
114                });
115            }
116        });
117    };
118
119    scale();
120    jQuery(window).resize(function () {
121        scale();
122    })
123};
124
125YcdCountdown.prototype.contentClick = function() {
126    var allOptions = this.allOptions;
127
128    if(allOptions && allOptions['ycd-countdown-content-click']) {
129    	var id = allOptions['id'];
130    	var circleWrapper = jQuery('.ycd-circle-'+id+'-wrapper');
131        circleWrapper.css({'cursor': 'pointer'});
132        circleWrapper.bind('click', function () {
133        	if(allOptions['ycd-countdown-content-click-url-tab']) {
134                window.open(allOptions['ycd-countdown-content-click-url']);
135			}
136			else {
137                window.location.href = allOptions['ycd-countdown-content-click-url'];
138			}
139        });
140	}
141};
142
143YcdCountdown.prototype.imageUpload = function() {
144	var custom_uploader;
145	jQuery('#js-upload-image-button').click(function(e) {
146		e.preventDefault();
147
148		/* If the uploader object has already been created, reopen the dialog */
149		if (custom_uploader) {
150			custom_uploader.open();
151			return;
152		}
153		/* Extend the wp.media object */
154		custom_uploader = wp.media.frames.file_frame = wp.media({
155			titleFF: 'Choose Image',
156			button: {
157				text: 'Choose Image'
158			},
159			multiple: false
160		});
161		/* When a file is selected, grab the URL and set it as the text field's value */
162		custom_uploader.on('select', function() {
163			var attachment = custom_uploader.state().get('selection').first().toJSON();
164			var imageURL = jQuery('#ycd-bg-image-url');
165			imageURL.val(attachment.url);
166			imageURL.trigger('change');
167		});
168		/* Open the uploader dialog */
169		custom_uploader.open();
170	});
171
172	/* its finish image uploader */
173};
174
175YcdCountdown.prototype.ionRangeSlider= function() {
176
177	var that = this;
178	var circleWidth = jQuery('#ycd-circle-width');
179
180	if(!circleWidth.length) {
181		return false;
182	}
183	circleWidth.ionRangeSlider({
184		hide_min_max: true,
185		keyboard: true,
186		min: 0.0033333333333333335,
187		max: 0.13333333333333333,
188		type: 'single',
189		step: 0.003333333,
190		prefix: '',
191		grid: false
192	}).change(function() {
193		var val = jQuery(this).val();
194		that.changeOption('fg_width', val);
195		that.build();
196	});
197
198	jQuery('#ycd-js-circle-bg-width').ionRangeSlider({
199		hide_min_max: true,
200		keyboard: true,
201		min: 0.1,
202		max: 3,
203		type: 'single',
204		step: 0.1,
205		prefix: '',
206		grid: false
207	}).change(function() {
208		var val = jQuery(this).val();
209		that.changeOption('bg_width', val);
210		that.build();
211	});
212
213	jQuery('#ycd-js-circle-start-angle').ionRangeSlider({
214		hide_min_max: true,
215		keyboard: true,
216		min: 0,
217		max: 360,
218		type: 'single',
219		step: 10,
220		prefix: '',
221		grid: false
222	}).change(function() {
223		var val = jQuery(this).val();
224		that.changeOption('start_angle', val);
225		that.build();
226	});
227};
228
229YcdCountdown.prototype.minicolors = function() {
230	var minicolors = jQuery('.js-ycd-time-color');
231
232	if(!minicolors.length) {
233		return false;
234	}
235	var circle = jQuery('.ycd-time-circle');
236
237	minicolors.minicolors({
238		format: 'rgb',
239		opacity: 1,
240		change: function() {
241			var color = jQuery(this).val();
242			var timeName = jQuery(this).data('time-type');
243			var options = circle.data('options');
244			options.time[timeName].color = color;
245			circle.data('options', options);
246			circle.TimeCircles(options).rebuild();
247		}
248	});
249};
250
251YcdCountdown.prototype.livePreview = function() {
252	this.changeDateType();
253	this.chnageDateDuration();
254	this.changeWooCountdownDate();
255	this.changeDate();
256	this.changeTimeZone();
257	this.changeCountsAnimation();
258	this.changeCountsDirection();
259	this.changeBackgroundCircle();
260	this.changeDimension();
261	this.changeSwitchTextAndNumber();
262	this.changeTimesStatus();
263	this.changeTimesText();
264	this.changeBackgroundImage();
265	this.circleBgColor();
266	this.changeFontSize();
267	this.changeFontWeight();
268	this.changeFontStyle();
269	this.changeFontFamily();
270	this.changeTextColor();
271	this.changePadding();
272	this.changeAlignment();
273	this.changeNumberStyles();
274
275	/* change schedule */
276	this.changeScheduleWeekDay();
277	this.changeScheduleHour();
278	this.changeSchedileTimeZone();
279};
280
281YcdCountdown.prototype.changeSchedileTimeZone = function() {
282	var timeZone = jQuery('.js-ycd-schedule-time-zone');
283
284	if(!timeZone.length) {
285		return false;
286	}
287	that = this;
288	var countdowns = jQuery('.ycd-time-circle');
289	timeZone.bind('change', function() {
290		var name = jQuery(this).attr('name');
291		var val = jQuery('option:selected', this).val();
292		var options = countdowns.data('options');
293		options[name] = val;
294		countdowns.data('options', options);
295		countdowns = that.addTimeToClock(options, countdowns);
296		jQuery('.ycd-time-circle').TimeCircles().restart();
297	});
298};
299
300YcdCountdown.prototype.changeScheduleHour = function() {
301	var hours = jQuery('.js-datetimepicker-seconds');
302
303	if(!hours.length) {
304		return false;
305	}	
306
307	var countdowns = jQuery('.ycd-time-circle');
308	hours.bind('change', function() {
309		var name = jQuery(this).attr('name');
310		var val = jQuery(this).val();
311		var options = countdowns.data('options');
312		options[name] = val;
313		countdowns.data('options', options);
314		countdowns = that.addTimeToClock(options, countdowns);
315		jQuery('.ycd-time-circle').TimeCircles().restart();
316	});
317}
318
319YcdCountdown.prototype.changeScheduleWeekDay = function() {
320	var weekDay = jQuery('.ycd-date-week-day');
321
322	if(!weekDay.length) {
323		return false;
324	}
325	that = this;
326	var countdowns = jQuery('.ycd-time-circle');
327	weekDay.bind('change', function() {
328		var name = jQuery(this).attr('name');
329		var val = jQuery('option:selected', this).val();
330		var options = countdowns.data('options');
331		options[name] = val;
332		options[jQuery(this).data('week-number-key')] = YcdCountdownProFunctionality.weekDayNumberFromName(val);
333		countdowns.data('options', options);
334		countdowns = that.addTimeToClock(options, countdowns);
335		jQuery('.ycd-time-circle').TimeCircles().restart();
336	})
337};
338
339YcdCountdown.prototype.changeDateType = function() {
340	var types = jQuery('.ycd-date-type');
341
342	if(!types.length) {
343		return false;
344	}
345	that = this;
346	var countdowns = jQuery('.ycd-time-circle');
347	types.bind('change', function() {
348		var val = jQuery(this).val();
349		var timeName = jQuery(this).attr('name');
350		var options = countdowns.data('options');
351		options[timeName] = val;
352		countdowns.data('options', options);
353		countdowns = that.addTimeToClock(options, countdowns);
354		jQuery('.ycd-time-circle').TimeCircles().restart();
355	});
356};
357
358YcdCountdown.prototype.chnageDateDuration = function() {
359	var types = jQuery('.ycd-timer-time-settings');
360
361	if(!types.length) {
362		return false;
363	}
364	that = this;
365	var countdowns = jQuery('.ycd-time-circle');
366	types.bind('change', function() {
367		var val = jQuery(this).val();
368		var timeName = jQuery(this).attr('name');
369		var options = countdowns.data('options');
370		options[timeName] = val;
371		countdowns.data('options', options);
372		that.addTimeToClock(options, countdowns);
373		jQuery('.ycd-time-circle').TimeCircles().restart();
374	});
375};
376
377YcdCountdown.prototype.changeWooCountdownDate = function() {
378	var types = jQuery('.js-ycd-woo-coupon');
379
380	if(!types.length) {
381		return false;
382	}
383	that = this;
384	var countdowns = jQuery('.ycd-time-circle');
385	types.bind('change', function() {
386		var val = jQuery('.ycd-woo-coupon-date').val();
387		val.replace('/', '-')+' 00:00:00';
388		var selectedTimezone = jQuery('.js-ycd-woo-time-zone option:selected').val();
389		var seconds = that.setCounterTime(val, selectedTimezone);
390		jQuery('.ycd-time-circle').data('timer', seconds).TimeCircles().restart();
391	});
392};
393
394YcdCountdown.prototype.changeAlignment = function() {
395	var alignment = jQuery('.ycd-circle-alignment');
396
397	if(!alignment.length) {
398		return false;
399	}
400
401	alignment.bind('change', function() {
402		var align = jQuery('option:selected', this).val();
403		jQuery('.ycd-circle-wrapper').css({'text-align': align})
404	})
405};
406
407YcdCountdown.prototype.changePadding = function() {
408	var padding = jQuery('#ycd-countdown-padding');
409
410	if(!padding.length) {
411		return false;
412	}
413
414	padding.bind('change', function() {
415		var padding = jQuery(this).val();
416		padding = parseInt(padding) + 'px';
417		jQuery('.ycd-time-circle').css({'padding': padding})
418	});
419};
420
421YcdCountdown.prototype.changeTextColor = function() {
422	var textColor = jQuery('.js-ycd-time-text-color');
423
424	if(!textColor.length) {
425		return false;
426	}
427
428	textColor.minicolors({
429		format: 'rgb',
430		opacity: 1,
431		change: function() {
432			var color = jQuery(this).val();
433			var type = jQuery(this).data('time-type');
434			jQuery('.textDiv_'+type+' h4, '+'.textDiv_'+type+' span').css({color: color});
435		}
436	});
437};
438
439YcdCountdown.prototype.changeFontFamily = function() {
440	var fonts = jQuery('.js-countdown-font-family');
441
442	if(!fonts.length) {
443		return false;
444	}
445	var that = this;
446
447	fonts.bind('change', function() {
448		that.changeTextStyles();
449	});
450};
451
452YcdCountdown.prototype.changeFontWeight = function() {
453	var fontWeight = jQuery('.js-countdown-font-weight');
454
455	if(!fontWeight.length) {
456		return false
457	}
458	var that = this;
459
460	fontWeight.bind('change', function() {
461		that.changeTextStyles();
462	});
463};
464
465YcdCountdown.prototype.changeFontStyle = function() {
466	var fontStyle = jQuery('.js-countdown-font-style');
467
468	if(!fontStyle.length) {
469		return false
470	}
471	var that = this;
472
473	fontStyle.bind('change', function() {
474		that.changeTextStyles();
475	});
476};
477
478YcdCountdown.prototype.changeFontSize = function() {
479	var fontSize = jQuery('.js-countdown-font-size, .js-countdown-text-style');
480
481	if(!fontSize) {
482		return false;
483	}
484	var that = this;
485
486	fontSize.bind('change', function() {
487		that.changeTextStyles();
488	});
489};
490
491YcdCountdown.prototype.changeTextStyles = function() {
492	var circle = jQuery('.ycd-time-circle');
493	var fontSize = jQuery('.js-countdown-font-size').val()+'px';
494	var marginTop = jQuery('.js-countdown-text-margin-top').val()+'px';
495	var fontWeight = jQuery('.js-countdown-font-weight').val();
496	var fontFamily = jQuery('.js-countdown-font-family').val();
497	var fontStyle = jQuery('.js-countdown-font-style').val();
498
499	circle.find('h4').each(function() {
500		jQuery(this).attr('style',
501			'font-size: ' + fontSize+' !important;' +
502			'margin-top: ' + marginTop+' !important;' +
503			'font-weight: ' + fontWeight+' !important;' +
504			'font-family:' + fontFamily + '!important;'+
505			'font-style:' + fontStyle + '!important'
506		);
507	})
508};
509
510YcdCountdown.prototype.changeNumberStyles = function() {
511	var changeNumberTarget = jQuery('.js-countdown-number-size,.js-countdown-number-font-we
511ight, .js-countdown-number-font, .js-countdown-number-font-style, .js-countdown-number-style');
512	var that = this;
513
514	if(!changeNumberTarget.length) {
515		return false;
516	}
517	changeNumberTarget.bind('change', function() {
518		that.setNumberStyles();
519	});
520};
521
522YcdCountdown.prototype.setNumberStyles = function() {
523	var circle = jQuery('.ycd-time-circle');
524	var fontSize = jQuery('.js-countdown-number-size').val()+'px';
525	var marginTop = jQuery('.js-countdown-number-margin-bottom').val()+'px';
526	var fontWeight = jQuery('.js-countdown-number-font-weight').val();
527	var fontFamily = jQuery('.js-countdown-number-font').val();
528	var fontStyle = jQuery('.js-countdown-number-font-style').val();
529
530	circle.find('span').each(function() {
531		jQuery(this).attr('style',
532			'font-size: ' + fontSize+' !important;' +
533			'margin-top: ' + marginTop+' !important;' +
534			'font-weight: ' + fontWeight+' !important;' +
535			'font-family:' + fontFamily + '!important;'+
536			'font-style:' + fontStyle + '!important'
537		);
538	})
539};
540
541YcdCountdown.prototype.circleBgColor = function() {
542	var countdownBgCircleColor = jQuery('.js-countdown-bg-circle-color');
543
544	if(!countdownBgCircleColor.length) {
545		return false;
546	}
547	var that = this;
548
549	countdownBgCircleColor.minicolors({
550		format: 'rgb',
551		opacity: 1,
552		change: function() {
553			var color = jQuery(this).val();
554			that.changeOption('circle_bg_color', color);
555			that.build();
556		}
557	});
558};
559
560YcdCountdown.prototype.changeBackgroundImage = function() {
561	var bgSize = jQuery('.js-ycd-bg-size');
562
563	if(!bgSize.length) {
564		return false;
565	}
566	var circle = jQuery('.ycd-time-circle');
567	bgSize.bind('change', function() {
568		var val = jQuery(this).val();
569		circle.css({'background-size': val});
570	});
571
572	jQuery('.js-bg-image-repeat').bind('change', function() {
573		var val = jQuery(this).val();
574		circle.css({'background-repeat': val});
575	});
576
577	jQuery('#ycd-bg-image-url').bind('change', function() {
578		var url = jQuery(this).val();
579		circle.css('background-image', 'url('+url+')');
580	});
581};
582
583YcdCountdown.prototype.changeSwitchTextAndNumber = function () {
584	var switchNumber = jQuery('#ycd-countdown-switch-number');
585	if(!switchNumber) {
586		return false;
587	}
588	var that = this;
589	switchNumber.bind('change', function () {
590		var isChecked = jQuery(this).is(':checked');
591		that.changeOption('ycd-countdown-switch-number', isChecked);
592		that.build();
593	});
594};
595
596YcdCountdown.prototype.changeTimesText = function() {
597	var times = jQuery('.js-ycd-time-text');
598	if(!times) {
599		return false;
600	}
601	var circle = jQuery('.ycd-time-circle');
602	times.each(function() {
603		jQuery(this).bind('input', function() {
604			var val = jQuery(this).val();
605			var timeName = jQuery(this).data('time-type');
606			var options = circle.data('options');
607			options.time[timeName].text = val;
608			circle.data('options', options);
609			jQuery('.ycd-time-circle').TimeCircles(options).rebuild();
610		})
611	});
612};
613
614YcdCountdown.prototype.changeTimesStatus = function() {
615	var times = jQuery('.js-ycd-time-status');
616	if(!times) {
617		return false;
618	}
619	var circle = jQuery('.ycd-time-circle');
620	times.each(function() {
621		jQuery(this).bind('change', function() {
622			var status = jQuery(this).is(':checked') ? 'checked' : '';
623			var timeName = jQuery(this).data('time-type');
624			var options = circle.data('options');
625			options.time[timeName].show = status;
626			circle.data('options', options);
627			circle.TimeCircles(options).rebuild();
628		})
629	});
630};
631
632YcdCountdown.prototype.setCounterTime = function(calendarValue, selectedTimezone) {
633
634	var currentDate = ycdmoment(new Date()).tz(selectedTimezone).format('MM/DD/YYYY H:m:s');
635
636	var dateTime = new Date(currentDate).valueOf();
637	var timeNow = Math.floor(dateTime / 1000);
638	var seconds = Math.floor(new Date(calendarValue).getTime() / 1000) - timeNow;
639	if (seconds < 0) {
640		seconds = 0;
641	}
642
643	return seconds;
644};
645
646YcdCountdown.prototype.changeDate = function() {
647	var datePicker = jQuery('#ycd-date-time-picker');
648	if(!datePicker.length) {
649		return false;
650	}
651	var that = this;
652
653	datePicker.change(function () {
654		var val = jQuery(this).val()+':00';
655		var selectedTimezone = jQuery('.js-circle-time-zone option:selected').val();
656		var seconds = that.setCounterTime(val, selectedTimezone);
657		jQuery('.ycd-time-circle').data('timer', seconds).TimeCircles().restart();
658	})
659};
660
661YcdCountdown.prototype.changeTimeZone = function() {
662	var timeZone = jQuery('.js-circle-time-zone');
663
664	if(!timeZone.length) {
665		return false;
666	}
667	var that = this;
668
669	timeZone.bind('change', function() {
670		var timeZone = jQuery('option:selected', this).val();
671		var date = jQuery('#ycd-date-time-picker').val()+':00';
672		var seconds = that.setCounterTime(date, timeZone);
673		jQuery('.ycd-time-circle').data('timer', seconds).TimeCircles().restart();
674	});
675};
676
677YcdCountdown.prototype.changeOption = function(name, value) {
678	var circle = jQuery('.ycd-time-circle');
679	var options = circle.data('options');
680	options[name] = value;
681	circle.data('options', options);
682};
683
684YcdCountdown.prototype.build = function() {
685	var circle = jQuery('.ycd-time-circle');
686	var options = circle.data('options');
687	circle.TimeCircles(options).rebuild();
688};
689
690YcdCountdown.prototype.changeCountsAnimation = function() {
691	var animation = jQuery('.js-circle-animation');
692	var that = this;
693
694	if(!animation.length) {
695		return false;
696	}
697
698	animation.bind('change', function() {
699		var val = jQuery(this).val();
700		that.changeOption('animation', val);
701		that.build();
702	})
703};
704
705YcdCountdown.prototype.changeCountsDirection = function() {
706	var direction = jQuery('.js-ycd-direction');
707	if(!direction.length) {
708		return false;
709	}
710	var that = this;
711	direction.bind('change', function() {
712		var val = jQuery(this).val();
713		that.changeOption('direction', val);
714		that.build();
715	})
716};
717
718YcdCountdown.prototype.changeBackgroundCircle = function() {
719	var backgroundCircle = jQuery('.js-ycd-background-circle');
720	if(!backgroundCircle.length) {
721		return false;
722	}
723	var that = this;
724	backgroundCircle.bind('change', function() {
725		var val = jQuery(this).is(':checked');
726		that.changeOption('use_background', val);
727		that.build();
728	})
729};
730
731YcdCountdown.prototype.changeDimension = function() {
732	var dimension = jQuery('.js-ycd-dimension');
733	if(!dimension.length) {
734		return false;
735	}
736	var that = this;
737	dimension.bind('change', function() {
738		var number = jQuery('.js-ycd-dimension-number').val();
739		number = parseInt(number);
740		var measure = jQuery('.js-ycd-dimension-measure').val();
741		var width = number+measure;
742		jQuery('.ycd-time-circle').css({'width': width});
743		that.build();
744	});
745};
746
747YcdCountdown.prototype.startTimeCircle = function() {
748	var that = this;
749	var circle = jQuery('.ycd-time-circle');
750
751	if(!circle.length) {
752		return false;
753	}
754	circle.each(function() {
755		var options = jQuery(this).attr('data-options');
756		var allOptions = jQuery(this).data('all-options');
757		options = jQuery.parseJSON(options);
758		var endDate = jQuery(this).data('date');
759
760		if(new Date(endDate) - Date.now() <= 0) {
761			that.endBehavior(jQuery(this), allOptions)
762		}
763
764		that.addTimeToClock(options, jQuery(this));
765		if (jQuery(this).data('expired')) {
766			options['countdownExpired'] = true;
767        }
768		that.setOptions(options);
769		that.setAllOptions(allOptions);
770		that.render(jQuery(this));
771		jQuery(window).trigger('ycdCircleReady');
772	});
773};
774
775YcdCountdown.prototype.addTimeToClock = function(options, countDown) {
776
777	var seconds = this.getSeconds(options);
778
779    countDown.data('expired', false);
780	if (seconds == 0) {
781        countDown.data('expired', true);
782	}
783	
784	countDown.data('timer', seconds);
785
786	return countDown;
787};
788
789YcdCountdown.prototype.render = function(currentCountdown) {
790	var that = this;
791	var options = this.getOptions();
792	var allOptions = this.getAllOptions();
793	
794	if (currentCountdown.data('timer') <= 0) {
795		that.endBehavior(currentCountdown, allOptions);
796	}
797	var countdown = currentCountdown.TimeCircles(options).addListener(countdownComplete);
798	function countdownComplete(unit, value, total){
799
800		if(total <= 0){
801			that.endBehavior(jQuery(this), allOptions);
802		}
803	}
804
805	jQuery(window).resize(function() {
806		countdown.rebuild();
807	});
808};
809
810YcdCountdown.prototype.endBehavior = function(countdown, options) {
811
812	if(YcdArgs.isAdmin || options['ycd-countdown-expire-behavior'] == 'countToUp') {
813		return false;
814	}
815	if (options['ycd-countdown-end-sound']) {
816		var soundUrl = options['ycd-countdown-end-sound-url'];
817		var song = new Audio (soundUrl);
818		song.play();
819	}
820
821	var id = options.id;
822	var behavior = options['ycd-countdown-expire-behavior'];
823	var expireText = options['ycd-expire-text'];
824	var expireUrl = options['ycd-expire-url'];
825	var countdownWrapper = countdown.parents('.ycd-countdown-wrapper').first();
826
827	jQuery(window).trigger('YcdExpired', {'id':  id});
828
829	switch(behavior) {
830		case 'hideCountdown':
831			jQuery(window).trigger('ycdHideCountdown', options);
832			countdownWrapper.hide();
833			break;
834		case 'showText':
835			countdown.fadeOut('slow').replaceWith(expireText);
836			break;
837		case 'redirectToURL':
838			countdownWrapper.fadeOut('slow');
839			window.location.href = expireUrl;
840			break;
841	}
842};
843
844jQuery(document).ready(function () {
845	new YcdCountdown();
846});

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.