neon_arch
commited on
Commit
•
75f02d7
1
Parent(s):
8e9fe4d
✨ feat: add documentation to code
Browse files- public/static/cookies.js +4 -1
- public/static/settings.js +10 -0
- public/static/themes/simple.css +2 -0
public/static/cookies.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1 |
-
//
|
|
|
|
|
|
|
2 |
document.addEventListener(
|
3 |
'DOMContentLoaded',
|
4 |
() => {
|
|
|
1 |
+
// This function is executed when any page on the website finsihes loading and
|
2 |
+
// this function retrieves the cookies if it is present on the user's machine.
|
3 |
+
// If it is available then the saved cookies is display in the cookies tab
|
4 |
+
// otherwise an appropriate message is displayed if it is not available.
|
5 |
document.addEventListener(
|
6 |
'DOMContentLoaded',
|
7 |
() => {
|
public/static/settings.js
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
function toggleAllSelection() {
|
2 |
document
|
3 |
.querySelectorAll('.engine')
|
@@ -8,6 +10,8 @@ function toggleAllSelection() {
|
|
8 |
)
|
9 |
}
|
10 |
|
|
|
|
|
11 |
function setActiveTab(current_tab) {
|
12 |
document
|
13 |
.querySelectorAll('.tab')
|
@@ -21,6 +25,8 @@ function setActiveTab(current_tab) {
|
|
21 |
.classList.add('active')
|
22 |
}
|
23 |
|
|
|
|
|
24 |
function setClientSettings() {
|
25 |
let cookie_dictionary = new Object()
|
26 |
document.querySelectorAll('select').forEach((select_tag) => {
|
@@ -51,6 +57,10 @@ function setClientSettings() {
|
|
51 |
}, 10000)
|
52 |
}
|
53 |
|
|
|
|
|
|
|
|
|
54 |
function getClientSettings() {
|
55 |
let cookie = decodeURIComponent(document.cookie)
|
56 |
|
|
|
1 |
+
// This function handles the toggling of selections of all upstream search engines
|
2 |
+
// options in the settings page under the tab engines.
|
3 |
function toggleAllSelection() {
|
4 |
document
|
5 |
.querySelectorAll('.engine')
|
|
|
10 |
)
|
11 |
}
|
12 |
|
13 |
+
// This function adds the functionality to sidebar buttons to only show settings
|
14 |
+
// related to that tab.
|
15 |
function setActiveTab(current_tab) {
|
16 |
document
|
17 |
.querySelectorAll('.tab')
|
|
|
25 |
.classList.add('active')
|
26 |
}
|
27 |
|
28 |
+
// This function adds the functionality to save all the user selected preferences
|
29 |
+
// to be saved in a cookie on the users machine.
|
30 |
function setClientSettings() {
|
31 |
let cookie_dictionary = new Object()
|
32 |
document.querySelectorAll('select').forEach((select_tag) => {
|
|
|
57 |
}, 10000)
|
58 |
}
|
59 |
|
60 |
+
// This functions gets the saved cookies if it is present on the user's machine If it
|
61 |
+
// is available then it is parsed and converted to an object which is then used to
|
62 |
+
// retrieve the preferences that the user had selected previously and is then loaded in the
|
63 |
+
// website otherwise the function does nothing and the default server side settings are loaded.
|
64 |
function getClientSettings() {
|
65 |
let cookie = decodeURIComponent(document.cookie)
|
66 |
|
public/static/themes/simple.css
CHANGED
@@ -302,6 +302,7 @@ footer {
|
|
302 |
width: 80%;
|
303 |
}
|
304 |
|
|
|
305 |
.settings_container {
|
306 |
display: flex;
|
307 |
justify-content: space-around;
|
@@ -435,6 +436,7 @@ footer {
|
|
435 |
margin: 0;
|
436 |
}
|
437 |
|
|
|
438 |
/* The switch - the box around the slider */
|
439 |
.switch {
|
440 |
position: relative;
|
|
|
302 |
width: 80%;
|
303 |
}
|
304 |
|
305 |
+
/* Styles for the settings page */
|
306 |
.settings_container {
|
307 |
display: flex;
|
308 |
justify-content: space-around;
|
|
|
436 |
margin: 0;
|
437 |
}
|
438 |
|
439 |
+
/* Styles for the toggle button */
|
440 |
/* The switch - the box around the slider */
|
441 |
.switch {
|
442 |
position: relative;
|