-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
56 lines (47 loc) · 2.09 KB
/
main.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
44
45
46
47
48
49
50
51
52
53
54
55
56
$(".message").dialog({
autoOpen: false,
draggable: false,
click: function() {
$( this ).dialog( "close" );
},
dialogClass: 'dialogue-box'
})
$(".music").dialog({
autoOpen: false,
draggable: false,
click: function() {
$( this ).dialog( "close" );
},
dialogClass: 'dialogue-box'
})
$('#earth').on('dblclick', function(){
$('.message').dialog('open')
})
$('#kanye').on('dblclick', function(){
$('.music').dialog('open')
})
$(function() {
$(".icon").draggable({containment: '.canvas'});
$('.music-icon').draggable({containment: '.kanye-music'})
})
document.addEventListener('DOMContentLoaded', function(){
function setTime(){
var objToday = new Date(),
weekday = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'),
dayOfWeek = weekday[objToday.getDay()],
domEnder = function() { var a = objToday; if (/1/.test(parseInt((a + "").charAt(0)))) return "th"; a = parseInt((a + "").charAt(1)); return 1 == a ? "st" : 2 == a ? "nd" : 3 == a ? "rd" : "th" }(),
dayOfMonth = today + ( objToday.getDate() < 10) ? '0' + objToday.getDate() + domEnder : objToday.getDate() + domEnder,
months = new Array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'July', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'),
curMonth = months[objToday.getMonth()],
curYear = objToday.getFullYear(),
curHour = objToday.getHours() > 12 ? objToday.getHours() - 12 : (objToday.getHours() < 10 ? "0" + objToday.getHours() : objToday.getHours()),
curMinute = objToday.getMinutes() < 10 ? "0" + objToday.getMinutes() : objToday.getMinutes(),
curSeconds = objToday.getSeconds() < 10 ? "0" + objToday.getSeconds() : objToday.getSeconds(),
curMeridiem = objToday.getHours() > 12 ? "PM" : "AM";
var today = curHour + ":" + curMinute + "." + curSeconds + curMeridiem + " " + dayOfWeek + " " + dayOfMonth + " of " + curMonth + ", " + curYear;
var time = document.querySelector('#time')
time.innerHTML = `POTUS ${curHour}:${curMinute}${curMeridiem} - ${curMonth} ${dayOfMonth}, 2049`
setTimeout(setTime, 1000)
}
setTime()
})