mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-06-27 00:10:35 +00:00
Some fixes and enhancements befor javascript rework
This commit is contained in:
@ -55,6 +55,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Scroll to top element -->
|
||||
{% include 'interactions/scroll_to_top.html.j2' %}
|
||||
|
||||
<!-- Modals -->
|
||||
{% include 'modals/show_metadata.html.j2' %}
|
||||
@ -337,6 +339,20 @@
|
||||
|
||||
});
|
||||
|
||||
// new insepct event listener makeing use of javascript bubbleing
|
||||
let resultsTable = document.getElementById("query-results");
|
||||
console.log(resultsTable);
|
||||
resultsTable.addEventListener("click", (event) => {
|
||||
let dataIndex;
|
||||
if (event.target.classList.contains("inspect-btn")) {
|
||||
dataIndex = parseInt(event.target.closest("tr").dataset.index);
|
||||
console.log(dataIndex);
|
||||
results.jsList.inspect([dataIndex], "inspect");
|
||||
} else if (event.target.classList.contains("add-btn")) {
|
||||
dataIndex = parseInt(event.target.closest("tr").dataset.index);
|
||||
results.jsList.addToSubResults(dataIndex);
|
||||
}
|
||||
})
|
||||
|
||||
// ### Download events and sub-results creation ###
|
||||
var loadingSpinnerHTML = `
|
||||
@ -405,5 +421,20 @@
|
||||
results.jsList.contextData,
|
||||
downloadInspectContextElement);
|
||||
};
|
||||
|
||||
// scroll to top button if user scrolled down the list
|
||||
let headline = document.querySelector(".headline");
|
||||
let scrollToTop = document.querySelector("#menu-scroll-to-top-div");
|
||||
window.addEventListener("scroll", (event) => {
|
||||
if (pageYOffset > 250) {
|
||||
scrollToTop.classList.toggle("hide", false);
|
||||
} else {
|
||||
scrollToTop.classList.toggle("hide", true);
|
||||
}
|
||||
});
|
||||
scrollToTop.onclick = () => {
|
||||
headline.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"});
|
||||
};
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user