From 57d061e0f5c02a44118e5619ff3ffef6dd5d5dcb Mon Sep 17 00:00:00 2001 From: Steffen Illium Date: Tue, 20 May 2025 11:47:23 +0200 Subject: [PATCH] enhance reference interactions --- _config.yml | 7 +++ _layouts/bibtemplate.html | 34 ++++++++++++-- _sass/custom.scss | 21 +++++++++ _sass/minimal-mistakes.scss | 3 ++ about.md | 6 +-- assets/js/custom-bibtex.js | 93 +++++++++++++++++++++++++++++++++++++ 6 files changed, 158 insertions(+), 6 deletions(-) create mode 100644 _sass/custom.scss create mode 100644 assets/js/custom-bibtex.js diff --git a/_config.yml b/_config.yml index 39d29a3b..b8683db5 100644 --- a/_config.yml +++ b/_config.yml @@ -267,6 +267,13 @@ defaults: related: true show_date: false + +# Footer +footer_scripts: + - /assets/js/main.min.js + - /assets/js/custom-bibtex.js + + scholar: style: acm-siggraph bibliography: _bibliography.bib diff --git a/_layouts/bibtemplate.html b/_layouts/bibtemplate.html index 88c62a91..f193cdd4 100644 --- a/_layouts/bibtemplate.html +++ b/_layouts/bibtemplate.html @@ -2,6 +2,34 @@ --- {{reference}} -{% if link %} -
-{% endif %} +
+ {% if link %} + + + + {% endif %} + + {% if entry and entry.bibtex %} + {% assign bibtex_filename = entry.key | default: "citation" | append: ".bib" %} + {% assign bibtex_json_data = entry.bibtex | jsonify %} + + + + + {% endif %} +
\ No newline at end of file diff --git a/_sass/custom.scss b/_sass/custom.scss new file mode 100644 index 00000000..9a78db7a --- /dev/null +++ b/_sass/custom.scss @@ -0,0 +1,21 @@ +/* ========================================================================== + My Custom Classes + ========================================================================== */ + + +.publication-actions { +} + +// Common styling for all publication action buttons if needed beyond .btn and .btnId +.btnPub--action { + + i.fas { // Style for Font Awesome icons within these buttons + margin-right: 0.4em; // Space between icon and text + } +} + +// Ensure buttons that become disabled have appropriate styling (often handled by themes) +button:disabled { + opacity: 0.65; + cursor: not-allowed; +} \ No newline at end of file diff --git a/_sass/minimal-mistakes.scss b/_sass/minimal-mistakes.scss index ba9d13d5..f1bb5c93 100644 --- a/_sass/minimal-mistakes.scss +++ b/_sass/minimal-mistakes.scss @@ -35,3 +35,6 @@ @import "minimal-mistakes/archive"; @import "minimal-mistakes/sidebar"; @import "minimal-mistakes/print"; + +/* My custom classes */ +@import "custom"; diff --git a/about.md b/about.md index 453e2ef7..cce432cb 100644 --- a/about.md +++ b/about.md @@ -8,10 +8,10 @@ permalink: "/about/"
-|![Profile Image](/assets/images/longshot.jpg){: style="margin:0em; padding:0em; width:10em"}| -| **Steffen Illium**
*AI Consultant & Data Scientist*| +|![Profile Image](/assets/images/newshot_2.jpg){: style="margin:0em; padding:0em; width:10em"}| +| **Steffen Illium**
*AI Consultant &
Data Scientist*| -[Grab my CV here](/assets/illium_cv_censored.pdf){: .btn .btn--success} +[Grab my CV here](/assets/illium_cv_censored.pdf){: .btn .btn--success data-umami-event="CV Download"}
My career has been driven by a passion for turning data into actionable insights. This journey began with a BSc in Geography from JGU Mainz and an MSc in Geo-Informatics from the University of Augsburg, culminating in a PhD in Computer Science (summa cum laude) from LMU Munich. During my doctoral studies and subsequent role as a research assistant at LMU (2018-2023), I focused on developing machine learning models for sequential data, advancing self-learning systems, and contributing to foundational research in neural network applications. diff --git a/assets/js/custom-bibtex.js b/assets/js/custom-bibtex.js new file mode 100644 index 00000000..ebd0fb4d --- /dev/null +++ b/assets/js/custom-bibtex.js @@ -0,0 +1,93 @@ +document.addEventListener('DOMContentLoaded', () => { + // --- Helper Functions --- + function downloadBibtex(bibtexContent, filename) { + if (!bibtexContent || !filename) { + console.error('BibTeX content or filename missing for download.'); + alert('Could not prepare BibTeX for download.'); + return; + } + try { + // Parse the JSON string to get the actual BibTeX content + const parsedBibtexContent = JSON.parse(bibtexContent); + const blob = new Blob([parsedBibtexContent], { type: 'application/x-bibtex;charset=utf-8' }); + const link = document.createElement('a'); + link.href = URL.createObjectURL(blob); + link.download = filename; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + URL.revokeObjectURL(link.href); + } catch (e) { + console.error('Error parsing BibTeX JSON from data attribute for download:', e); + alert('Could not prepare BibTeX for download. Invalid data format.'); + } + } + + function copyToClipboard(bibtexJsonContent, buttonElement) { + if (!bibtexJsonContent) { + console.error('No BibTeX JSON content provided to copy.'); + return; + } + try { + const textToCopy = JSON.parse(bibtexJsonContent); // Parse the JSON string + navigator.clipboard.writeText(textToCopy).then(() => { + if (buttonElement) { + const originalText = buttonElement.innerHTML; // Store full HTML content + buttonElement.innerHTML = ' Copied!'; + buttonElement.disabled = true; + setTimeout(() => { + buttonElement.innerHTML = originalText; + buttonElement.disabled = false; + }, 2000); + } + }).catch(err => { + console.error('Could not copy text: ', err); + alert('Failed to copy BibTeX. Ensure you are on a secure connection (HTTPS) or check browser permissions.'); + // Basic fallback (less likely to be needed for navigator.clipboard modern support) + try { + const textArea = document.createElement('textarea'); + textArea.value = textToCopy; + textArea.style.position = 'fixed'; // Avoid scrolling to bottom + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + document.execCommand('copy'); + document.body.removeChild(textArea); + if (buttonElement) { + const originalText = buttonElement.innerHTML; + buttonElement.innerHTML = ' Copied (fallback)!'; + buttonElement.disabled = true; + setTimeout(() => { + buttonElement.innerHTML = originalText; + buttonElement.disabled = false; + }, 2000); + } + } catch (fallbackErr) { + console.error('Fallback copy method failed:', fallbackErr); + } + }); + } catch (e) { + console.error('Error parsing BibTeX JSON from data attribute for copy:', e); + alert('Could not prepare BibTeX for copying. Invalid data format.'); + } + } + + // --- Event Listeners --- + + // For "BibTeX Download" buttons + document.querySelectorAll('.btnPub--bibtex-download-direct').forEach(button => { + button.addEventListener('click', function() { + const bibtexJson = this.dataset.bibtexJson; + const bibtexFilename = this.dataset.bibtexFilename; + downloadBibtex(bibtexJson, bibtexFilename); + }); + }); + + // For "Copy BibTeX" buttons + document.querySelectorAll('.btnPub--bibtex-copy-direct').forEach(button => { + button.addEventListener('click', function() { + const bibtexJson = this.dataset.bibtexJson; + copyToClipboard(bibtexJson, this); + }); + }); +}); \ No newline at end of file