HEX
Server: nginx/1.24.0
System: Linux server 6.12.74+deb13+1-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.74-2 (2026-03-08) x86_64
User: www (1001)
PHP: 8.5.2
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/claudiayancor.duckdns.org/wp-content/plugins/countdown-builder/assets/js/YcdGeneral.js
function YcgGeneral() {

}

YcgGeneral.prototype.getSeconds = function (options) {
	var seconds = 0;
	if(options['ycd-countdown-date-type'] == 'dueDate') {
		var val = options['ycd-date-time-picker']+':00';
		val = val.replace(/-/g, '/');
		var selectedTimezone = options['ycd-time-zone'];
		var seconds = this.setCounterTime(val, selectedTimezone);
	}
	else if(options['ycd-countdown-date-type'] == 'schedule') {
		var seconds = YcdCountdownProFunctionality.schedule(options);
	}
	else if(options['ycd-countdown-date-type'] == 'schedule2') {
		var seconds = YcdCountdownProFunctionality.schedule2(options);
	}
	else if(options['ycd-countdown-date-type'] == 'wooCoupon') {
		var val = options['ycd-woo-coupon-date'];
		val.replace('/', '-')+' 00:00:00';
		var selectedTimezone = options['ycd-woo-time-zone'];
		var seconds = this.setCounterTime(val, selectedTimezone);
	}
	else {

		var seconds = this.countDurationSeconds(options);
		if (options['ycd-countdown-save-duration']) {
			if (options['ycd-countdown-save-duration-each-user']) {
				var id = options['id'];
				seconds = YcdCountdownProFunctionality.durationSeconds(seconds, options, id);
			}
			else {
				seconds = options['ycd-timer-seconds'];
			}
		}

		if (options['ycd-countdown-restart']) {
			if (YcdCountdownProFunctionality.checkRestartDuration(options)) {
				seconds = this.countDurationSeconds(options);
			}
		}
	}

	return seconds;
};

YcgGeneral.prototype.setCounterTime = function(calendarValue, selectedTimezone) {
    var currentDate = ycdmoment(new Date()).tz(selectedTimezone).format('MM/DD/YYYY H:m:s');

    var dateTime = new Date(currentDate).valueOf();
    var timeNow = Math.floor(dateTime / 1000);
    var seconds = Math.floor(new Date(calendarValue).getTime() / 1000) - timeNow;
    if (seconds < 0) {
        seconds = 0;
    }

    return seconds;
};

YcgGeneral.prototype.countDurationSeconds = function (options) {
	var days = parseInt(options['ycd-countdown-duration-days']);
	var hours = parseInt(options['ycd-countdown-duration-hours']);
	var minutes = parseInt(options['ycd-countdown-duration-minutes']);
	var secondsSaved = parseInt(options['ycd-countdown-duration-seconds']);

	var seconds = days*86400 + hours*60*60 + minutes*60 + secondsSaved;

	return seconds;
};

YcgGeneral.prototype.endBehavior = function(cd, options) {
	if(YCD_GENERAL_ARGS.isAdmin) {
		return false;
	}
	if (options['ycd-countdown-end-sound']) {
		var soundUrl = options['ycd-countdown-end-sound-url'];
		var song = new Audio (soundUrl);
		song.play();
	}
	var id = parseInt(options['id']);
	var behavior = options['ycd-countdown-expire-behavior'];

	jQuery(window).trigger('YcdExpired', {'id':  id});

	switch (behavior) {
		case 'hideCountdown':
			cd.remove();
			break;
		case 'redirectToURL':
			cd.remove();
			window.location.href = (options['ycd-expire-url']);
			break;
		case 'showText':
			cd.replaceWith(options['ycd-expire-text']);
			break;
	}
};