2019-11-21 16:59:49 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
2019-11-23 15:20:58 +00:00
|
|
|
<meta charset="utf-8" />
|
2019-11-21 16:59:49 +00:00
|
|
|
<title>Junk rare cube</title>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
background: #eee;
|
|
|
|
}
|
|
|
|
|
|
|
|
main {
|
|
|
|
background: white;
|
2019-11-22 10:47:27 +00:00
|
|
|
max-width: 1220px;
|
2019-11-21 16:59:49 +00:00
|
|
|
margin: 0 auto;
|
|
|
|
padding: 20pt;
|
|
|
|
}
|
|
|
|
|
|
|
|
h1,
|
|
|
|
h2,
|
|
|
|
h3 {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
h2 {
|
|
|
|
font-weight: normal;
|
|
|
|
}
|
|
|
|
|
|
|
|
.columns {
|
|
|
|
padding: 20pt 0;
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
.color-section {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.color-section header {
|
|
|
|
text-align: center;
|
2019-11-22 14:58:55 +00:00
|
|
|
padding: 5px;
|
2019-11-21 16:59:49 +00:00
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
.color-W header.color-header {
|
2019-11-21 16:59:49 +00:00
|
|
|
background-color: #fff6eb;
|
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
.color-U header.color-header {
|
2019-11-21 16:59:49 +00:00
|
|
|
background-color: #49b0fd;
|
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
.color-B header.color-header {
|
2019-11-21 16:59:49 +00:00
|
|
|
background-color: #666;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
.color-R header.color-header {
|
2019-11-21 16:59:49 +00:00
|
|
|
background-color: #ff6868;
|
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
.color-G header.color-header {
|
2019-11-21 16:59:49 +00:00
|
|
|
background-color: #78ce59;
|
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
.color-MC header.color-header {
|
2019-11-21 16:59:49 +00:00
|
|
|
background: linear-gradient(to left, #f3ff6b, #ffb019);
|
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
.color-CL header.color-header {
|
2019-11-21 16:59:49 +00:00
|
|
|
background-color: #d2d2d2;
|
|
|
|
}
|
2019-11-22 10:47:27 +00:00
|
|
|
|
|
|
|
.color-L header.color-header {
|
|
|
|
background-color: #eeb445;
|
|
|
|
}
|
|
|
|
|
|
|
|
.type-section {
|
|
|
|
border: 1px solid #aaa;
|
|
|
|
border-radius: 5px;
|
|
|
|
font-size: 10pt;
|
2019-11-22 14:58:55 +00:00
|
|
|
margin: 10px 5px;
|
2019-11-22 10:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.type-section header.type-header {
|
|
|
|
font-size: 12pt;
|
|
|
|
font-weight: bold;
|
|
|
|
border-bottom: 1px solid #ccc;
|
|
|
|
padding: 5px;
|
|
|
|
}
|
|
|
|
|
2019-11-22 14:58:55 +00:00
|
|
|
.cards {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
.cmc-index {
|
|
|
|
position: absolute;
|
|
|
|
opacity: 0.1;
|
|
|
|
right: 5px;
|
|
|
|
font-size: 15pt;
|
|
|
|
}
|
|
|
|
|
2019-11-22 10:47:27 +00:00
|
|
|
ul {
|
|
|
|
margin: 0;
|
|
|
|
padding: 0;
|
|
|
|
list-style-type: none;
|
|
|
|
border-bottom: 1px solid #ccc;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul li {
|
2019-11-22 14:58:55 +00:00
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul li a {
|
2019-11-22 10:47:27 +00:00
|
|
|
padding: 5px;
|
2019-11-22 14:58:55 +00:00
|
|
|
flex: 1;
|
|
|
|
color: inherit;
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul li a:hover {
|
|
|
|
background-color: #eee;
|
2019-11-22 10:47:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ul:last-child {
|
|
|
|
border-bottom: none;
|
|
|
|
}
|
2019-11-22 14:58:55 +00:00
|
|
|
|
|
|
|
.img-overlay {
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
pointer-events: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
.img-overlay img {
|
|
|
|
width: auto;
|
|
|
|
height: 300px;
|
|
|
|
}
|
2019-11-23 15:20:58 +00:00
|
|
|
|
|
|
|
small {
|
|
|
|
color: #aaa;
|
|
|
|
display: block;
|
|
|
|
}
|
2019-11-21 16:59:49 +00:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<main>
|
|
|
|
<header>
|
2019-11-22 10:47:27 +00:00
|
|
|
<h1>Junk rare cube (<%=cards.length%> cards)</h1>
|
2019-11-21 16:59:49 +00:00
|
|
|
<h2>Using cards from <a href="https://www.cardmarket.com/en/Magic/Users/<%=user%>"><b><%= user %></b></a>
|
|
|
|
</h2>
|
2019-11-23 15:20:58 +00:00
|
|
|
<h2>Est. price without shipping: € <%= cards.reduce((a, c) => a + c.price, 0).toFixed(2) %></h2>
|
2019-11-21 16:59:49 +00:00
|
|
|
</header>
|
|
|
|
<section class="columns">
|
2019-11-23 15:20:58 +00:00
|
|
|
<% Object.entries(cubecards).forEach(([color, colorcards]) => { %>
|
2019-11-22 10:47:27 +00:00
|
|
|
<section class="color-section color-<%=color%>">
|
|
|
|
<header class="color-header">
|
|
|
|
<h3><%=utils.prettyColor(color)%> (<%=utils.deepSum(colorcards)%>)</h3>
|
2019-11-21 16:59:49 +00:00
|
|
|
</header>
|
2019-11-22 10:47:27 +00:00
|
|
|
<% Object.entries(colorcards).sort((a, b) => color == "MC" || color == "L" ? utils.abcSort(a[0], b[0]) : utils.typeSort(a[0], b[0])).forEach(([type, typecards]) => { %>
|
|
|
|
<article class="type-section">
|
|
|
|
<header class="type-header"><%= color == "MC" || color == "L" ? utils.prettyColor(type) : type %>
|
|
|
|
(<%=utils.deepSum(typecards)%>)</header>
|
|
|
|
<section class="cards">
|
|
|
|
<% Object.entries(typecards).forEach(([cmc, finalcards]) => { %>
|
2019-11-22 14:58:55 +00:00
|
|
|
<div class="cmc-index"><%=cmc%></div>
|
2019-11-22 10:47:27 +00:00
|
|
|
<ul>
|
|
|
|
<% finalcards.forEach(card => { %>
|
2019-11-22 14:58:55 +00:00
|
|
|
<li data-set="<%=card.set%>" data-num="<%=card.number%>">
|
|
|
|
<a target="_blank" data-image="<%=card.scryfallImageUrl%>"
|
|
|
|
href="<%= card.scryfallUrl %>">
|
2019-11-23 15:20:58 +00:00
|
|
|
<%= card.name %><small>€ <%=card.price.toFixed(2)%> - #<%=card.edhrecRank%></small>
|
2019-11-22 14:58:55 +00:00
|
|
|
</a>
|
|
|
|
</li>
|
2019-11-22 10:47:27 +00:00
|
|
|
<% }); %>
|
|
|
|
</ul>
|
|
|
|
<% }); %>
|
|
|
|
</section>
|
|
|
|
</article>
|
|
|
|
<% }); %>
|
2019-11-21 16:59:49 +00:00
|
|
|
</section>
|
2019-11-22 10:47:27 +00:00
|
|
|
<% }); %>
|
2019-11-21 16:59:49 +00:00
|
|
|
</section>
|
|
|
|
</main>
|
2019-11-22 14:58:55 +00:00
|
|
|
|
|
|
|
<script>
|
|
|
|
const overlay = document.createElement("div");
|
|
|
|
const img = document.createElement("img");
|
|
|
|
overlay.appendChild(img);
|
|
|
|
overlay.classList.add("img-overlay");
|
|
|
|
document.body.appendChild(overlay);
|
|
|
|
overlay.style.display = "none";
|
|
|
|
Array.prototype.slice.call(document.querySelectorAll("li a[data-image]"), 0).forEach(el => {
|
|
|
|
el.addEventListener("mouseenter", ev => {
|
|
|
|
overlay.style.display = "block";
|
|
|
|
img.src = el.dataset.image;
|
|
|
|
});
|
|
|
|
el.addEventListener("mouseleave", ev => {
|
|
|
|
overlay.style.display = "none";
|
|
|
|
});
|
|
|
|
el.addEventListener("mousemove", ev => {
|
|
|
|
overlay.style.left = `${ev.clientX}px`;
|
|
|
|
overlay.style.top = `${ev.clientY - 320}px`;
|
|
|
|
console.log(ev);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
2019-11-21 16:59:49 +00:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|