mirror of
https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
synced 2025-10-09 17:02:45 +02:00
add theme mastodon
This commit is contained in:
parent
8abe2f6aad
commit
e3d64d4e76
6 changed files with 415 additions and 24 deletions
|
@ -5,29 +5,36 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
const form = document.getElementById('recherche');
|
||||
|
||||
// Ajoute un écouteur d'événement pour l'événement 'submit'
|
||||
form.addEventListener('submit', function (event) {
|
||||
// Empêche le comportement par défaut du formulaire
|
||||
event.preventDefault()
|
||||
const query = document.getElementById('query').value
|
||||
const url = `https://duckduckgo.com/?q=${encodeURIComponent(query)}+site%3A${encodeURIComponent(currentDomain)}`;
|
||||
if (form) {
|
||||
form.addEventListener('submit', function (event) {
|
||||
// Empêche le comportement par défaut du formulaire
|
||||
event.preventDefault()
|
||||
const input = form.querySelector('.search-field');
|
||||
const query = input ? input.value : '';
|
||||
const url = `https://duckduckgo.com/?q=${encodeURIComponent(query)}+site%3A${encodeURIComponent(currentDomain)}`;
|
||||
|
||||
window.location.href = url;
|
||||
});
|
||||
window.location.href = url;
|
||||
});
|
||||
}
|
||||
|
||||
// navigation au clavier
|
||||
// Sélectionnez le lien à cliquer
|
||||
const nextArticleLink = document.querySelector('a.next-article');
|
||||
const previousArticleLink = document.querySelector('a.previous-article');
|
||||
|
||||
// Ajoutez un événement de clic au lien
|
||||
nextArticleLink.addEventListener('click', function () {
|
||||
// Redirigez l'utilisateur vers la page suivante
|
||||
window.location.href = nextArticleLink.href;
|
||||
});
|
||||
previousArticleLink.addEventListener('click', function () {
|
||||
// Redirigez l'utilisateur vers la page suivante
|
||||
window.location.href = nextArticleLink.href;
|
||||
});
|
||||
// Ajoutez un événement de clic au lien si présents
|
||||
if (nextArticleLink) {
|
||||
nextArticleLink.addEventListener('click', function () {
|
||||
// Redirigez l'utilisateur vers la page suivante
|
||||
window.location.href = nextArticleLink.href;
|
||||
});
|
||||
}
|
||||
if (previousArticleLink) {
|
||||
previousArticleLink.addEventListener('click', function () {
|
||||
// Redirigez l'utilisateur vers la page précédente
|
||||
window.location.href = previousArticleLink.href;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -39,14 +46,14 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
event.preventDefault();
|
||||
|
||||
// Cliquez sur le lien
|
||||
nextArticleLink.click();
|
||||
if (nextArticleLink) nextArticleLink.click();
|
||||
}
|
||||
if (event.key === 'p' || event.key === 'ArrowLeft') {
|
||||
// Empêche le comportement par défaut de la touche
|
||||
event.preventDefault();
|
||||
|
||||
// Cliquez sur le lien
|
||||
previousArticleLink.click();
|
||||
if (previousArticleLink) previousArticleLink.click();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -60,8 +67,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
boutonTheme.textContent = 'Changer de thème';
|
||||
boutonTheme.id = 'theme-switcher';
|
||||
document.body.appendChild(boutonTheme);
|
||||
|
||||
addEventListener('click', onClickThemeButton)
|
||||
console.log('boutonTheme', boutonTheme);
|
||||
console.log('themes_calsses', themes_calsses);
|
||||
boutonTheme.addEventListener('click', onClickThemeButton)
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,4 +92,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||
}
|
||||
|
||||
|
||||
// créer le bouton thème au chargement
|
||||
makeThemesButton();
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue