「開拓街周期時計」(2011/04/17 (日) 17:45:06) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
#javascript(){{
<SCRIPT language=JavaScript>
<!--
window.onload=showday;
var year=2011; //年
var mon=2; //月
var day=22; //日
var hour=22; //時
var min=10 //分
var int_time=5;
var people=169;
var people_add=10;
var max_people=3300;
var xday = new Date(year,mon-1,day,hour,min,00);//基準になる年月日
var date = new Date();
while(date > xday){
var tmpsec = xday.getTime();
xday.setTime(tmpsec + (60*60*int_time*1000));
year = xday.getFullYear(); // 年
mon = xday.getMonth() + 1; // 月
day = xday.getDate(); // 日
hour = xday.getHours(); // 時
people= people+people_add;
if(people > max_people){
people = max_people;
}
}
function showday() {
var nowday = new Date();
var nyear = nowday.getFullYear(); // 年
var nmon = nowday.getMonth() + 1; // 月
var ndate = nowday.getDate(); // 日
var nhour = nowday.getHours(); // 時
var nmin = nowday.getMinutes(); // 分
var nsec = nowday.getSeconds(); // 秒
passtime= xday.getTime()-nowday.getTime()+1000; //今から基準になる日までの経過時間 1/1000秒単位
cnt_day = Math.floor(passtime/(1000*60*60*24));// カウントダウン表示 (日にち) の取得
passtime = passtime -(cnt_day*(1000*60*60*24)); // 経過秒から(日にち)を引く
cnt_hour = Math.floor(passtime/(1000*60*60));// カウントダウン表示 (時) の取得
passtime = passtime -(cnt_hour*(1000*60*60)); // 経過秒から(時)を引く
cnt_min = Math.floor(passtime/(1000*60)); // カウントダウン表示 (分) 取得
passtime = passtime -(cnt_min*(1000*60));// 経過秒から(分)を引く
cnt_sec = Math.floor(passtime/1000);// カウントダウン表示 (秒) 取得
passtime = passtime -(cnt_sec*(1000)); // 経過秒から(秒)を引く
// 分、秒、ミリ秒を2桁で表示する。
if(nmin<10){nmin = '0' + nmin;}
if(nsec<10){nsec = '0' + nsec;}
if(min<10){min = '0' + min;}
if(cnt_min<10){cnt_min = '0' + cnt_min;}
if(cnt_sec<10){cnt_sec = '0' + cnt_sec;}
document.getElementById("tbox").innerHTML = "現在日時"+nyear+"年"+nmon+"月"+ndate+"日"+nhour+"時"+nmin+"分"+nsec+"秒<br>次回周期"+year+"年"+mon+"月"+day+"日"+hour+"時"+min+"分<br><br>建設周期まで"+cnt_hour+"時間"+cnt_min+"分"+cnt_sec+"秒<br><br>人口"+people+"/"+max_people+"<br>";
if((xday - nowday) > 0){
}
else {
var tmpsec = xday.getTime();
xday.setTime(tmpsec + (60*60*int_time*1000));
year = xday.getFullYear(); // 年
mon = xday.getMonth() + 1; // 月
day = xday.getDate(); // 日
hour = xday.getHours(); // 時
people= people+people_add;
if(people > max_people){
people = max_people;
}
}
timerID = setTimeout('showday()', 1000);
}
// -->
</SCRIPT>
}}
#divid(tbox){
}
#javascript(){{
<SCRIPT language=JavaScript>
<!--
window.onload=showday;
var year=2011; //年
var mon=2; //月
var day=22; //日
var hour=22; //時
var min=10 //分
var int_time=5;
var people=169;
var people_add=10;
var max_people=3400;
var xday = new Date(year,mon-1,day,hour,min,00);//基準になる年月日
var date = new Date();
while(date > xday){
var tmpsec = xday.getTime();
xday.setTime(tmpsec + (60*60*int_time*1000));
year = xday.getFullYear(); // 年
mon = xday.getMonth() + 1; // 月
day = xday.getDate(); // 日
hour = xday.getHours(); // 時
people= people+people_add;
if(people > max_people){
people = max_people;
}
}
function showday() {
var nowday = new Date();
var nyear = nowday.getFullYear(); // 年
var nmon = nowday.getMonth() + 1; // 月
var ndate = nowday.getDate(); // 日
var nhour = nowday.getHours(); // 時
var nmin = nowday.getMinutes(); // 分
var nsec = nowday.getSeconds(); // 秒
passtime= xday.getTime()-nowday.getTime()+1000; //今から基準になる日までの経過時間 1/1000秒単位
cnt_day = Math.floor(passtime/(1000*60*60*24));// カウントダウン表示 (日にち) の取得
passtime = passtime -(cnt_day*(1000*60*60*24)); // 経過秒から(日にち)を引く
cnt_hour = Math.floor(passtime/(1000*60*60));// カウントダウン表示 (時) の取得
passtime = passtime -(cnt_hour*(1000*60*60)); // 経過秒から(時)を引く
cnt_min = Math.floor(passtime/(1000*60)); // カウントダウン表示 (分) 取得
passtime = passtime -(cnt_min*(1000*60));// 経過秒から(分)を引く
cnt_sec = Math.floor(passtime/1000);// カウントダウン表示 (秒) 取得
passtime = passtime -(cnt_sec*(1000)); // 経過秒から(秒)を引く
// 分、秒、ミリ秒を2桁で表示する。
if(nmin<10){nmin = '0' + nmin;}
if(nsec<10){nsec = '0' + nsec;}
if(min<10){min = '0' + min;}
if(cnt_min<10){cnt_min = '0' + cnt_min;}
if(cnt_sec<10){cnt_sec = '0' + cnt_sec;}
document.getElementById("tbox").innerHTML = "現在日時"+nyear+"年"+nmon+"月"+ndate+"日"+nhour+"時"+nmin+"分"+nsec+"秒<br>次回周期"+year+"年"+mon+"月"+day+"日"+hour+"時"+min+"分<br><br>建設周期まで"+cnt_hour+"時間"+cnt_min+"分"+cnt_sec+"秒<br><br>人口"+people+"/"+max_people+"<br>";
if((xday - nowday) > 0){
}
else {
var tmpsec = xday.getTime();
xday.setTime(tmpsec + (60*60*int_time*1000));
year = xday.getFullYear(); // 年
mon = xday.getMonth() + 1; // 月
day = xday.getDate(); // 日
hour = xday.getHours(); // 時
people= people+people_add;
if(people > max_people){
people = max_people;
}
}
timerID = setTimeout('showday()', 1000);
}
// -->
</SCRIPT>
}}
#divid(tbox){
}
表示オプション
横に並べて表示:
変化行の前後のみ表示: