mirror of
https://github.com/Starlio-app/StarlioX
synced 2025-02-21 23:03:11 +03:00
add auto change wallpaper
This commit is contained in:
parent
41507c8fc5
commit
b9d775eec9
4 changed files with 111 additions and 10 deletions
|
@ -34,6 +34,14 @@
|
|||
<h1 id="title">Application Settings</h1>
|
||||
<div class="container">
|
||||
<header class="header-row">
|
||||
<div class="settings">
|
||||
<p class="title"><strong>Auto-change of desktop wallpaper</strong></p>
|
||||
<p class="desc">EveryNasa will automatically change the desktop wallpaper at startup as well as every day</p>
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="autosetWallpaperSwitch">
|
||||
<label class="form-check-label" for="autorunText" id="autosetWallpaperText">Off</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="settings">
|
||||
<p class="title"><strong>Automatic updates</strong></p>
|
||||
<p class="desc">EveryNasa will automatically perform an update at startup.</p>
|
||||
|
@ -52,6 +60,16 @@
|
|||
</div>
|
||||
</header>
|
||||
</div>
|
||||
<div class="toast-container position-fixed bottom-0 end-0 p-3">
|
||||
<div id="liveToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-header">
|
||||
<img src="/static/image/icons/favicon.png" class="rounded me-2" alt="EveryNasa" width="30">
|
||||
<strong class="me-auto" style="color: black;">EveryNasa</strong>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="toast-body" style="color: black;"></div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.min.js" integrity="sha384-ODmDIVzN+pFdexxHEHFBQH3/9/vQ9uori45z4JjnFsRydbmQbmL5t1tQ0culUzyK" crossorigin="anonymous"></script>
|
||||
<script src="/static/scripts/switch.js"></script>
|
||||
|
|
|
@ -10,6 +10,10 @@ $.ajax({
|
|||
$("#autorunSwitch").attr("checked", "true");
|
||||
$("#autorunText").text("On");
|
||||
}
|
||||
if(data["autochangewallpaper"] === 1) {
|
||||
$("#autosetWallpaperSwitch").attr("checked", "true");
|
||||
$("#autosetWallpaperText").text("On");
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
@ -81,4 +85,38 @@ $("#autorunSwitch").click(function(){
|
|||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
$("#autosetWallpaperSwitch").click(function(){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/get/settings",
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
if(data["autochangewallpaper"] === 1){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autochangewallpaper: 0
|
||||
},
|
||||
success: function(){
|
||||
$("#autosetWallpaperSwitch").removeAttr("checked");
|
||||
$("#autosetWallpaperText").text("Off");
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autochangewallpaper: 1
|
||||
},
|
||||
success: function(){
|
||||
$("#autosetWallpaperSwitch").attr("checked", "true");
|
||||
$("#autosetWallpaperText").text("On");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
Loading…
Add table
Reference in a new issue