mirror of
https://github.com/Starlio-app/StarlioX
synced 2024-11-06 06:13:57 +03:00
Favorite images were cut from the program and fix errors
This commit is contained in:
parent
92f3204572
commit
9949e5a87b
1 changed files with 25 additions and 32 deletions
|
@ -68,13 +68,7 @@ function wallpaperLoad(data) {
|
||||||
const title = document.querySelector(".w-modal-title");
|
const title = document.querySelector(".w-modal-title");
|
||||||
const button = document.querySelector(".modal-footer");
|
const button = document.querySelector(".modal-footer");
|
||||||
|
|
||||||
button.innerHTML = `<lottie-player id="favorite"
|
button.innerHTML = `<button type="button" class="btn btn-primary" id="setWallpaper">Download</button>`;
|
||||||
src="/static/assets/lottie/lf30_rcvcAS.json"
|
|
||||||
background="transparent"
|
|
||||||
speed="1">
|
|
||||||
</lottie-player>
|
|
||||||
<button type="button" class="btn btn-primary" id="setWallpaper">Download</button>
|
|
||||||
`;
|
|
||||||
|
|
||||||
const wallpaper_img = $(`img#${id}.card-img-top`);
|
const wallpaper_img = $(`img#${id}.card-img-top`);
|
||||||
if (wallpaper_img && wallpaper_img.src === "http://localhost:4000/static/assets/placeholder.png") {
|
if (wallpaper_img && wallpaper_img.src === "http://localhost:4000/static/assets/placeholder.png") {
|
||||||
|
@ -86,7 +80,6 @@ function wallpaperLoad(data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const setWallpaper = document.querySelector("#setWallpaper");
|
const setWallpaper = document.querySelector("#setWallpaper");
|
||||||
const favorite = document.querySelector("#favorite");
|
|
||||||
|
|
||||||
title.innerHTML = `<h5 class="modal-title">${ids[card_id]['title']}</h5>`;
|
title.innerHTML = `<h5 class="modal-title">${ids[card_id]['title']}</h5>`;
|
||||||
|
|
||||||
|
@ -123,31 +116,31 @@ function wallpaperLoad(data) {
|
||||||
if (ids[card_id]['copyright'] !== undefined) {
|
if (ids[card_id]['copyright'] !== undefined) {
|
||||||
return modale_window.innerHTML += `<p>© ${ids[card_id]['copyright']}</p>`;
|
return modale_window.innerHTML += `<p>© ${ids[card_id]['copyright']}</p>`;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
$(window).scroll(function () {
|
$(window).scroll(function () {
|
||||||
if (($(window).scrollTop() > $(document).height() - $(window).height() - 100)) {
|
if (($(window).scrollTop() > $(document).height() - $(window).height() - 100)) {
|
||||||
$(".preloader").show();
|
$(".preloader").show();
|
||||||
$(window).off("scroll");
|
$(window).off("scroll");
|
||||||
|
|
||||||
startDate.setDate(startDate.getDate() - 1);
|
startDate.setDate(startDate.getDate() - 1);
|
||||||
|
|
||||||
endDate.setDate(endDate.getDate() - 15);
|
endDate.setDate(endDate.getDate() - 15);
|
||||||
endDate.setMonth(endDate.getMonth() - 1);
|
endDate.setMonth(endDate.getMonth() - 1);
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "https://api.nasa.gov/planetary/apod",
|
url: "https://api.nasa.gov/planetary/apod",
|
||||||
data: {
|
data: {
|
||||||
api_key: apiKEY,
|
api_key: apiKEY,
|
||||||
start_date: `${endDate.getUTCFullYear()}-${endDate.getUTCMonth() + 1}-${endDate.getUTCDate()}`,
|
start_date: `${endDate.getUTCFullYear()}-${endDate.getUTCMonth() + 1}-${endDate.getUTCDate()}`,
|
||||||
end_date: `${startDate.getUTCFullYear()}-${startDate.getUTCMonth() + 1}-${startDate.getUTCDate()}`,
|
end_date: `${startDate.getUTCFullYear()}-${startDate.getUTCMonth() + 1}-${startDate.getUTCDate()}`,
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
wallpaperLoad(data);
|
wallpaperLoad(data);
|
||||||
$(window).on("scroll");
|
$(window).on("scroll");
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +156,7 @@ function updateWallpaper(url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function notify(message) {
|
function notify(message) {
|
||||||
if (!("Notification" in window)) return;
|
if (!("Notification" in window)) return null;
|
||||||
|
|
||||||
else if (Notification.permission === "granted") {
|
else if (Notification.permission === "granted") {
|
||||||
new Notification(message);
|
new Notification(message);
|
||||||
|
@ -174,6 +167,6 @@ function notify(message) {
|
||||||
if (permission === "granted") {
|
if (permission === "granted") {
|
||||||
new Notification(message);
|
new Notification(message);
|
||||||
}
|
}
|
||||||
});
|
}).then(r => console.log(r));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue