FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Javascript_implementation/userpref.js at main · TheCodeCipher/Javascript_implementation · GitHub
TheCodeCipher
/
Javascript_implementation
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Javascript_implementation
/
userpref.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
30 lines (23 loc) · 964 Bytes
Breadcrumbs
Javascript_implementation
/
userpref.js
Copy path
File metadata and controls
30 lines (23 loc) · 964 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
document
.
addEventListener
(
"DOMContentLoaded"
,
function
(
)
{
loadPreferences
(
)
;
}
)
;
function
savePreferences
(
)
{
const
theme
=
document
.
getElementById
(
"themeSelect"
)
.
value
;
const
fontSize
=
document
.
getElementById
(
"fontSizeSelect"
)
.
value
;
localStorage
.
setItem
(
"theme"
,
theme
)
;
localStorage
.
setItem
(
"fontSize"
,
fontSize
)
;
applyPreferences
(
theme
,
fontSize
)
;
alert
(
"Preferences saved!"
)
;
}
function
loadPreferences
(
)
{
const
theme
=
localStorage
.
getItem
(
"theme"
)
||
"light"
;
const
fontSize
=
localStorage
.
getItem
(
"fontSize"
)
||
"18px"
;
document
.
getElementById
(
"themeSelect"
)
.
value
=
theme
;
document
.
getElementById
(
"fontSizeSelect"
)
.
value
=
fontSize
;
applyPreferences
(
theme
,
fontSize
)
;
}
function
applyPreferences
(
theme
,
fontSize
)
{
const
hold
=
document
.
querySelector
(
".hold"
)
;
hold
.
className
=
theme
===
"dark"
?
"hold dark"
:
"hold"
;
document
.
getElementById
(
"demoText"
)
.
style
.
fontSize
=
fontSize
;
}
Back
|
FazBrowse Home
|
New Git URL