Files
agent0_homepage/docs/assets/js/faq.js
T
mwandGitHub 9fbea33697 Blog/2025 05 20 test blog post (#51)
* 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`.
2025-05-20 15:27:23 +02:00

95 lines
3.7 KiB
JavaScript

// Funktion zur Initialisierung der FAQ-Funktionalität
function initFAQ() {
// Finde alle FAQ-Fragen
const faqQuestions = document.querySelectorAll('.custom-faq-question');
if (faqQuestions.length === 0) {
console.log('Keine benutzerdefinierten FAQ-Elemente gefunden');
return;
}
console.log('Benutzerdefinierte FAQ-Elemente gefunden:', faqQuestions.length);
// Entferne zuerst alle bestehenden Event-Listener, um Duplikate zu vermeiden
faqQuestions.forEach(question => {
// Klonen des Elements, um alle Event-Listener zu entfernen
const newQuestion = question.cloneNode(true);
question.parentNode.replaceChild(newQuestion, question);
});
// Hole die aktualisierten Elemente nach dem Klonen
const updatedFaqQuestions = document.querySelectorAll('.custom-faq-question');
// Füge Event-Listener zu jeder Frage hinzu
updatedFaqQuestions.forEach(question => {
question.addEventListener('click', function() {
// Toggle active class auf der Frage
this.classList.toggle('active');
// Toggle active class auf der Antwort
const answer = this.nextElementSibling;
answer.classList.toggle('active');
// Wenn diese Frage geöffnet wurde, schließe alle anderen
if (this.classList.contains('active')) {
updatedFaqQuestions.forEach(otherQuestion => {
if (otherQuestion !== this && otherQuestion.classList.contains('active')) {
otherQuestion.classList.remove('active');
otherQuestion.nextElementSibling.classList.remove('active');
}
});
}
});
});
console.log('Benutzerdefinierte FAQ-Funktionalität initialisiert');
}
// Führe die Initialisierung beim ersten Laden der Seite aus
document.addEventListener('DOMContentLoaded', initFAQ);
// Führe die Initialisierung aus, wenn der Inhalt der Seite durch MkDocs aktualisiert wird
document.addEventListener('DOMContentSwap', initFAQ);
// Führe die Initialisierung aus, wenn die Seite über den Material for MkDocs-Router aktualisiert wird
document.addEventListener('mdContentChanged', initFAQ);
// Führe die Initialisierung aus, wenn der Inhalt der Seite durch andere Frameworks aktualisiert wird
// MutationObserver, um Änderungen im DOM zu überwachen
const observer = new MutationObserver((mutations) => {
mutations.forEach((mutation) => {
if (mutation.addedNodes && mutation.addedNodes.length > 0) {
// Prüfe, ob FAQ-Elemente hinzugefügt wurden
for (let i = 0; i < mutation.addedNodes.length; i++) {
const node = mutation.addedNodes[i];
if (node.nodeType === 1 && (node.classList?.contains('custom-faq-item') ||
node.querySelector?.('.custom-faq-item'))) {
// FAQ-Elemente gefunden, initialisiere die Funktionalität
setTimeout(initFAQ, 100); // Kurze Verzögerung, um sicherzustellen, dass alles geladen ist
break;
}
}
}
});
});
// Starte die Beobachtung des Dokuments
observer.observe(document.body, {
childList: true,
subtree: true
});
// Zusätzlicher Event-Listener für dynamisch geladene Inhalte
window.addEventListener('load', function() {
// Verzögerte Initialisierung, um sicherzustellen, dass alle Inhalte geladen sind
setTimeout(initFAQ, 500);
});
// Für Material for MkDocs spezifische Ereignisse
if (typeof document$.subscribe === 'function') {
document$.subscribe(function() {
// Verzögerte Initialisierung, um sicherzustellen, dass alle Inhalte geladen sind
setTimeout(initFAQ, 100);
});
}