mirror of
https://github.com/Starlio-app/StarlioX
synced 2025-02-22 23:13:12 +03:00
add other page and js, css
This commit is contained in:
parent
25f68a498a
commit
1e33e0a6d8
8 changed files with 279 additions and 0 deletions
17
web/static/scripts/gallery.js
Normal file
17
web/static/scripts/gallery.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
$.ajax({
|
||||
url: `https://api.nasa.gov/planetary/apod?api_key=1gI9G84ZafKDEnrbydviGknReOGiVK9jqrQBE3et&start_date=${new Date().toLocaleString().slice(6, 10)}-${new Date().toLocaleString().slice(3, 5)}-01&end_date=${new Date().toLocaleString().slice(6,10)}-${new Date().toLocaleString().slice(3, 5)}-${new Date().toLocaleString().slice(3, 5)}`,
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
if (data[i].media_type == "image") {
|
||||
$(".header-row").append(`
|
||||
<span>
|
||||
<div class="card">
|
||||
<img src="${data[i].url}" alt="${data[i].title}" class="card-img-top">
|
||||
</div>
|
||||
</span>
|
||||
`)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
84
web/static/scripts/switch.js
Normal file
84
web/static/scripts/switch.js
Normal file
|
@ -0,0 +1,84 @@
|
|||
$.ajax({
|
||||
url: "http://localhost:8080/api/get/settings",
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
if(data["autoupdate"] === 1){
|
||||
$("#updateSwitch").attr("checked", "true");
|
||||
$("#updateText").text("On");
|
||||
}
|
||||
if(data["autostart"] === 1) {
|
||||
$("#autorunSwitch").attr("checked", "true");
|
||||
$("#autorunText").text("On");
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
$("#updateSwitch").click(function(){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/get/settings",
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
if(data["autoupdate"] === 1){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autoupdate: 0
|
||||
},
|
||||
success: function(){
|
||||
$("#updateSwitch").removeAttr("checked");
|
||||
$("#updateText").text("Off");
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autoupdate: 1
|
||||
},
|
||||
success: function(){
|
||||
$("#updateSwitch").attr("checked", "true");
|
||||
$("#updateText").text("On");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
$("#autorunSwitch").click(function(){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/get/settings",
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
if(data["autostart"] === 1){
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autostart: 0
|
||||
},
|
||||
success: function(){
|
||||
$("#autorunSwitch").removeAttr("checked");
|
||||
$("#autorunText").text("Off");
|
||||
}
|
||||
})
|
||||
} else {
|
||||
$.ajax({
|
||||
url: "http://localhost:8080/api/update/settings",
|
||||
type: "POST",
|
||||
data: {
|
||||
autostart: 1
|
||||
},
|
||||
success: function(){
|
||||
$("#autorunSwitch").attr("checked", "true");
|
||||
$("#autorunText").text("On");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
2
web/static/scripts/tooltip.js
Normal file
2
web/static/scripts/tooltip.js
Normal file
|
@ -0,0 +1,2 @@
|
|||
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
|
||||
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
|
7
web/static/scripts/version.js
Normal file
7
web/static/scripts/version.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
$.ajax({
|
||||
url: "http://localhost:8080/api/get/version",
|
||||
type: "GET",
|
||||
success: function(data){
|
||||
$("#program-version").text(data.message);
|
||||
}
|
||||
})
|
Loading…
Add table
Reference in a new issue