forked from med-art/MindArtMaster
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfunctions.js
84 lines (68 loc) · 3.58 KB
/
functions.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
77
78
79
80
81
82
83
84
function Programme_AppRelease(){
// set programme start date (mm/dd/yyyy)
var date = new Date("02/19/2024");
// Calculate the number of elapsed days since programme start
var today = new Date();
var elapsedDays = Math.floor((today - date) / 86400000);
var wk1 = '<div class="grid-Active"><a href="MinDArT-1-Touchscape/index.html"><img class="session" src="assets/touch scape icon.png" alt="Week 1 - Touchscape"></a></div>';
var wk2 = '<div class="grid-Active"><a href="MinDArT-2-Linescape/index.html"><img class="session" src="assets/line scape icon.png" alt="Week 2 - Linescape"><p></p></a></div>';
var wk3 = '<div class="grid-Active"><a href="MinDArT-3-Circlescape/index.html"><img class="session" src="assets/circle scape icon.png" alt="Week 3 - Circlescape"><p></a></p></div>';
var wk4 = '<div class="grid-Active"><a href="MinDArT-4-Colourscape/index.html"><img class="session" src="assets/colour scape icon.png" alt="Week 4 - Colourscape"></a></div>';
var wk5 = '<div class="grid-Active"><a href="MinDArT-5-Dotscape/index.html"><img class="session" src="assets/dot scape icon.png" alt="Week 5 - Dotscape"></a></div>';
var wk6 = '<div class="grid-Active"><a href="MinDArT-6-Linkscape/index.html"><img class="session" src="assets/link scape icon.png" alt="Week 6 - Linkscape"><p></a></p></div>';
var wk7 = '<div class="grid-Active"><a href="MinDArT-7-Rotationscape/index.html"><img class="session" src="assets/rotation scape icon.png" alt="Week 7 - Rotationscape"><p></a></p></div>';
var wk8 = '<div class="grid-Active"><a href="MinDArT-8-Symmetryscape/index.html"><img class="session" src="assets/symmetry scape icon.png" alt="Week 8 - Symmetryscape"></a></div>';
// determine apps to display
if (elapsedDays < 7) {
document.querySelector('.grid').innerHTML = wk1;
}
else if (elapsedDays < 14){
document.querySelector('.grid').innerHTML = wk1 + wk2;
}
else if (elapsedDays < 21){
document.querySelector('.grid').innerHTML = wk1 + wk2 + wk3;
}
else if (elapsedDays < 28){
document.querySelector('.grid').innerHTML = wk1 + wk2 + wk3 + wk4;
}
else if (elapsedDays < 35){
document.querySelector('.grid').innerHTML = wk1 + wk2 + wk3 + wk4 + wk5;
}
else if (elapsedDays < 42){
document.querySelector('.grid').innerHTML = wk1 + wk2 + wk3 + wk4 + wk5 + wk6;
}
else if (elapsedDays < 49){
document.querySelector('.grid').innerHTML = wk1 + wk2 + wk3 + wk4 + wk5 + wk6 + wk7;
}
else{
document.querySelector('.grid').innerHTML = wk1 + wk2 + wk3 + wk4 + wk5 + wk6 + wk7 + wk8;
}
}
// Common interface functions
function menu() {
window.location.href = "https://jameswilce.github.io/DevMinDArT";
//window.location.href = "/";
}
function show_btns() {
var getBtns = document.getElementsByClassName("btn");
for (var i = 0; i < getBtns.length; i++) {
getBtns[i].style.display = "inline";
}
}
function resetButtons() {
var activeButtons = document.querySelectorAll("button.active");
for (var i = 0; i < activeButtons.length; i++) {
activeButtons[i].classList.remove("active");
}
}
function setActive (id1, id2) {
resetButtons();
document.getElementById(id1).classList.add("active");
document.getElementById(id2).classList.add("active");
}
function setActiveElementById(id) {
const element = document.getElementById(id);
if (element) {
element.classList.add('active');
}
}