enhance reference interactions

This commit is contained in:
Steffen Illium 2025-05-20 11:47:23 +02:00
parent e05d811a1e
commit 57d061e0f5
6 changed files with 158 additions and 6 deletions

View File

@ -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

View File

@ -2,6 +2,34 @@
---
{{reference}}
<div class="publication-actions" style="margin-top: 0.5em;">
{% if link %}
<br><a href="{{link}}"><button class="btn btnId btnPub--download" style="outline:none; position:relative;white-space: normal;">PDF</button></a>
<a href="{{ link }}" style="text-decoration: none;">
<button class="btn btnId btnPub--action btnPub--pdf-download"
data-umami-event="PDF Download - {{ entry.key | default: 'ref' }} - {{ page.slug | default: 'unknown-page' }}"
style="outline:none; position:relative; white-space: normal; margin-right: 5px; vertical-align: middle;">
<i class="fas fa-download"></i> PDF
</button>
</a>
{% endif %}
{% if entry and entry.bibtex %}
{% assign bibtex_filename = entry.key | default: "citation" | append: ".bib" %}
{% assign bibtex_json_data = entry.bibtex | jsonify %}
<button type="button" class="btn btnId btnPub--action btnPub--bibtex-download-direct"
data-umami-event="BibTeX File Download - {{ entry.key | default: 'ref' }} - {{ page.slug | default: 'unknown-page' }}"
data-bibtex-json='{{ bibtex_json_data }}'
data-bibtex-filename='{{ bibtex_filename }}'
style="outline:none; position:relative; white-space: normal; margin-right: 5px; vertical-align: middle;">
<i class="fas fa-download"></i> BibTeX
</button>
<button type="button" class="btn btnId btnPub--action btnPub--bibtex-copy-direct"
data-umami-event="BibTeX Copy - {{ entry.key | default: 'ref' }} - {{ page.slug | default: 'unknown-page' }}"
data-bibtex-json='{{ bibtex_json_data }}'
style="outline:none; position:relative; white-space: normal; vertical-align: middle;">
<i class="fas fa-clipboard"></i> Copy
</button>
{% endif %}
</div>

21
_sass/custom.scss Normal file
View File

@ -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;
}

View File

@ -35,3 +35,6 @@
@import "minimal-mistakes/archive";
@import "minimal-mistakes/sidebar";
@import "minimal-mistakes/print";
/* My custom classes */
@import "custom";

View File

@ -8,10 +8,10 @@ permalink: "/about/"
<div style="text-align: center;border-collapse: collapse; border: none;" class="table-right">
|![Profile Image](/assets/images/longshot.jpg){: style="margin:0em; padding:0em; width:10em"}|
| **Steffen Illium**<br>*AI Consultant & Data Scientist*|
|![Profile Image](/assets/images/newshot_2.jpg){: style="margin:0em; padding:0em; width:10em"}|
| **Steffen Illium**<br>*AI Consultant &<br>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"}
</div>
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.

View File

@ -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 = '<i class="fas fa-check"></i> 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 = '<i class="fas fa-check"></i> 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);
});
});
});