0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-21 21:48:21 -05:00

feat: add documentation to code

This commit is contained in:
neon_arch 2023-06-18 20:12:20 +03:00
parent 8e9fe4d03a
commit 75f02d7245
3 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,7 @@
// After the settings page finishes loading // This function is executed when any page on the website finsihes loading and
// this function retrieves the cookies if it is present on the user's machine.
// If it is available then the saved cookies is display in the cookies tab
// otherwise an appropriate message is displayed if it is not available.
document.addEventListener( document.addEventListener(
'DOMContentLoaded', 'DOMContentLoaded',
() => { () => {

View File

@ -1,3 +1,5 @@
// This function handles the toggling of selections of all upstream search engines
// options in the settings page under the tab engines.
function toggleAllSelection() { function toggleAllSelection() {
document document
.querySelectorAll('.engine') .querySelectorAll('.engine')
@ -8,6 +10,8 @@ function toggleAllSelection() {
) )
} }
// This function adds the functionality to sidebar buttons to only show settings
// related to that tab.
function setActiveTab(current_tab) { function setActiveTab(current_tab) {
document document
.querySelectorAll('.tab') .querySelectorAll('.tab')
@ -21,6 +25,8 @@ function setActiveTab(current_tab) {
.classList.add('active') .classList.add('active')
} }
// This function adds the functionality to save all the user selected preferences
// to be saved in a cookie on the users machine.
function setClientSettings() { function setClientSettings() {
let cookie_dictionary = new Object() let cookie_dictionary = new Object()
document.querySelectorAll('select').forEach((select_tag) => { document.querySelectorAll('select').forEach((select_tag) => {
@ -51,6 +57,10 @@ function setClientSettings() {
}, 10000) }, 10000)
} }
// This functions gets the saved cookies if it is present on the user's machine If it
// is available then it is parsed and converted to an object which is then used to
// retrieve the preferences that the user had selected previously and is then loaded in the
// website otherwise the function does nothing and the default server side settings are loaded.
function getClientSettings() { function getClientSettings() {
let cookie = decodeURIComponent(document.cookie) let cookie = decodeURIComponent(document.cookie)

View File

@ -302,6 +302,7 @@ footer {
width: 80%; width: 80%;
} }
/* Styles for the settings page */
.settings_container { .settings_container {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
@ -435,6 +436,7 @@ footer {
margin: 0; margin: 0;
} }
/* Styles for the toggle button */
/* The switch - the box around the slider */ /* The switch - the box around the slider */
.switch { .switch {
position: relative; position: relative;