| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,55 @@ |
| 1 |
+<?php |
|
| 2 |
+if(!defined("_CHARSET")) exit( );
|
|
| 3 |
+if(file_exists(_BASEDIR."blocks/countdown/".$language.".php")) include(_BASEDIR."blocks/countdown/".$language.".php"); |
|
| 4 |
+else include(_BASEDIR."blocks/countdown/en.php"); |
|
| 5 |
+ |
|
| 6 |
+if(empty($blocks['countdown']['target'])) {
|
|
| 7 |
+ $content = _NOCOUNTDOWN; |
|
| 8 |
+} |
|
| 9 |
+else {
|
|
| 10 |
+$target = $blocks['countdown']['target']; |
|
| 11 |
+if(empty($blocks['countdown']['CDformat'])) $CDformat = _COUNTDOWNFORMAT; |
|
| 12 |
+else $CDformat = $blocks['countdown']['CDformat']; |
|
| 13 |
+if(empty($blocks['countdown']['CDfinal'])) $CDfinal = _COUNTDOWNOVER; |
|
| 14 |
+else $CDfinal = $blocks['countdown']['CDfinal']; |
|
| 15 |
+ |
|
| 16 |
+ $content = '<span id="countdown"></span> |
|
| 17 |
+<script language="JavaScript" type="text/javascript"> |
|
| 18 |
+ |
|
| 19 |
+TargetDate = "'.$target.'"; |
|
| 20 |
+DisplayFormat = "'.$CDformat.'"; |
|
| 21 |
+FinishMessage = "'.$CDfinal.'"; |
|
| 22 |
+ |
|
| 23 |
+function CountBack(secs) {
|
|
| 24 |
+ if (secs < 0) {
|
|
| 25 |
+ document.getElementById("countdown").innerHTML = FinishMessage;
|
|
| 26 |
+ return; |
|
| 27 |
+ } |
|
| 28 |
+ origSecs = secs; |
|
| 29 |
+ days = Math.floor(secs / (60 * 60 * 24)); |
|
| 30 |
+ secs %= (60 * 60 * 24); |
|
| 31 |
+ hours = Math.floor(secs / (60 * 60)); |
|
| 32 |
+ secs %= (60 * 60); |
|
| 33 |
+ minutes = Math.floor(secs / 60); |
|
| 34 |
+ secs %= 60; |
|
| 35 |
+ seconds = secs; |
|
| 36 |
+ |
|
| 37 |
+ DisplayStr = DisplayFormat.replace(/{days}/g, days);
|
|
| 38 |
+ DisplayStr = DisplayStr.replace(/{hours}/g, hours);
|
|
| 39 |
+ DisplayStr = DisplayStr.replace(/{minutes}/g, minutes);
|
|
| 40 |
+ DisplayStr = DisplayStr.replace(/{seconds}/g, seconds);
|
|
| 41 |
+ |
|
| 42 |
+ document.getElementById("countdown").innerHTML = DisplayStr;
|
|
| 43 |
+ setTimeout("CountBack(" + (origSecs - 1) + ")", SetTimeOutPeriod);
|
|
| 44 |
+} |
|
| 45 |
+var SetTimeOutPeriod = 1000; |
|
| 46 |
+ |
|
| 47 |
+var dateTarget = new Date(TargetDate); |
|
| 48 |
+var dateNow = new Date(); |
|
| 49 |
+ dateDiff = new Date(dateTarget - dateNow); |
|
| 50 |
+gsecs = Math.floor(dateDiff.valueOf()/1000); |
|
| 51 |
+CountBack(gsecs); |
|
| 52 |
+</script> |
|
| 53 |
+'; |
|
| 54 |
+} |
|
| 55 |
+?> |
|
| 0 | 56 |
\ No newline at end of file |