-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
153 lines (118 loc) · 5.19 KB
/
script.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*Login form*/
document.getElementById('signInButton').onclick = function() {
document.getElementById('loginModal').style.display = 'flex';
}
window.onclick = function(event) {
var modal = document.getElementById('loginModal');
if (event.target == modal) {
modal.style.display = 'none';
}
}
/*Login form ends*/
/*Sign Up form starts here*/
document.getElementById('signUpButton').onclick = function() {
document.getElementById('SignUpModal').style.display = 'flex';
}
window.onclick = function(event) {
var modal1 = document.getElementById('SignUpModal');
if (event.target == modal1) {
modal1.style.display = 'none';
}
}
/*Sign up form ends here*/
document.addEventListener("DOMContentLoaded", function() {
// Get the login form
var loginForm = document.getElementById("loginForm");
// Get the button that opens the login form
var signInButton = document.querySelector(".auth-buttons a[href='#signin']");
// Get the <span> element that closes the login form
var closeBtn = document.getElementById("closeLoginForm");
// When the user clicks the button, open the login form
signInButton.addEventListener("click", function(event) {
event.preventDefault(); // Prevent default link behavior
loginForm.style.display = "block";
});
// When the user clicks on <span> (x), close the login form
closeBtn.addEventListener("click", function() {
loginForm.style.display = "none";
});
// When the user clicks anywhere outside of the login form, close it
window.addEventListener("click", function(event) {
if (event.target == loginForm) {
loginForm.style.display = "none";
}
});
});
document.addEventListener('DOMContentLoaded', function() {
const uploadFileButton = document.getElementById('uploadFileButton');
const addUrlButton = document.getElementById('addUrlButton');
const addTextButton = document.getElementById('addTextButton');
const startSummarizingButton = document.getElementById('startSummarizingButton');
const uploadFileSection = document.getElementById('uploadFileSection');
const addUrlSection = document.getElementById('addUrlSection');
const addTextSection = document.getElementById('addTextSection');
const container = document.querySelector('.container');
function hideAllSections() {
uploadFileSection.style.display = 'none';
addUrlSection.style.display = 'none';
addTextSection.style.display = 'none';
}
uploadFileButton.addEventListener('click', function() {
hideAllSections();
uploadFileSection.style.display = 'block';
});
addUrlButton.addEventListener('click', function() {
hideAllSections();
addUrlSection.style.display = 'block';
});
addTextButton.addEventListener('click', function() {
hideAllSections();
addTextSection.style.display = 'block';
});
// Default to show the text section
addTextButton.click();
startSummarizingButton.addEventListener('click', function() {
container.scrollIntoView({ behavior: 'smooth' });
});
});
/Navbar links functioning/
document.addEventListener('DOMContentLoaded', () => { /aboutlink func./
const aboutLink = document.getElementById('aboutLink');
const aboutsection = document.getElementById('summary');
aboutLink.addEventListener('click', (event) => {
event.preventDefault(); // Prevent the default anchor link behavior
aboutsection.scrollIntoView({ behavior: 'smooth' });
});
});
document.addEventListener('DOMContentLoaded', () => { /servicelink func./
const serviceLink = document.getElementById('serviceLink');
const servicesection = document.getElementById('service');
serviceLink.addEventListener('click', (event) => {
event.preventDefault(); // Prevent the default anchor link behavior
servicesection.scrollIntoView({ behavior: 'smooth' });
});
});
/*Dark and light theme*/
document.addEventListener('DOMContentLoaded', function() {
const themeToggleButton = document.getElementById('themeToggleButton');
const currentTheme = localStorage.getItem('theme') || 'light';
document.documentElement.setAttribute('data-theme', currentTheme);
if (currentTheme === 'dark') {
themeToggleButton.classList.remove('fa-moon');
themeToggleButton.classList.add('fa-sun');
}
themeToggleButton.addEventListener('click', function() {
let theme = document.documentElement.getAttribute('data-theme');
if (theme === 'light') {
document.documentElement.setAttribute('data-theme', 'dark');
localStorage.setItem('theme', 'dark');
themeToggleButton.classList.remove('fa-moon');
themeToggleButton.classList.add('fa-sun');
} else {
document.documentElement.setAttribute('data-theme', 'light');
localStorage.setItem('theme', 'light');
themeToggleButton.classList.remove('fa-sun');
themeToggleButton.classList.add('fa-moon');
}
});
});