Created
May 17, 2021 00:03
-
-
Save blockworks/2f072b9c8e427db23383e302128d1765 to your computer and use it in GitHub Desktop.
時報と時間表示
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>時報と時間表示</title> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<p id="date"></p> | |
<script language="JavaScript"> | |
//時間を表示 | |
function yyyymmddhhmiss() { | |
var date = new Date(); | |
var yyyy = date.getFullYear(); | |
var mm = toDoubleDigits(date.getMonth() + 1); | |
var dd = toDoubleDigits(date.getDate()); | |
var hh = toDoubleDigits(date.getHours()); | |
var mi = toDoubleDigits(date.getMinutes()); | |
var ss = toDoubleDigits(date.getSeconds()) | |
var element = document.getElementById("date"); | |
element.innerHTML = '🇯🇵' + yyyy + '.' + mm + '.' + dd + ' ' + hh + ':' + mi + ':' + ss; | |
ana(hh,mi,ss); | |
}; | |
//時間をゼロ埋め | |
function toDoubleDigits (num) { | |
num += ""; | |
if (num.length === 1) { | |
num = "0" + num; | |
} | |
return num; | |
}; | |
//30分ごとにアナウンス | |
function ana(hh,mi,ss){ | |
if(hh == 23 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0000.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 00 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0030.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 00 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0100.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 01 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0130.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 01 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0200.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 02 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0230.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 02 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0300.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 03 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0330.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 03 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0400.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 04 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0430.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 04 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0500.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 05 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0530.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 05 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0600.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 06 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0630.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 06 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0700.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 07 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0730.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 07 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0800.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 08 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0830.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 08 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/0900.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 09 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/0930.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 09 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1000.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 10 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1030.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 10 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1100.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 11 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1130.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 11 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1200.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 12 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1230.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 12 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1300.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 13 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1330.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 13 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1400.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 14 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1430.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 14 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1500.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 15 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1530.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 15 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1600.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 16 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1630.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 16 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1700.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 17 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1730.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 17 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1800.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 18 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1830.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 18 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/1900.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 19 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/1930.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 19 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/2000.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 20 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/2030.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 20 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/2100.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 21 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/2130.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 21 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/2200.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 22 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/2230.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 22 && mi == 59 && ss == 57){ | |
var audioElem = new Audio('mp3/2300.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
if(hh == 23 && mi == 29 && ss == 27){ | |
var audioElem = new Audio('mp3/2330.mp3'); | |
audioElem.currentTime = 0; | |
audioElem.play(); | |
} | |
} | |
setInterval(yyyymmddhhmiss, 1000); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment