mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2024-11-21 16:26:21 +03:00
Improved the quality of the images. Added alt to the image via js. If the author is not present, then he will not be shown. If there is no picture, then there will be a redirect to error 404
This commit is contained in:
parent
307388db05
commit
4e28c7a3e7
2 changed files with 12 additions and 10 deletions
|
@ -3,20 +3,21 @@ function load(date) {
|
|||
res.json().then(data => {
|
||||
if (data.length === 0) return;
|
||||
|
||||
document.querySelector("div.wallpaper img").src = data.url;
|
||||
document.querySelector("div.wallpaper img").src = data.hdurl;
|
||||
document.querySelector("div.wallpaper img").alt = data.title;
|
||||
document.querySelector("div.wallpaper div.wallpaper-text div.wallpaper-desc h1").innerHTML = data.title;
|
||||
document.querySelector(".copyright").innerHTML = `Image Credit & Copyright: ${data.copyright}`;
|
||||
document.querySelector(".copyright").innerHTML = data.copyright ? `Автор: ${data.copyright}` : ''
|
||||
document.querySelector(".desc").innerHTML = data.explanation;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function parseURL() {
|
||||
let pathname = document.location.pathname
|
||||
let pathname = document.location.pathname;
|
||||
pathname = pathname.slice(pathname.lastIndexOf('/')+1)
|
||||
|
||||
if (isNaN(new Date(pathname).getTime())) return null;
|
||||
if (!isValidDate(pathname)) return null;
|
||||
if (isNaN(new Date(pathname).getTime())) return window.location.replace("./404.html");
|
||||
if (!isValidDate(pathname)) return window.location.replace("./404.html");
|
||||
|
||||
return pathname;
|
||||
}
|
||||
|
|
|
@ -3,20 +3,21 @@ function load(date) {
|
|||
res.json().then(data => {
|
||||
if (data.length === 0) return;
|
||||
|
||||
document.querySelector("div.wallpaper img").src = data.url;
|
||||
document.querySelector("div.wallpaper img").src = data.hdurl;
|
||||
document.querySelector("div.wallpaper img").alt = data.title;
|
||||
document.querySelector("div.wallpaper div.wallpaper-text div.wallpaper-desc h1").innerHTML = data.title;
|
||||
document.querySelector(".copyright").innerHTML = `Image Credit & Copyright: ${data.copyright}`;
|
||||
document.querySelector(".copyright").innerHTML = data.copyright ? `Copyright: ${data.copyright}` : ''
|
||||
document.querySelector(".desc").innerHTML = data.explanation;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function parseURL() {
|
||||
let pathname = document.location.pathname
|
||||
let pathname = '2024-01-01';
|
||||
pathname = pathname.slice(pathname.lastIndexOf('/')+1)
|
||||
|
||||
if (isNaN(new Date(pathname).getTime())) return null;
|
||||
if (!isValidDate(pathname)) return null;
|
||||
if (isNaN(new Date(pathname).getTime())) return window.location.replace("./404.html");
|
||||
if (!isValidDate(pathname)) return window.location.replace("./404.html");
|
||||
|
||||
return pathname;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue