mirror of
				https://forge.chapril.org/tykayn/orgmode-to-gemini-blog
				synced 2025-10-09 17:02:45 +02:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
		
			No EOL
		
	
	
		
			751 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			No EOL
		
	
	
		
			751 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| // search bar to send a request to a search engine for the current domain when sent
 | |
| document.addEventListener('DOMContentLoaded', function() {
 | |
|     // Obtient le nom de domaine de la page courante
 | |
|     const currentDomain = window.location.hostname;
 | |
|     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)}`;
 | |
| 
 | |
|         window.location.href = url;
 | |
|     });
 | |
| }); | 
