Merge pull request #31 from db-2001/hover-css-onclick

Changed CSS feature to update whenever the checkbox is clicked instead of when the update button is clicked
This commit is contained in:
Glax 2023-11-03 09:48:46 +01:00 committed by GitHub
commit 6952bcaa1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 10 deletions

View File

@ -98,7 +98,7 @@
<label for="ntfyAuth"></label><input placeholder="Auth" id="ntfyAuth" type="text">
</div>
<div>
<input type="checkbox" id="mangaHoverCheckbox" name="css-style" value="style_mangahover.css">
<input type="checkbox" id="mangaHoverCheckbox" name="css-style" value="style_mangahover.css" onclick="updateCSS()">
<label for="css-style"> Show manga titles and sources on hover</label><br>
</div>
<div>

View File

@ -101,6 +101,18 @@ function Setup(){
}
Setup();
function updateCSS(){
if (document.getElementById("mangaHoverCheckbox").checked == true){
ChangeStyleSheet('hover')
document.getElementById('pagestyle').setAttribute('href', 'styles/style_mangahover.css');
//console.log('Changing theme to mangahover')
} else {
ChangeStyleSheet('default');
document.getElementById('pagestyle').setAttribute('href', 'styles/style_default.css');
//console.log('Changing theme to default')
}
}
function ResetContent(){
//Delete everything
tasksContent.replaceChildren();
@ -412,15 +424,6 @@ function UpdateSettings(){
setCookie("apiUri", apiUri);
Setup();
}
// If the checkbox is checked, set the style to style_mangahover.css and
if (document.getElementById("mangaHoverCheckbox").checked == true){
ChangeStyleSheet('hover')
//console.log('Changing theme to mangahover')
} else {
ChangeStyleSheet('default');
//console.log('Changing theme to default')
}
if(settingKomgaUrl.value != "" &&
settingKomgaUser.value != "" &&