کد:
<?php
/**
* @version 1.0 $
* @package HelloWorld
* @copyright (C) 2005 Andrew Eddie
* @license [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید] GNU/GPL
*/
/*
* You may use and distribute this script as you like.
* But unless you make major changes in the code I would prefer
* that you retained my email below as author.
*
* [مهمان/کاربر گرامی برای دیدن لینک ها ابتدا باید عضو سایت شوید و لاگین کنید برای ثبت نام اینجا کلیک کنید]
*/
/** ensure this file is being included by a parent file */
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
// Retreive parameters
$event = $params->get( 'event', '' );
$year = intval( $params->get( 'year', '2005' ) );
$month = intval( $params->get( 'month', '0' ) ) - 1;
$day = intval( $params->get( 'day', '1' ) );
$hour = intval( $params->get( 'hour', '0' ) ) + 1;
$min = intval( $params->get( 'min', '0' ) );
$sec = intval( $params->get( 'sec', '0' ) );
echo "<script language='JavaScript'>";
echo "var event = \"$event\";";
echo "var eYear = $year;";
echo "var eMonth = $month;";
echo "var eDay = $day;";
echo "var eHour = $hour;";
echo "var eMinute = $min;";
echo "var eSecond = $sec;";
?>
var debugOn = false;
function debug(str) { if (debugOn==true) debugOn = confirm(str); };
function setTarget ( tid, year, month, day, hour, minute, second ) {
this.tEvent = tid; // string
this.tYear = year; // range 1970..2037
this.tMonth = month; // range 0..11 (jan=0, dec=11)
this.tDay = day; // range 0..31
this.tHour = hour; // range 0..23
this.tMinute = minute; // range 0..59
this.tSecond = second; // range 0..59
this.tDate = new Date( year, month, day, hour, minute, second );
this.t = Date.parse( this.tDate.toGMTString() );
debug ("setTarget: tSecond = " +this.tSecond);
return this;
}; // end setTarget( ... ) -> object
var target = new setTarget ( event, eYear, eMonth, eDay, eHour, eMinute, eSecond );
function setDelta() {
this.nDate = new Date();
this.n = Date.parse( this.nDate.toGMTString() );
this.dSecond = Math.round( ( target.t -this.n ) / 1000 );
debug ("setTarget: dSecond = " +this.dSecond);
if ( 0 > this.dSecond ) {
this.dSecond = -this.dSecond;
this.d = 1;
} else {
this.d = -1;
};
this.dMinute = Math.floor( this.dSecond/60 );
this.dSecond = this.dSecond -(this.dMinute * 60)
this.dHour = Math.floor( this.dMinute/60 );
this.dMinute = this.dMinute -(this.dHour * 60)
this.dDay = Math.floor( this.dHour/24 );
this.dHour = this.dHour -(this.dDay * 24);
return this;
}; // end setTarget( ... ) -> object
var delta = new setDelta ();
var digits = new Array( "0", "1", "2", "3",
"4", "5", "6", "7", "8", "9", "none" );
for (i=0; digits.length>i; i++) {
digits[i] = "modules/mod_countdown/ciffer"+digits[i]+".gif";
};
var imgOff = -1; // index of document.images["c0"];
var charTab = "0123456789 "; // de anvendte billeder
function showVal ( val, size, offset ) {
var i = 0;
if (0 > imgOff) {
for (i=0; (document.images.length>i) && (0>imgOff); i++) {
if (document.images[i]==document.images.c0) {
imgOff = i;
}; //endif
}; //endfor
if (0 > imgOff ) {
debug( "showVal: imgOff value not found" );
} else { debug( "showVal: imgOff = " +imgOff );
}; //endif
}; //endif
var txVal = ": "+val;
txVal = txVal.substring(txVal.length-size);
for (i=0; txVal.length>i; i++) {
document.images[i+offset+imgOff].src =
digits[ charTab.indexOf( txVal.substring(i,i+1) ) ]
}; //endfor
}; //end showVal ( number, length, offset )
var updateHand = setTimeout("showTimeLeft()",1000);
function showTimeLeft() {
updateHand = setTimeout("showTimeLeft()",990);
//note: ms parameter fudged a bit to compensate for time betveen calls
var increment = delta.d;
delta.dSecond += increment;
if ( (0 > delta.dSecond)
||(delta.dSecond >59) ) {
delta = new setDelta();
if (delta.d != increment) window.location.reload();
};
showVal( delta.dDay, 4, 0 );
showVal( delta.dHour, 2, 4 );
showVal( delta.dMinute, 2, 6 );
showVal( delta.dSecond, 2, 8 );
}; //end showTimeLeft()
// --> </script>
<p>
<center><FONT SIZE="1"><nobr>&nbsp;
<img src="modules/mod_countdown/ciffernone.gif" align='absmiddle' name="c0"><img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'><img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'><img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'>
&#1585;&#1608;&#1586; &nbsp;
<img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'><img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'>
&#1587;&#1575;&#1593;&#1578;&nbsp;</nobr>
<nobr>&nbsp;
<img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'><img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'>
&#1583;&#1602;&#1610;&#1602;&#1607; &nbsp; &#1608;
<img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'><img src="modules/mod_countdown/ciffernone.gif" align='absmiddle'>
&#1579;&#1575;&#1606;&#1610;&#1607;</nobr> <br>
<script language='javascript'>
document.write( (delta.d>0)?"&#1576;&#1593;&#1583; ":"until " +target.tEvent );
</script>
</FONT></center>
<!-- End: ligHTCC's Coubtdown Timer -->
علاقه مندی ها (Bookmarks)