mirror of
https://github.com/Starlio-app/Starlio-web.git
synced 2025-02-26 12:11:25 +03:00
I copied the files to the folder with the localization.
This commit is contained in:
parent
2f2046a8ae
commit
01f9f7787a
5 changed files with 219 additions and 3 deletions
125
localized-files/ru/static/css/wallpaper.css
Normal file
125
localized-files/ru/static/css/wallpaper.css
Normal file
|
@ -0,0 +1,125 @@
|
|||
body {
|
||||
background: #153E3F;
|
||||
color: white;
|
||||
font-family: 'Roboto', serif;
|
||||
}
|
||||
|
||||
@media (min-width: 0) {
|
||||
.wallpaper img {
|
||||
width: 90%;
|
||||
border-radius: 8px;
|
||||
margin: 0 auto 0 auto;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.wallpaper h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 110%;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
p {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 125%;
|
||||
line-height: 32px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.wallpaper-text {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
|
||||
.get-it-on {
|
||||
display: flex;
|
||||
margin: 5% auto 3% auto;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.get-it-on {
|
||||
display: flex;
|
||||
margin: 5% auto 3% auto;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 150%;
|
||||
line-height: 39px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 125%;
|
||||
width: 90%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 992px) {
|
||||
.wallpaper img {
|
||||
width: 65%;
|
||||
border-radius: 8px;
|
||||
margin: 0 auto 0 auto;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 200%;
|
||||
line-height: 45px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 150%;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.wallpaper h1 {
|
||||
text-align: center;
|
||||
font-size: 250%;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
.wallpaper img {
|
||||
width: 40%;
|
||||
border-radius: 8px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.wallpaper-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 150%;
|
||||
line-height: 36px;
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
.copyright {
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
.get-it-on {
|
||||
display: block ;
|
||||
width: 70%;
|
||||
margin-left: 15%;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1400px) {
|
||||
.wallpaper img {
|
||||
max-width: 27%;
|
||||
}
|
||||
}
|
37
localized-files/ru/static/script/wallpaperLoad.js
Normal file
37
localized-files/ru/static/script/wallpaperLoad.js
Normal file
|
@ -0,0 +1,37 @@
|
|||
function load(date) {
|
||||
fetch(`https://api.starlio.space/wallpaper/${date}`).then(res => {
|
||||
res.json().then(data => {
|
||||
if (data.length === 0) return;
|
||||
|
||||
document.querySelector("div.wallpaper img").src = data.url;
|
||||
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(".desc").innerHTML = data.explanation;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function parseURL() {
|
||||
let pathname = document.location.pathname
|
||||
pathname = pathname.slice(pathname.lastIndexOf('/')+1)
|
||||
|
||||
if (isNaN(new Date(pathname).getTime())) return null;
|
||||
if (!isValidDate(pathname)) return null;
|
||||
|
||||
return pathname;
|
||||
}
|
||||
|
||||
|
||||
/* THX, bro <3
|
||||
https://stackoverflow.com/a/35413963/20781634
|
||||
*/
|
||||
function isValidDate(dateString) {
|
||||
var regEx = /^\d{4}-\d{2}-\d{2}$/;
|
||||
if(!dateString.match(regEx)) return false;
|
||||
var d = new Date(dateString);
|
||||
var dNum = d.getTime();
|
||||
if(!dNum && dNum !== 0) return false;
|
||||
return d.toISOString().slice(0,10) === dateString;
|
||||
}
|
||||
|
||||
load(parseURL());
|
Loading…
Add table
Reference in a new issue