-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotescript.js
105 lines (89 loc) · 3.51 KB
/
notescript.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
var showOptionsButton = document.getElementById('showOptionsButton');
var optionsContainer = document.getElementById('optionsContainer');
var dialogue = document.getElementById('dialogue');
var menuIcon = document.querySelector('.menu-icon');
function toggleDialogue() {
menuIcon.classList.toggle('active');
if (dialogue.style.display === 'none' || dialogue.style.display === '') {
dialogue.style.display = 'block';
} else {
dialogue.style.display = 'none';
}
}
var options = [
{ name: 'Semester 1', subOptions: ['Discrete Maths', 'C Programming', 'Fundamentals of a Computer', 'Web Technologies', 'Technical Communication'] },
{ name: 'Semester 2', subOptions: ['Applied Maths', 'Data Structure and Algorithm2', 'Database Management System', 'Web Based Programming', 'Environmental Studies'] },
{ name: 'Semester 3(Not available yet)', subOptions: ['Will be added soon','Will be added soon','Will be added soon','Will be added soon','Will be added soon'] },
{ name: 'Semester 4(Not available yet)', subOptions: ['Will be added soon','Will be added soon','Will be added soon','Will be added soon','Will be added soon'] },
{ name: 'Semester 5(Not available yet)', subOptions: ['Will be added soon','Will be added soon','Will be added soon','Will be added soon','Will be added soon'] },
{ name: 'Semester 6(Not available yet)', subOptions: ['Will be added soon','Will be added soon','Will be added soon','Will be added soon','Will be added soon'] }
];
function showOptions() {
showOptionsButton.style.display = 'none';
optionsContainer.innerHTML = '';
options.forEach(function (option) {
var button = document.createElement('button');
button.className = 'option';
button.textContent = option.name;
button.onclick = function () {
showSubOptions(option.subOptions);
};
optionsContainer.appendChild(button);
optionsContainer.appendChild(document.createElement('br'));
});
optionsContainer.style.display = 'block';
}
function showSubOptions(subOptions) {
optionsContainer.innerHTML = '';
subOptions.forEach(function (subOption) {
var button = document.createElement('button');
button.className = 'sub-option';
button.textContent = subOption;
button.onclick = function () {
openPage(subOption);
};
optionsContainer.appendChild(button);
optionsContainer.appendChild(document.createElement('br'));
});
}
function openPage(option,url) {
window.location.href = url;{
}
// Redirect to a different page based on the selected sub-option
switch (option) {
case 'Discrete Maths':
window.location.href = 'dm.html';
break;
case 'C Programming':
window.location.href = 'cp.html';
break;
case 'Fundamentals of a Computer':
window.location.href = 'fcit.html';
break;
case 'Web Technologies':
window.location.href = 'wt.html';
break;
case 'Technical Communication':
window.location.href = 'tc.html';
break;
case 'Applied Maths':
window.location.href = 'am.html';
break;
case 'Data Structure and Algorithm2':
window.location.href = 'dsa.html';
break;
case 'Database Management System':
window.location.href = 'dbms.html';
break;
case 'Web Based Programming':
window.location.href = 'wbp.html';
break;
case 'Environmental Studies':
window.location.href = 'evs.html';
break;
// Add more cases for other sub-options
default:
console.log('No redirection defined for: ' + option);
break;
}
}