Server IP : 108.163.255.210 / Your IP : 3.21.12.41 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/www/Development/js/ |
Upload File : |
//NOTE: This is not my original code. //I found this snippet on a website titled Dev Ingredients. http://devingredients.com/2011/11/building-an-extensible-jquery-countdown-plugin-from-scratch //Dev Ingredients is managed by Catalin Berta. //I'm placing the code here to explore it further, for learning purposes. (function($) { $.fn.countdown = function(options, callback) { //custom 'this' selector thisEl = $(this); // array of custom settings var settings = { 'date': null, 'format': null }; // append the settings array to options if(options) { $.extend(settings, options); } //create the countdown processing function function countdown_proc() { var eventDate = Date.parse(settings.date) / 1000; var currentDate = Math.floor($.now() / 1000); if(eventDate <= currentDate) { callback.call(this); clearInterval(interval); } var seconds = eventDate - currentDate; var days = Math.floor(seconds / (60 * 60 * 24)); //calculate the number of days seconds -= days * 60 * 60 * 24; //update the seconds variable with number of days removed var hours = Math.floor(seconds / (60 * 60)); seconds -= hours * 60 * 60; //update the seconds variable with number of hours removed var minutes = Math.floor(seconds / 60); seconds -= minutes * 60; //update the seconds variable with number of minutes removed //conditional statements if (days == 1) { thisEl.find(".timeRefDays").text("day"); } else { thisEl.find(".timeRefDays").text("days"); } if (hours == 1) { thisEl.find(".timeRefHours").text("hour"); } else { thisEl.find(".timeRefHours").text("hours"); } if (minutes == 1) { thisEl.find(".timeRefMinutes").text("mins"); } else { thisEl.find(".timeRefMinutes").text("mins"); } if (seconds == 1) { thisEl.find(".timeRefSeconds").text("secs"); } else { thisEl.find(".timeRefSeconds").text("secs"); } //logic for the two_digits ON setting if(settings.format == "on") { days = (String(days).length >= 2) ? days : "0" + days; hours = (String(hours).length >= 2) ? hours : "0" + hours; minutes = (String(minutes).length >= 2) ? minutes : "0" + minutes; seconds = (String(seconds).length >= 2) ? seconds : "0" + seconds; } //update the countdown's html values. thisEl.find(".days").text(days); thisEl.find(".hours").text(hours); thisEl.find(".minutes").text(minutes); thisEl.find(".seconds").text(seconds); } //run the function countdown_proc(); //loop the function interval = setInterval(countdown_proc, 1000); }; }) (jQuery); // $("#countdown-1,#countdown-2").countdown({ // date: "25 jun 2017 01:00:00", // format: "on" // }, // function() { // alert("Happy New Year!"); // });