if the picture is equal to the placeholder then the button is not available

This commit is contained in:
Данил 2022-10-08 21:38:29 +03:00
parent 4404dbf2da
commit 2842beff33

View file

@ -96,7 +96,13 @@ function wallpaper(data) {
let title = document.querySelector(".w-modal-title");
let button = document.querySelector(".modal-footer");
button.innerHTML = `<button type="button" class="btn btn-primary" id="setWallpaper">Set Wallpaper</button>`;
if($(`img#${id}.card-img-top`).attr("src") !== "http://localhost:4662/static/image/placeholder.png") {
button.innerHTML = `<button type="button" class="btn btn-primary" id="setWallpaper">Set Wallpaper</button>`;
} else {
button.innerHTML = `<button type="button" class="btn btn-primary" id="setWallpaper" disabled>Set Wallpaper</button>`;
}
let setWallpaper = document.querySelector("#setWallpaper");
ids[id]['copyright'] = ids[id]['copyright'] === undefined ? "NASA" : ids[id]['copyright'];