Skip to content

Commit c7eff81

Browse files
committed
upload maps
1 parent df168f6 commit c7eff81

File tree

1 file changed

+47
-41
lines changed

1 file changed

+47
-41
lines changed

collection.html

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
background-color: #f8f9fa;
3131
z-index: 10;
3232
}
33+
.highlighted-row {
34+
outline: 2px solid #eeba2b;
35+
}
36+
.highlighted-row td {
37+
background-color: #fefbf6 !important;
38+
transition: background-color 0.8s ease;
39+
}
3340
</style>
3441

3542
</head>
@@ -126,7 +133,7 @@ <h5 class="modal-title" id="infoMetadataCollectionLabel">About Metadata Collecti
126133
<input id="searchInput" class="form-control" type="text" placeholder="Search..." oninput="applyFilters()">
127134
</div>
128135
<div class="col-12 col-md-4 mt-2 mt-md-0 d-flex justify-content-center justify-content-md-start">
129-
<a href="maps.html" class="btn btn-outline-success w-100 w-md-auto disabled">
136+
<a href="maps.html" class="btn btn-outline-success w-100 w-md-auto">
130137
<i class="fas fa-map"></i> View Manuscript Maps
131138
</a>
132139
</div>
@@ -502,21 +509,7 @@ <h5 class="border-bottom pb-1">${title}</h5>
502509
addOptions("personFilter", persons);
503510
}
504511

505-
/*function filterTable() {
506-
const textFilter = document.getElementById("searchInput").value.toLowerCase();
507-
const country = document.getElementById("countryFilter").value;
508-
const century = document.getElementById("centuryFilter").value.replace("C.", "");
509-
const person = document.getElementById("personFilter").value.toLowerCase();
510-
511-
document.querySelectorAll("#tableBody tr").forEach(row => {
512-
const matchesText = row.dataset.text.includes(textFilter);
513-
const matchesCountry = !country || row.dataset.country === country;
514-
const matchesCentury = !century || row.dataset.century === century;
515-
const matchesPerson = !person || row.dataset.persons.includes(person);
516-
517-
row.style.display = matchesText && matchesCountry && matchesCentury && matchesPerson ? "" : "none";
518-
});
519-
}*/
512+
520513
/*Simple filter*/
521514
function filterTable() {
522515
const searchTerm = document.getElementById("searchInput").value.toLowerCase();
@@ -527,29 +520,6 @@ <h5 class="border-bottom pb-1">${title}</h5>
527520
});
528521
}
529522

530-
531-
/*async function loadMetadata() {
532-
const tableBody = document.getElementById("tableBody");
533-
const fileList = await fetchFileList();
534-
535-
for (const file of fileList) {
536-
try {
537-
const record = await fetchJSONFile(file.download_url);
538-
const entries = Array.isArray(record) ? record : [record];
539-
entries.forEach(entry => {
540-
allEntries.push(entry);
541-
const row = createTableRow(entry);
542-
tableBody.appendChild(row);
543-
});
544-
} catch (err) {
545-
console.error("Error loading file:", file.name, err);
546-
}
547-
}
548-
549-
populateFilters(allEntries);
550-
}
551-
552-
loadMetadata();*/
553523
</script>
554524

555525
<script>
@@ -992,10 +962,46 @@ <h5 class="border-bottom pb-1">${title}</h5>
992962
}
993963

994964
loadMetadataWithFilters();
965+
</script>
995966

967+
<!--Scroll down to ms row-->
968+
<script>
969+
document.addEventListener("DOMContentLoaded", () => {
970+
const targetId = location.hash?.substring(1);
971+
if (!targetId) return;
996972

997-
</script>
973+
const tableBody = document.getElementById("tableBody");
974+
const container = document.querySelector(".table-container");
975+
976+
function scrollAndHighlight(row) {
977+
// First scroll the page so the table is visible
978+
container.scrollIntoView({ behavior: "smooth", block: "start" });
979+
980+
// Then scroll inside the container to center the row
981+
const offset = row.offsetTop - container.clientHeight / 2 + row.clientHeight / 2;
982+
setTimeout(() => {
983+
container.scrollTo({ top: offset, behavior: "smooth" });
984+
row.classList.add("highlighted-row");
985+
}, 500); // wait a bit for outer scroll to finish
986+
}
987+
988+
function tryScroll() {
989+
const row = document.getElementById(targetId);
990+
if (row) {
991+
scrollAndHighlight(row);
992+
return true;
993+
}
994+
return false;
995+
}
996+
997+
if (tryScroll()) return;
998998

999+
const observer = new MutationObserver(() => {
1000+
if (tryScroll()) observer.disconnect();
1001+
});
1002+
observer.observe(tableBody, { childList: true, subtree: true });
1003+
});
1004+
</script>
9991005

1000-
</body>
1006+
</body>
10011007
</html>

0 commit comments

Comments
 (0)