mirror of
https://github.com/Theodor-Springmann-Stiftung/kgpz_web.git
synced 2025-10-29 17:15:31 +00:00
THE GREAT JS CLEANUP
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
<!-- Two-column layout for piece view -->
|
||||
<div class="flex flex-col lg:flex-row gap-6 w-full min-h-screen">
|
||||
<!-- Column 1: Table of Contents ONLY -->
|
||||
<div class="lg:w-1/4 xl:w-1/4 flex-shrink-0 bg-slate-50 px-4 py-4">
|
||||
<div class="lg:w-1/4 xl:w-1/4 2xl:w-1/4 3xl:w-1/5 flex-shrink-0 bg-slate-50 px-4 py-4">
|
||||
<div class="sticky top-0 max-h-screen overflow-y-auto overscroll-contain bg-slate-50">
|
||||
{{ template "_piece_inhaltsverzeichnis" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Column 2: Sequential Page Layout -->
|
||||
<div class="lg:w-3/4 xl:w-3/4 flex-1 py-4">
|
||||
<div class="lg:w-3/4 xl:w-3/4 2xl:w-3/4 3xl:w-4/5 flex-1 py-4">
|
||||
{{ template "_piece_sequential_layout" . }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,32 +1 @@
|
||||
<title>KGPZ – {{ if .model.Title }}{{ .model.Title }}{{ else }}Beitrag{{ end }} ({{ len .model.IssueContexts }} Teil{{ if gt (len .model.IssueContexts) 1 }}e{{ end }})</title>
|
||||
|
||||
<script>
|
||||
// Make template data available to JavaScript
|
||||
window.templateData = {
|
||||
targetPage: {{ if .targetPage }}{{ .targetPage }}{{ else }}0{{ end }}
|
||||
};
|
||||
</script>
|
||||
|
||||
{{ if .targetPage }}
|
||||
<script>
|
||||
// Auto-scroll to target page when page loads
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Wait for newspaper layout to be initialized
|
||||
setTimeout(function() {
|
||||
const targetPage = {{ .targetPage }};
|
||||
const pageContainer = document.querySelector('[data-page-container="' + targetPage + '"]');
|
||||
if (pageContainer) {
|
||||
pageContainer.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'start'
|
||||
});
|
||||
|
||||
// Highlight the page in the Inhaltsverzeichnis if function exists
|
||||
if (typeof markCurrentPageInInhaltsverzeichnis === 'function') {
|
||||
markCurrentPageInInhaltsverzeichnis(targetPage);
|
||||
}
|
||||
}
|
||||
}, 500); // Give time for layout initialization
|
||||
});
|
||||
</script>
|
||||
{{ end }}
|
||||
<title>KGPZ – {{ if .model.Title }}{{ .model.Title }}{{ else }}Beitrag{{ end }} ({{ len .model.IssueContexts }} Teil{{ if gt (len .model.IssueContexts) 1 }}e{{ end }})</title>
|
||||
Reference in New Issue
Block a user