* Remove unused font-face definitions from stylesheets The `fonts.scss` file defining `Assistant` font-face rules has been deleted as it was no longer in use. This cleanup reduces unnecessary assets and improves maintainability. * Fix npm script command in blog preview workflow Replaced `npm scss:build` with the correct `npm run scss:build` command in the GitHub Actions workflow. This ensures the SCSS build step executes properly during site generation. * Update blog preview workflow to use mkdocs gh-deploy Replaces the GitHub Pages action with `mkdocs gh-deploy` for deploying previews. Simplifies the workflow configuration and reduces dependencies. * Update `site_url` logic and fix URL format consistency Simplified the `site_url` handling in the workflow by removing branch-specific URL construction. Additionally, ensured the main URL in `mkdocs.yml` uses a consistent trailing slash. This enhances clarity and maintains uniformity in URL formatting. * Set `use_directory_urls` in mkdocs.yml directly. Removed redundant script lines for configuring `use_directory_urls` in the workflow file. This simplifies deployment logic by directly defining the configuration in the mkdocs.yml file. * Remove unnecessary CSS source map file Deleted `custom.css.map` as it is not required for production. Removing it helps reduce clutter and keeps the repository clean. * Add support for 'satware.ai' as a homepage path Updated body-classes.js to treat 'satware.ai' as a homepage path by adding the 'home' class to the body element. This ensures correct behavior for both empty paths and specific developer GitHub Pages. * Simplify FAQ and navigation structure. Renamed `faq.md` to `index.md` for consistency and updated navigation links in `mkdocs.yml` to use folder paths directly. Adjusted `main.html` to clean up formatting with additional line breaks. * Update footer links to use relative paths Replaced absolute paths with relative paths for internal footer links to ensure consistency and improve maintainability. External links remain unchanged. * Fix relative URL for Jane Alesi's team page in authors file Updated the URL path for Jane Alesi to ensure correct navigation to her team page. This fixes a broken link caused by an incorrect relative URL. * Update footer links and enhance blog post on website relaunch Updated footer links to utilize dynamic `config.site_url` for consistent URL routing. Enhanced the blog post for better readability, showcasing the MkDocs implementation, GitHub integration, and use of Mermaid diagrams. * Update footer link and simplify satWay documentation Replaced the "Blog" link in the footer with "satWay Prinzipien" and refined the satWay documentation by removing overly detailed content about Jane Alesi. Additionally, added the Blog section to the site navigation in `mkdocs.yml`.
83 lines
3.2 KiB
JavaScript
83 lines
3.2 KiB
JavaScript
document.addEventListener('DOMContentLoaded', function() {
|
|
// Funktion zum Formatieren der Zahlen mit Kommas und Plus-Zeichen
|
|
function formatNumber(num, includePlus = true) {
|
|
const formatted = num.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
|
|
return includePlus ? formatted + '+' : formatted;
|
|
}
|
|
|
|
// Funktion zum Extrahieren der Zahl aus dem Text (entfernt das '+' und Kommas)
|
|
function extractNumber(text) {
|
|
return parseInt(text.replace(/,/g, '').replace('+', ''), 10);
|
|
}
|
|
|
|
// Funktion zum Animieren der Zähler
|
|
function animateCounter(counterElement, target) {
|
|
// Startpunkt
|
|
let start = 0;
|
|
// Dauer der Animation in Millisekunden (angepasst an die Größe der Zahl)
|
|
const duration = Math.min(2000 + Math.log10(target) * 300, 3000);
|
|
// Zeitpunkt des Starts
|
|
const startTime = performance.now();
|
|
|
|
// Funktion für die Animation
|
|
function updateCounter(currentTime) {
|
|
// Berechne den verstrichenen Zeitanteil (0 bis 1)
|
|
const elapsedTime = Math.min((currentTime - startTime) / duration, 1);
|
|
|
|
// Easing-Funktion für eine natürlichere Animation
|
|
const progress = easeOutQuart(elapsedTime);
|
|
|
|
// Berechne den aktuellen Wert
|
|
const currentValue = Math.floor(progress * target);
|
|
|
|
// Aktualisiere den Zähler mit dem Plus-Zeichen
|
|
counterElement.textContent = formatNumber(currentValue, true);
|
|
|
|
// Wenn die Animation noch nicht abgeschlossen ist, nächsten Frame anfordern
|
|
if (elapsedTime < 1) {
|
|
requestAnimationFrame(updateCounter);
|
|
} else {
|
|
// Stelle sicher, dass der endgültige Wert exakt dem Zielwert entspricht
|
|
counterElement.textContent = formatNumber(target, true);
|
|
}
|
|
}
|
|
|
|
// Easing-Funktion für eine natürlichere Animation
|
|
function easeOutQuart(t) {
|
|
return 1 - Math.pow(1 - t, 4);
|
|
}
|
|
|
|
// Starte die Animation
|
|
requestAnimationFrame(updateCounter);
|
|
}
|
|
|
|
// Intersection Observer zum Erkennen, wann die Zähler sichtbar werden
|
|
const observer = new IntersectionObserver((entries, observer) => {
|
|
entries.forEach(entry => {
|
|
// Wenn der Zähler sichtbar wird
|
|
if (entry.isIntersecting) {
|
|
const counterElement = entry.target;
|
|
// Extrahiere die Zielnummer aus dem Text
|
|
const targetText = counterElement.textContent;
|
|
const target = extractNumber(targetText);
|
|
|
|
// Setze den Anfangswert auf 0 mit Plus-Zeichen
|
|
counterElement.textContent = '0+';
|
|
|
|
// Starte die Animation
|
|
animateCounter(counterElement, target);
|
|
|
|
// Beobachtung beenden, damit die Animation nur einmal ausgeführt wird
|
|
observer.unobserve(counterElement);
|
|
}
|
|
});
|
|
}, {
|
|
threshold: 0.1 // 10% des Elements müssen sichtbar sein
|
|
});
|
|
|
|
// Alle Zähler beobachten
|
|
document.querySelectorAll('.satag--home-counter-number').forEach(counter => {
|
|
observer.observe(counter);
|
|
});
|
|
});
|