Diffstat (limited to 'views')
| -rw-r--r-- | views/index.html | 61 | ||||
| -rw-r--r-- | views/layouts/blog-main.html | 147 | ||||
| -rw-r--r-- | views/layouts/blog-page.html | 126 |
3 files changed, 275 insertions, 59 deletions
diff --git a/views/index.html b/views/index.html index 6d4bc2f..1c57bd1 100644 --- a/views/index.html +++ b/views/index.html @@ -12,34 +12,51 @@ <style> .menu-outer-body { border-radius: 10%; - width: 60vw; - height: 40vh; + width: 40vh; + height: 30vh; } .menu-inner-body { width: 85%; } - @media (max-aspect-ratio: 1.2/1) { - .menu-inner-body { - width: 92.5%; - } + .flex-adaptive { + flex-direction: row; + } + + .language-icon { + max-width: calc(80% / {{ .AvailableLanguages | len }}); + max-height: 80%; } @media (max-aspect-ratio: 0.8/1) { .menu-outer-body { - width: 100vw; - height: 80vh; + border-radius: 5%; + } + + .menu-outer-body { + width: min(40vh, 100vw); + height: 40vh; + border-radius: 0; + } + + .language-icon { + max-width: 40%; + max-height: calc(80% / {{ .AvailableLanguages | len }}); } .menu-inner-body { - width: 100%; + width: 92.5%; + } + + .flex-adaptive { + flex-direction: column; } } </style> </head> -<body data-theme="night" class="font-spectral text-main-dark text-vmax1-5 overflow-hidden bg-interlocked-hexagons h-screen flex flex-col"> +<body data-theme="night" class="font-spectral text-main-dark text-[1.5vmax] overflow-hidden bg-interlocked-hexagons h-screen flex flex-col"> <div class="absolute star z-0">*</div> <div class="absolute star z-0">*</div> @@ -86,27 +103,13 @@ </script> <div class="menu-outer-body p-4 z-1 bg-background-dark flex flex-col mx-auto my-auto opacity-70"> - <p class="font-patua mx-auto text-vmax2-5 mt-vmin0-8 mb-vmin1-6">saya.today</p> - <div class="menu-inner-body grow bg-background-light flex flex-col mx-auto mb-vmin1-6 overflow-y-auto opacity-100"> - {{- range .BlogPages }} - <div class="m-2 flex flex-row justify-center justify-items-center gap-4"> - <img style="flex-grow: 0;" class="flex-1 object-cover rounded-4xl select-none w-vmax4 h-vmax4" src="https://f003.backblazeb2.com/file/sayana-photos/thumbnails/{{ .Thumbnail }}.webp"> - <div class="flex-5 justify-self-center flex-col border-r-1 border-dashed border-opacity-50 border-main-medium"> - <a href="/blog/{{ .Link }}" class="block font-extrabold">{{ .Title }}</a> - <a href="/blog/{{ .Link }}" class="block italic text-vmax1 text-secondary">{{ .ActionDate }}</a> - <p>{{ .ShortDescription }}</p> - </div> - <div class="flex-3 justify-self-center flex flex-col text-right"> - <p class="grow text-vmax1"> - Тэги: {{ .Tags }} - </p> - <p class="italic text-secondary text-vmax1"> - {{ .PublishedTime }} - </p> - </div> - </div> + <p class="font-patua mx-auto text-[2.5vmax] mt-[0.8vmin] mb-[0.8vmin]">saya.today</p> + <div class="menu-inner-body grow bg-background-light flex flex-adaptive mx-auto opacity-100"> + {{- range .AvailableLanguages }} + <img onclick="location.href='/blog/{{ .Name }}';" class="object-scale-down cursor-pointer flex-1 rounded-[20%] language-icon mx-auto my-auto relative" src="{{ .Flag }}" alt="{{ .Alt }}"> {{- end }} </div> + <p class="font-spectral mx-auto text-[1.5vmax] text-secondary mt-[0.8vmin] mb-[0.8vmin]">Choose your language</p> </div> <script> diff --git a/views/layouts/blog-main.html b/views/layouts/blog-main.html new file mode 100644 index 0000000..1b8e149 --- /dev/null +++ b/views/layouts/blog-main.html @@ -0,0 +1,147 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <title>SAYA TODAY // Заглавная</title> + <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.2/css/all.min.css"> + <link rel="preconnect" href="https://fonts.googleapis.com"> + <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> + <link href="https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&family=Patua+One&display=swap" rel="stylesheet"> + <link href="/output.css" rel="stylesheet"> + <style> + .menu-outer-body { + border-radius: 10%; + width: 60vw; + height: 40vh; + } + + .menu-inner-body { + width: 85%; + } + + @media (max-aspect-ratio: 1.2/1) { + .menu-outer-body { + border-radius: 5%; + } + + .menu-inner-body { + width: 92.5%; + } + } + + @media (max-aspect-ratio: 0.8/1) { + .menu-outer-body { + width: 100vw; + height: 80vh; + border-radius: 0; + } + + .menu-inner-body { + width: 100%; + } + } + </style> +</head> + +<body data-theme="night" class="font-spectral text-main-dark text-[1.5vmax] overflow-hidden bg-interlocked-hexagons h-screen flex flex-col"> + + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + <div class="absolute star z-0">*</div> + + <script> + function switchTheme(theme) { + if (theme == "" || typeof theme == "undefined") { + const currentTheme = document.body.getAttribute('data-theme'); + switch (currentTheme) { + case "olive": theme = "lettuce"; break; + case "lettuce": theme = "night"; break; + case "night": theme = "olive"; break; + } + } + // localStorage.setItem('theme', theme); + document.body.setAttribute('data-theme', theme); + } + + const savedTheme = 'night'; + switchTheme(savedTheme); + </script> + + <div class="menu-outer-body p-4 z-1 bg-background-dark flex flex-col mx-auto my-auto opacity-70"> + <p class="font-patua mx-auto text-[2.5vmax] mt-[0.8vmin] mb-[1.6vmin]">saya.today</p> + <div class="menu-inner-body grow bg-background-light flex flex-col mx-auto mb-[1.6vmin] overflow-y-auto opacity-100"> + {{- range .BlogPages }} + <div class="m-2 flex flex-row justify-center justify-items-center gap-4"> + <img onclick="location.href='/blog/{{ .Link }}';" style="flex-grow: 0;" class="flex-1 cursor-pointer object-cover rounded-4xl select-none w-[4vmax] h-[4vmax]" src="https://f003.backblazeb2.com/file/sayana-photos/thumbnails/{{ .Thumbnail }}.webp"> + <div class="flex-5 justify-self-center flex-col border-r-1 border-dashed border-opacity-50 border-main-medium"> + <a href="/blog/{{ .Link }}" class="block font-extrabold">{{ .Title }}</a> + <a href="/blog/{{ .Link }}" class="block italic text-[1vmax] text-secondary">{{ .ActionDate }}</a> + <p>{{ .ShortDescription }}</p> + </div> + <div class="flex-3 justify-self-center flex flex-col text-right"> + <p class="grow text-[1vmax]"> + {{ .Tags }} + </p> + <p class="italic text-secondary text-[1vmax]"> + {{ .PublishedTime }} + </p> + </div> + </div> + {{- end }} + </div> + </div> + + <script> + function generateStars() { + var clWidth = document.documentElement.clientWidth; + var clHeight = document.documentElement.clientHeight; + + stars = document.getElementsByClassName("star"); + for (let starIndex = 0; starIndex < stars.length; starIndex++) { + const star = stars[starIndex]; + const x = Math.floor(Math.random() * clWidth); + const y = Math.floor(Math.random() * clHeight * 0.8); + const rot = Math.random() * 90; + const animDuration = (Math.random() * 10) + 3; + const sz = Math.floor(Math.random() * 8) + 12; + star.style.transform = `translateX(${x}px) translateY(${y}px) rotate(${rot}deg)`; + star.style.animationDuration = `${animDuration}s`; + star.style.fontSize = `${sz}px`; + } + } + + document.addEventListener('DOMContentLoaded', generateStars); + + let generateStarsTimer; + window.addEventListener("resize", () => { + clearTimeout(generateStarsTimer); + generateStarsTimer = setTimeout(() => { + generateStars(); + }, 1000); + }); + </script> +</body> +</html> diff --git a/views/layouts/blog-page.html b/views/layouts/blog-page.html index 6ee7d85..3552d00 100644 --- a/views/layouts/blog-page.html +++ b/views/layouts/blog-page.html @@ -8,13 +8,23 @@ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.8.3/css/lightgallery.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.8.3/css/lg-zoom.min.css"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightgallery/2.8.3/css/lg-thumbnail.min.css"> +{{- if .MapLocationX }} + <link rel="stylesheet" href="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet/1.9.4/leaflet.css"> +{{- end }} <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link href="https://fonts.googleapis.com/css2?family=Spectral:ital,wght@0,200;0,300;0,400;0,500;0,600;0,700;0,800;1,200;1,300;1,400;1,500;1,600;1,700;1,800&family=Patua+One&display=swap" rel="stylesheet"> <link href="/output.css" rel="stylesheet"> + + <style> + .map-container .leaflet-container { + width: 100% !important; + height: 100% !important; + } + </style> </head> -<body data-theme="olive" class="font-spectral text-main-dark overflow-hidden bg-interlocked-hexagons bg-repeat bg-pattern-body h-screen flex"> +<body data-theme="night" class="font-spectral text-main-dark overflow-hidden bg-interlocked-hexagons h-screen flex"> <script> function switchTheme(theme) { @@ -30,40 +40,45 @@ document.body.setAttribute('data-theme', theme); } - const savedTheme = localStorage.getItem('theme') || 'olive'; + const savedTheme = localStorage.getItem('theme') || 'night'; switchTheme(savedTheme); </script> - <div class="desktop-sidebar-custom fixed bg-squares-and-triangles bg-repeat flex-col items-center shadow-2xl z-20 h-screen desktop"> + <div class="desktop-sidebar-custom sticky bg-squares-and-triangles bg-repeat flex-col items-center shadow-2xl z-20 h-screen desktop"> <div class="logo-custom text-sidebar font-patua font-extrabold text-center relative z-20"> saya.today </div> <div class="flex flex-col gap-0 relative z-20"> - <i onclick="location.href='/';" class="fas fa-home nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> + <i onclick="location.href='../';" class="fas fa-home nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> <i class="fas fa-search nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> <i class="fas fa-images nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> <i onclick="switchTheme('')" class="fas fa-swatchbook nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> </div> </div> - <div class="bg-background-dark z-10 h-screen desktop" style="padding-left: 5vw;"> + <div class="bg-background-dark z-10 h-screen desktop"> <div class="border-left-custom bg-background-dark"></div> - <div class="content-square flex flex-col bg-background-dark relative mt-vmin1-6 mx-vmin1-6"> - <div class="flex flex-row mb-vmin0-4"> - <i onclick="location.href='/';" class="fas fa-circle-left hover:bg-main-dark hover:bg-opacity-10 cursor-pointer transition-colors duration-300 rounded-md text-vmax2 mt-auto mb-auto pl-vmin0-8 pr-2"></i> - <p class="text-vmax2 font-spectral italic font-extrabold select-none mt-auto pl-vmin0-8 pr-vmin1-2">//</p> - <p class="text-vmax2 font-spectral italic text-left mt-auto">{{ .Title }}</p> - <p class="grow text-vmax1-5 font-spectral text-secondary text-right mt-auto">{{ .PublishedDate }}</p> + <div class="content-square flex flex-col bg-background-dark relative mt-[1.6vmin] mx-[1.6vmin]"> + <div class="flex flex-row mb-[0.4vmin]"> + <i onclick="location.href='../';" class="fas fa-circle-left hover:bg-main-dark hover:bg-opacity-10 cursor-pointer transition-colors duration-300 rounded-md text-[2vmax] mt-auto mb-auto px-[0.8vmin]"></i> + <p class="text-[2vmax] font-spectral italic font-extrabold select-none mt-auto pl-[0.8vmin] pr-[1.2vmin]">//</p> + <p class="text-[2vmax] font-spectral italic text-left mt-auto">{{ .Title }}</p> + <p class="grow text-[1.5vmax] font-spectral text-secondary text-right mt-auto">{{ .PublishedDate }}</p> </div> - <hr class="border-t-4 border-dotted border-main-dark mb-vmin0-8"> + <hr class="border-t-4 border-dotted border-main-dark mb-[0.8vmin]"> - <div class="bg-background-light flex flex-col flex-1 overflow-y-auto inset-shadow p-vmin2-4"> + <div class="bg-background-light flex flex-col flex-1 overflow-y-auto inset-shadow p-[2.4vmin]"> {{ .ParsedMarkdownDesktop }} + {{- if .MapLocationX }} + <hr class="border-t-4 border-dotted border-main-dark mt-[0.8vmin] mb-[0.8vmin] w-[80%] ml-auto mr-auto"> + <div id="location-map-desktop" class="relative p-[0.8vmin] flex-none ml-auto mr-auto w-[60%] h-[40vh]"></div> + <hr class="border-t-4 border-dotted border-main-dark mt-[0.8vmin] mb-[0.8vmin] w-[80%] ml-auto mr-auto"> + {{- end }} </div> - <div class="flex flex-row mt-vmin0-8 mb-vmin0-4"> - <p class="grow text-vmax0-8 lh-0-9 font-spectral italic text-right text-secondary mr-2"> + <div class="flex flex-row mt-[0.8vmin] mb-[0.4vmin]"> + <p class="grow text-[0.8vmax]/[0.9] font-spectral italic text-right text-secondary mr-2"> <a href="">{{ .Title }}</a> © {{ .PublishedYear }} by <a href="https://t.me/EarlInisMona">Saya Andy</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a> </p> <img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" alt="" style="max-width:1.2vh; max-height:1.2vh;"> @@ -71,15 +86,15 @@ <img src="https://mirrors.creativecommons.org/presskit/icons/sa.svg" alt="" style="max-width:1.2vh; max-height:1.2vh;"> </div> - <hr class="border-t-4 border-dotted border-main-dark mb-vmin0-8"> + <hr class="border-t-4 border-dotted border-main-dark mb-[0.8vmin]"> </div> <div class="border-right-custom bg-background-dark shadow-2xl"></div> </div> - <div class="mobile-topbar-custom fixed bg-squares-and-triangles bg-repeat flex-row items-center shadow-2xl w-vw90 z-20 mobile"> + <div class="mobile-topbar-custom fixed bg-squares-and-triangles bg-repeat flex-row items-center shadow-2xl w-[90vw] z-20 mobile"> <div class="flex flex-row gap-0 relative z-20"> - <i onclick="location.href='/';" class="fas fa-home nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> + <i onclick="location.href='../';" class="fas fa-home nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> <i class="fas fa-search nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> <i class="fas fa-images nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> <i onclick="switchTheme('')" class="fas fa-swatchbook nav-icon-custom text-sidebar hover:bg-background-dark cursor-pointer transition-colors duration-300 flex justify-center items-center rounded-lg"></i> @@ -89,24 +104,29 @@ </div> </div> - <div class="bg-background-dark flex-row z-10 w-vw90 h-vh90 mobile" style="margin-left: 5vw; margin-top: 10vh;"> + <div class="bg-background-dark flex-row z-10 w-[90vw] h-[92vh] mobile ml-[5vw] mt-[8vh]"> <div class="border-left-custom bg-background-dark"></div> - <div class="content-square flex flex-col bg-background-dark relative mt-vmin1-6 mx-vmin1-6"> - <div class="flex flex-row mb-vmin0-4"> - <i onclick="location.href='/';" class="fas fa-circle-left hover:bg-main-dark hover:bg-opacity-10 cursor-pointer transition-colors duration-300 rounded-md text-vmax2 mt-auto mb-auto pl-vmin0-8 pr-2"></i> - <p class="text-vmax2 font-spectral italic font-extrabold select-none mt-auto pl-vmin0-8 pr-vmin1-2">//</p> - <p class="text-vmax2 font-spectral italic text-left mt-auto">{{ .Title }}</p> - <p class="grow text-vmax1-5 font-spectral text-secondary text-right mt-auto">{{ .PublishedDate }}</p> + <div class="content-square flex flex-col bg-background-dark relative mt-[1.6vmin] mx-[1.6vmin]"> + <div class="flex flex-row mb-[0.4vmin]"> + <i onclick="location.href='../';" class="fas fa-circle-left hover:bg-main-dark hover:bg-opacity-10 cursor-pointer transition-colors duration-300 rounded-md text-[2vmax] mt-auto mb-auto px-[0.8vmin]"></i> + <p class="text-[2vmax] font-spectral italic font-extrabold select-none mt-auto pl-[0.8vmin] pr-[1.2vmin]">//</p> + <p class="text-[2vmax] font-spectral italic text-left mt-auto">{{ .Title }}</p> + <p class="grow text-[1.5vmax] font-spectral text-secondary text-right mt-auto">{{ .PublishedDate }}</p> </div> - <hr class="border-t-4 border-dotted border-main-dark mb-vmin0-8"> + <hr class="border-t-4 border-dotted border-main-dark mb-[0.8vmin]"> - <div class="bg-background-light flex flex-col flex-1 overflow-y-auto inset-shadow p-vmin2-4"> + <div class="bg-background-light flex flex-col overflow-y-auto inset-shadow p-[2.4vmin] max-h-[80%]"> {{ .ParsedMarkdownMobile }} + {{- if .MapLocationX }} + <hr class="border-t-4 border-dotted border-main-dark mt-[0.8vmin] mb-[0.8vmin] w-[80%] ml-auto mr-auto"> + <div id="location-map-mobile" class="relative p-[0.8vmin] flex-none ml-auto mr-auto w-[100%] h-[40vh]"></div> + <hr class="border-t-4 border-dotted border-main-dark mt-[0.8vmin] mb-[0.8vmin] w-[80%] ml-auto mr-auto"> + {{- end }} </div> - <div class="flex flex-row mt-vmin0-8 mb-vmin0-4"> - <p class="grow text-vmax0-8 lh-0-9 font-spectral italic text-right text-secondary mr-2"> + <div class="flex flex-row mt-[0.8vmin] mb-[0.4vmin]"> + <p class="grow text-[0.8vmax]/[0.9] font-spectral italic text-right text-secondary mr-2"> <a href="">{{ .Title }}</a> © {{ .PublishedYear }} by <a href="https://t.me/EarlInisMona">Saya Andy</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a> </p> <img src="https://mirrors.creativecommons.org/presskit/icons/cc.svg" alt="" style="max-width:1.2vh; max-height:1.2vh;"> @@ -114,7 +134,7 @@ <img src="https://mirrors.creativecommons.org/presskit/icons/sa.svg" alt="" style="max-width:1.2vh; max-height:1.2vh;"> </div> - <hr class="border-t-4 border-dotted border-main-dark mb-vmin0-8"> + <hr class="border-t-4 border-dotted border-main-dark mb-[0.8vmin]"> </div> <div class="border-right-custom bg-background-dark shadow-2xl"></div> @@ -123,6 +143,52 @@ <script src="https://f003.backblazeb2.com/file/sayana-static/libs/lightgallery/2.8.3/lightgallery.min.js"></script> <script src="https://f003.backblazeb2.com/file/sayana-static/libs/lightgallery/2.8.3/plugins/lg-zoom.min.js"></script> <script src="https://f003.backblazeb2.com/file/sayana-static/libs/lightgallery/2.8.3/plugins/lg-thumbnail.min.js"></script> +{{- if .MapLocationX }} + <script src="https://f003.backblazeb2.com/file/sayana-static/libs/leaflet/1.9.4/leaflet.js"></script> + + <script> + function initLocationMap(id, x, y, relativeErrorMeters = 0) { + var map = L.map(id).setView([x, y], 13); + + L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 19, + attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' + }).addTo(map); + + if (relativeErrorMeters != 0) { + var circle = L.circle([x, y], { + color: '#8a9d8a', + fillColor: '#8a9d8a', + fillOpacity: 0.15, + radius: relativeErrorMeters + }).addTo(map); + } + + var marker = L.marker([x, y]).addTo(map); + } + + document.addEventListener('DOMContentLoaded', () => {initLocationMap( + 'location-map-desktop', + {{ .MapLocationX }}, + {{ .MapLocationY }}, + {{ .MapLocationAreaMeters }} + )}); + + document.addEventListener('DOMContentLoaded', () => {initLocationMap( + 'location-map-mobile', + {{ .MapLocationX }}, + {{ .MapLocationY }}, + {{ .MapLocationAreaMeters }} + )}); + + window.addEventListener('resize', function() { + setTimeout(() => { + if (window.location-map-desktop) window.location-map-desktop.invalidateSize(); + if (window.location-map-mobile) window.location-map-mobile.invalidateSize(); + }, 100); + }); + </script> +{{- end }} </body> </html> |