-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
57 lines (45 loc) · 1.76 KB
/
Copy pathscript.js
File metadata and controls
57 lines (45 loc) · 1.76 KB
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
function jumboTron () {
var dateTime = moment().format('dddd MMM Do YYYY, h:mm a')
$('#currentDay').text(dateTime)
}
jumboTron()
// older javascript
$(document).ready(function () {
$('.saveButton').on('click', function() {
var input = $(this).siblings('.input').val();
var block = $(this).parent().attr('id');
// block is the location, the input is the data that's being passed through
localStorage.setItem(block, input)
});
function timeUpdater() {
var momentTime = moment().hour();
$('.timeBlock').each(function () {
var blockHour = parseInt($(this).attr("id"));
// if else
// add and remove classes in order to change colors
if (momentTime > blockHour) {
$(this).children(".input").addClass('past');
} else if (momentTime === blockHour) {
$(this).children('.input').removeClass('past')
$(this).children('.input').addClass('present')
} else {
$(this).children('.input').removeClass('past')
$(this).children('.input').removeClass('present')
$(this).children('.input').addClass('future')
}
})
}
timeUpdater();
$('#9 .input').val(localStorage.getItem('9'));
$('#10 .input').val(localStorage.getItem('10'));
$('#11 .input').val(localStorage.getItem('11'));
$('#12 .input').val(localStorage.getItem('12'));
$('#13 .input').val(localStorage.getItem('13'));
$('#14 .input').val(localStorage.getItem('14'));
$('#15 .input').val(localStorage.getItem('15'));
$('#16 .input').val(localStorage.getItem('16'));
$('#17 .input').val(localStorage.getItem('17'));
$('#18 .input').val(localStorage.getItem('18'));
$('#19 .input').val(localStorage.getItem('19'));
$('#20 .input').val(localStorage.getItem('20'));
})