-
Notifications
You must be signed in to change notification settings - Fork 855
/
script.js
51 lines (44 loc) · 1.41 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
/**
* Initializes the application when the DOM is ready.
* @function
* @global
*/
$(document).ready(function() {
/**
* The user's selected mode, stored in local storage.
* @type {string}
*/
var mode;
try {
mode = localStorage.getItem("beginnerMode") || "true";
} catch (error) {
console.error("Error accessing localStorage:", error);
mode = "true";
}
/**
* The icon element that displays the user's current mode.
* @type {HTMLElement}
*/
var modeIcon = document.getElementById("mode");
/**
* The text element that displays the tooltip for the mode icon.
* @type {HTMLElement}
*/
var modeText = document.getElementById("modeText");
// Set the mode icon and tooltip based on the user's selected mode.
if (mode === null || mode === "true") {
modeIcon.innerHTML = "star_border";
modeText.setAttribute("data-tooltip", "Switch to advanced mode");
} else {
modeIcon.innerHTML = "star";
modeText.setAttribute("data-tooltip", "Switch to beginner mode");
}
// Initialize Materialize tooltips.
$(".tooltipped").tooltip();
// Initialize Materialize dropdowns.
$(".materialize-iso, .dropdown-trigger").dropdown({
constrainWidth: false,
hover: false, // Activate on click
belowOrigin: true, // Displays dropdown below the button
});
});