57 lines
1.5 KiB
Plaintext
57 lines
1.5 KiB
Plaintext
<html>
|
|
<script>'<base href="BASEPATH">';</script>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", (event) => {
|
|
var div = document.createElement("div");
|
|
div.textContent = "There are " + clusters.length + " clusters.";
|
|
document.body.appendChild(div);
|
|
clusters.forEach((cluster, index) => {
|
|
var div = document.createElement("div");
|
|
div.textContent = "Cluster " + (index + 1) + " has " + cluster.length + " neighbors.";
|
|
document.body.appendChild(div);
|
|
cluster.forEach((tuple, index) => {
|
|
if (index > 15) {
|
|
return;
|
|
}
|
|
var div = document.createElement("div");
|
|
div.classList.add("face");
|
|
let faceId = tuple[0],
|
|
photoId = tuple[1];
|
|
div.setAttribute("photo-id", photoId);
|
|
div.style.backgroundImage = "url(face-data/" + (faceId % 100) + "/" + faceId + "-original.png)";
|
|
div.addEventListener("click", (event) => {
|
|
let photoId = parseInt(event.currentTarget.getAttribute("photo-id"));
|
|
if (photoId) {
|
|
window.open("face-explorer.html?" + photoId, "photo-" + photoId);
|
|
} else {
|
|
alert("No photo id mapped to face.");
|
|
}
|
|
});
|
|
document.body.appendChild(div);
|
|
});
|
|
});
|
|
});
|
|
|
|
</script>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
|
|
.face {
|
|
width: 128px;
|
|
height: 128px;
|
|
background-size: contain;
|
|
background-position: center center;
|
|
display: inline-block;
|
|
border: 1px solid black;
|
|
margin: 0.5em;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.face:hover {
|
|
box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.5);
|
|
}
|
|
</style>
|