Skip to content

Commit 7ff553c

Browse files
authored
Merge pull request #167 from CSFelix/CSFelix-patch-2
📦 Updated
2 parents d8a3219 + cee9f71 commit 7ff553c

File tree

1 file changed

+31
-12
lines changed

1 file changed

+31
-12
lines changed

assets/js/scripts/modal-toggle.js

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ const datasetsClose = document.getElementById('datasetsClose');
2222
datasetsBtn.onclick = function() { datasetsModal.style.display = "block"; }
2323
datasetsClose.onclick = function() { datasetsModal.style.display = "none"; }
2424

25+
/* Dashboards */
26+
const dashboardModal = document.getElementById('dashboardModal');
27+
const dashboardBtn = document.getElementById('dashboardBtn');
28+
const dashboardClose = document.getElementById('dashboardClose');
29+
30+
dashboardBtn.onclick = function() { dashboardModal.style.display = "block"; }
31+
dashboardClose.onclick = function() { dashboardModal.style.display = "none"; }
32+
2533
/* ML Algorithms */
2634
const mlAlgorithmsModal = document.getElementById('mlAlgorithmsModal');
2735
const mlAlgorithmsBtn = document.getElementById('mlAlgorithmsBtn');
@@ -30,21 +38,30 @@ const mlAlgorithmsClose = document.getElementById('mlAlgorithmsClose');
3038
mlAlgorithmsBtn.onclick = function() { mlAlgorithmsModal.style.display = "block"; }
3139
mlAlgorithmsClose.onclick = function() { mlAlgorithmsModal.style.display = "none"; }
3240

33-
/* Dashboards */
34-
const dashboardModal = document.getElementById('dashboardModal');
35-
const dashboardBtn = document.getElementById('dashboardBtn');
36-
const dashboardClose = document.getElementById('dashboardClose');
41+
/* Recommendation System */
42+
const recommendationSystemModal = document.getElementById('recommendationSystemModal');
43+
const recommendationSystemBtn = document.getElementById('recommendationSystemBtn');
44+
const recommendationSystemClose = document.getElementById('recommendationSystemClose');
3745

38-
dashboardBtn.onclick = function() { dashboardModal.style.display = "block"; }
39-
dashboardClose.onclick = function() { dashboardModal.style.display = "none"; }
46+
recommendationSystemBtn.onclick = function() { recommendationSystemModal.style.display = 'block'; }
47+
recommendationSystemClose.onclick = function() { recommendationSystemModal.style.display = 'none'; }
48+
49+
/* Statistic and Probability */
50+
const statisticProbabilityModal = document.getElementById('statisticProbabilityModal');
51+
const statisticProbabilityBtn = document.getElementById('statisticProbabilityBtn');
52+
const statisticProbabilityClose = document.getElementById('statisticProbabilityClose');
53+
54+
statisticProbabilityBtn.onclick = function() { statisticProbabilityModal.style.display = 'block'; }
55+
statisticProbabilityClose.onclick = function() { statisticProbabilityModal.style.display = 'none'; }
4056

4157
/* Closing modals when user taps outside the modal */
4258
window.onclick = function(event) {
43-
if (event.target == kaggleModal) { kaggleModal.style.display = "none"; }
44-
else if (event.target == liveProjectsModal) { liveProjectsModal.style.display = "none"; }
45-
else if (event.target == datasetsModal) { datasetsModal.style.display = "none"; }
46-
else if (event.target == mlAlgorithmsModal) { mlAlgorithmsModal.style.display = "none"; }
47-
else if (event.target == dashboardModal) { dashboardModal.style.display = "none"; }
59+
const modalsArray = [
60+
kaggleModal, liveProjectsModal, datasetsModal, dashboardModal
61+
, mlAlgorithmsModal, recommendationSystemModal, statisticProbabilityModal
62+
]
63+
64+
if (modalsArray.includes(event.target)) { event.target.style.display = 'none'; }
4865
}
4966

5067
/* Closing modals when user presses Escape (Esc) */
@@ -53,7 +70,9 @@ window.onkeydown = function(event) {
5370
if (kaggleModal.style.display == 'block') { kaggleModal.style.display = 'none'; }
5471
else if (liveProjectsModal.style.display == 'block') { liveProjectsModal.style.display = 'none'; }
5572
else if (datasetsModal.style.display == 'block') { datasetsModal.style.display = 'none'; }
56-
else if (mlAlgorithmsModal.style.display == 'block') { mlAlgorithmsModal.style.display = 'none'; }
5773
else if (dashboardModal.style.display == 'block') { dashboardModal.style.display = 'none'; }
74+
else if (mlAlgorithmsModal.style.display == 'block') { mlAlgorithmsModal.style.display = 'none'; }
75+
else if (recommendationSystemModal.style.display == 'block') { recommendationSystemModal.style.display = 'none'; }
76+
else if (statisticProbabilityModal.style.display == 'block') { statisticProbabilityModal.style.display = 'none'; }
5877
}
5978
}

0 commit comments

Comments
 (0)