-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
43 lines (37 loc) · 1.07 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function getDate() {
var date = new Date();
var year = date.getFullYear();
var month = ("0" + (date.getMonth() + 1)).slice(-2);
var day = ("0" + date.getDate()).slice(-2);
return "<span id='date-span'>"+year+"-"+month+"-"+day+"</span>";
}
function getTime() {
var time = new Date();
var hours = (time.getHours() < 10? '0' : '') + time.getHours();
var minutes = (time.getMinutes() < 10? '0' : '') + time.getMinutes();
var seconds = (time.getSeconds() < 10? '0' : '') + time.getSeconds();
return hours+":"+minutes
}
function getWeekday() {
var d = new Date();
var weekday = new Array(7);
weekday[0] = "Sun";
weekday[1] = "Mon";
weekday[2] = "Tue";
weekday[3] = "Wed";
weekday[4] = "Thu";
weekday[5] = "Fri";
weekday[6] = "Sat";
return weekday[d.getDay()];
}
function updateTime() {
$('#date-clock-bottom-panel').html("[ "+getDate()+" | "+getWeekday()+" "+getTime()+" ]");
}
function showTime() {
updateTime();
setInterval(updateTime, 1000);
}
$(document).ready(showTime);
$("body").keydown(function(event){
$("#fake-prompt").append(event.key);
})