From e4ead0b31828663db4cbf46bfd50df94031cbf1d Mon Sep 17 00:00:00 2001 From: Damian Oswald <72310532+Damian-Oswald@users.noreply.github.com> Date: Wed, 19 Jun 2024 16:42:38 +0200 Subject: [PATCH] Remove author information --- docs/index.html | 140 ++++++++++++++---- docs/index.qmd | 89 +++++------ .../libs/bootstrap/bootstrap.min.css | 4 +- 3 files changed, 149 insertions(+), 84 deletions(-) diff --git a/docs/index.html b/docs/index.html index 74261ca..f5a1417 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,12 +2,10 @@
- + - -Berechnung des Produzentenanteils am Konsumentenfranken
-- Bundesamt für Landwirtschaft BLW -
-- Bundesamt für Landwirtschaft BLW -
-12. Juni 2024
+19. Juni 2024
Berechnung des Produzentenanteils am Konsumentenfranken
-Berechnung des Produzentenanteils am Konsumentenfranken
icon: icon }; anchorJS.add('.anchored'); + const isCodeAnnotation = (el) => { + for (const clz of el.classList) { + if (clz.startsWith('code-annotation-')) { + return true; + } + } + return false; + } const clipboard = new window.ClipboardJS('.code-copy-button', { - target: function(trigger) { - return trigger.previousElementSibling; + text: function(trigger) { + const codeEl = trigger.previousElementSibling.cloneNode(true); + for (const childEl of codeEl.children) { + if (isCodeAnnotation(childEl)) { + childEl.remove(); + } + } + return codeEl.innerText; } }); clipboard.on('success', function(e) { @@ -217,6 +209,92 @@Berechnung des Produzentenanteils am Konsumentenfranken
return note.innerHTML; }); } + let selectedAnnoteEl; + const selectorForAnnotation = ( cell, annotation) => { + let cellAttr = 'data-code-cell="' + cell + '"'; + let lineAttr = 'data-code-annotation="' + annotation + '"'; + const selector = 'span[' + cellAttr + '][' + lineAttr + ']'; + return selector; + } + const selectCodeLines = (annoteEl) => { + const doc = window.document; + const targetCell = annoteEl.getAttribute("data-target-cell"); + const targetAnnotation = annoteEl.getAttribute("data-target-annotation"); + const annoteSpan = window.document.querySelector(selectorForAnnotation(targetCell, targetAnnotation)); + const lines = annoteSpan.getAttribute("data-code-lines").split(","); + const lineIds = lines.map((line) => { + return targetCell + "-" + line; + }) + let top = null; + let height = null; + let parent = null; + if (lineIds.length > 0) { + //compute the position of the single el (top and bottom and make a div) + const el = window.document.getElementById(lineIds[0]); + top = el.offsetTop; + height = el.offsetHeight; + parent = el.parentElement.parentElement; + if (lineIds.length > 1) { + const lastEl = window.document.getElementById(lineIds[lineIds.length - 1]); + const bottom = lastEl.offsetTop + lastEl.offsetHeight; + height = bottom - top; + } + if (top !== null && height !== null && parent !== null) { + // cook up a div (if necessary) and position it + let div = window.document.getElementById("code-annotation-line-highlight"); + if (div === null) { + div = window.document.createElement("div"); + div.setAttribute("id", "code-annotation-line-highlight"); + div.style.position = 'absolute'; + parent.appendChild(div); + } + div.style.top = top - 2 + "px"; + div.style.height = height + 4 + "px"; + let gutterDiv = window.document.getElementById("code-annotation-line-highlight-gutter"); + if (gutterDiv === null) { + gutterDiv = window.document.createElement("div"); + gutterDiv.setAttribute("id", "code-annotation-line-highlight-gutter"); + gutterDiv.style.position = 'absolute'; + const codeCell = window.document.getElementById(targetCell); + const gutter = codeCell.querySelector('.code-annotation-gutter'); + gutter.appendChild(gutterDiv); + } + gutterDiv.style.top = top - 2 + "px"; + gutterDiv.style.height = height + 4 + "px"; + } + selectedAnnoteEl = annoteEl; + } + }; + const unselectCodeLines = () => { + const elementsIds = ["code-annotation-line-highlight", "code-annotation-line-highlight-gutter"]; + elementsIds.forEach((elId) => { + const div = window.document.getElementById(elId); + if (div) { + div.remove(); + } + }); + selectedAnnoteEl = undefined; + }; + // Attach click handler to the DT + const annoteDls = window.document.querySelectorAll('dt[data-target-cell]'); + for (const annoteDlNode of annoteDls) { + annoteDlNode.addEventListener('click', (event) => { + const clickedEl = event.target; + if (clickedEl !== selectedAnnoteEl) { + unselectCodeLines(); + const activeEl = window.document.querySelector('dt[data-target-cell].code-annotation-active'); + if (activeEl) { + activeEl.classList.remove('code-annotation-active'); + } + selectCodeLines(clickedEl); + clickedEl.classList.add('code-annotation-active'); + } else { + // Unselect the line + unselectCodeLines(); + clickedEl.classList.remove('code-annotation-active'); + } + }); + } const findCites = (el) => { const parentEl = el.parentElement; if (parentEl) { diff --git a/docs/index.qmd b/docs/index.qmd index 11ac154..4ea280b 100644 --- a/docs/index.qmd +++ b/docs/index.qmd @@ -1,51 +1,38 @@ ---- -title: | - Berechnung des Produzentenanteils am Konsumentenfranken -subtitle: | - Pilotprojekt am Beispiel der konventionellen Molkerei- und UHT-Milch -author: - - name: Damian Oswald - email: damian.oswald@blw.admin.ch - affiliations: - - name: Bundesamt für Landwirtschaft BLW - address: Schwarzenburgstrasse 165 - city: 3097 Liebefeld - - name: Yawo Michel Afangbedji - email: michel-yawo.afangbedji@blw.admin.ch - affiliations: - - name: Bundesamt für Landwirtschaft BLW - address: Schwarzenburgstrasse 165 - city: 3097 Liebefeld -date: today -lang: de ---- - -:::{.callout-note} -Diese Webseite dient als Pilot und zielt nicht darauf ab, eine offizielle Statistik für das Bundesamt für Landwirtschaft zu erstellen. -::: - -Die aktuellen Milchpreise werden regelmässig vom Bundesamt für Landwirtschaft auf LINDAS hochgeladen. Mithilfe eines SPARQL-Queries werden diese Daten abgefragt, um aktuelle Marktinformationen zu erhalten. Diese Daten dienen der Berechnung des Produzentenanteils am Konsumentenpreis und werden anschliessend in einer interaktiven Grafik visualisiert. Diese Grafiken sind in diese Test-Webseite eingebettet.[^1] - -[^1]: Die interaktiven Grafiken werden in die Testseite als *iframe* eingebettet, um die Ergebnisse anschaulich darzustellen. Dies ermöglicht eine dynamische Präsentation der aktuellen Daten, welche sich in allen möglichen Websites einbetten lässt. - -```{=html} - -``` - -