judith-art/by-artist/kris/index.html

216 lines
7.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Ubuntu&display=swap" rel="stylesheet" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
font-family: "Ubuntu", sans-serif;
}
a.G, a.R, a.X {
display: inline-block;
border: 2px solid transparent;
overflow: hidden;
}
img {
max-height: 200px;
max-width: 100%;
}
a.X {
border: 2px solid red;
}
a.X img {
filter: blur(1rem);
}
a.R {
border: 2px solid orange;
}
a.R img {
filter: blur(0.5rem);
}
a.X img:hover, a.R img:hover {
filter: blur(0);
}
main {
max-width: 1024px;
border: 1px solid #ccc;
margin: 0 auto;
padding: 0.5rem;
overflow: none;
text-align: center;
}
footer {
max-width: 1024px;
margin: 0 auto;
padding: 1rem 0;
font-size: 10pt;
text-align: right;
}
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 100%;
background-color: rgba(0, 0, 0, 0.8);
}
.modal .inner {
width: calc(100% - 2rem);
max-height: calc(100vh - 2rem);
max-width: 1024px;
position: relative;
overflow: scroll;
margin: 1rem auto;
padding: 0;
background-color: #fff;
}
.modal .meta {
padding: 1rem;
margin: 0 auto;
}
.show {
display: block !important;
}
.modal .img {
text-align: center;
width: 100%;
}
.modal .img img {
max-width: 100%;
max-height: 100vh;
}
dt {
font-weight: bold;
}
table {
margin: 0 auto;
min-width: 50%;
}
td {
padding: 5px;
}
tbody tr:nth-child(even) td {
background-color: #eee;
}
thead th {
border-bottom: 2px solid #888;
}
</style>
</head>
<body>
<main>
<h1>Artist: kris</h1>
<a href="kris--reading--lexy--G.jpg" class="G">
<img src="../../thumbs/kris--reading--lexy--G.jpg" title="reading" alt="reading" />
</a>
<a href="kris--foxfamily-s--polycute-makyo-jd-amdusias-kris-heff-lexy--G.jpg" class="G">
<img src="../../thumbs/kris--foxfamily-s--polycute-makyo-jd-amdusias-kris-heff-lexy--G.jpg" title="foxfamily-s" alt="foxfamily-s" />
</a>
<a href="kris--school--lexy--G.jpg" class="G">
<img src="../../thumbs/kris--school--lexy--G.jpg" title="school" alt="school" />
</a>
</main>
<footer>
Site built using <a href="https://commorg.projects.makyo.io" target="_blank">commission organizer</a> on 2019-12-14.
</footer>
<div class="modal">
<div class="inner">
<div class="meta"></div>
<div class="img"></div>
</div>
</div>
<script type="text/javascript">
const root = window.location.pathname.replace(/\/by-.+$/, '/');
const modal = document.querySelector('.modal');
const img = document.querySelector('.img');
const meta = document.querySelector('.meta');
const scroll = {
top: window.scrollY,
left: window.scrollX,
behavior: 'auto'
};
let mustLoadHash = window.location.hash !== '';
function loadHash() {
if (!mustLoadHash) {
mustLoadHash = true;
return;
}
hash = window.location.hash.replace('#', '');
if (hash !== '') {
scroll.top = window.scrollY;
scroll.left = window.scrollX;
document.querySelectorAll('.G, .R, .X').forEach(thumb => {
if (thumb.attributes.href.textContent === hash) {
thumb.click();
}
});
} else {
hideModal();
window.scrollTo(scroll);
}
}
function hideModal() {
modal.classList.remove('show');
// There's an edge case here, where if you load the page with
// no hash, click an image, then click back, it adds an empty
// hash to the URL (e.g: example.com/#). The problem with this
// is that it adds to the history, so if you click back from
// there, it goes to the location without the hash, then adds
// the hash again, meaning you can't back out of the page
// after clicking an image.
//
// The web is a mess and computers were a mistake.
if (window.location.hash !== '') {
window.location.hash = '';
}
}
document.body.addEventListener('keydown', evt => {
if (evt.key === 'Escape') {
hideModal();
}
});
modal.addEventListener('click', evt => {
hideModal();
});
window.onhashchange = loadHash;
document.querySelectorAll('.G, .R, .X').forEach(thumb => {
thumb.addEventListener('click', evt => {
const imgName = thumb.attributes.href.textContent;
const parts = imgName.split('.')[0].split('--');
const title = parts[1].replace(/-/g, ' ');
const characters = parts[2].split('-').map(c => `<a href="${root}by-character/${c}">${c}</a>`).join(', ');
evt.preventDefault();
modal.classList.add('show');
mustLoadHash = true;
window.location.hash = imgName;
img.innerHTML = `<a href="${imgName}" target="_blank"><img src="${imgName}" title="${title}" alt="${title}" /></a>`;
meta.innerHTML = `<h2>${title}</h2>
<table>
<thead>
<tr>
<th>Artist</th>
<th>Characters</th>
<th>Rating</th>
</tr>
</thead>
<tbody>
<tr>
<td><a href="${root}by-artist/${parts[0]}">${parts[0]}</a></td>
<td>${characters}</td>
<td><a href="${root}by-rating/${parts[3]}">${parts[3]}</a></td>
</tr>
</tbody>
</table>`;
});
});
loadHash();
</script>
</body>
</html>