-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaeabeu.js
78 lines (59 loc) · 1.79 KB
/
aeabeu.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
$(function() {
function updateGreeting() {
var MORNING = 'morning';
var AFTERNOON = 'afternoon';
var NIGHT = 'evening';
var currentDay;
var timeOfDay = $('#timeOfDay');
var date = new Date();
if (date.getHours() < 12) {
currentDay = MORNING;
} else if (date.getHours() < 18) {
currentDay = AFTERNOON;
} else {
currentDay = NIGHT;
}
var formattedDate = (date.getMonth() + 1) + '/' + date.getDate() + '/' + date.getFullYear();
var hr = date.getHours();
var min = date.getMinutes();
if (min < 10) {
min = '0' + min;
}
var ampm = hr < 12 ? 'am' : 'pm';
// Format hour
if (hr > 12) {
hr = hr - 12;
} else if (hr === 0) {
hr = 12;
}
var formattedTime = hr + ":" + min + ampm;
timeOfDay.html(currentDay + '! The day is <span id="date">' + formattedDate + ' ' + formattedTime + '</span>');
}
function toggle(selector, trigger) {
if ($(selector).hasClass('open')) {
$(selector).removeClass('open');
$(selector).addClass('close');
$(trigger).html('<i class="fa fa-chevron-up fa-lg"></i>');
} else {
$(selector).removeClass('close');
$(selector).addClass('open');
$(trigger).html('<i class="fa fa-chevron-down fa-lg"></i>');
}
}
updateGreeting();
$('#objectiveButton').click(function() {
toggle('#objective', '#objectiveButton');
});
$('#skillSummaryButton').click(function() {
toggle('#skillSummary', '#skillSummaryButton');
});
$('#workExperienceButton').click(function() {
toggle('#workExperience', '#workExperienceButton');
});
$('#educationButton').click(function() {
toggle('#education', '#educationButton');
});
$('#samplesButton').click(function() {
toggle('#samples', '#samplesButton');
});
});