mejora de la semantica
This commit is contained in:
parent
d508dc2058
commit
cb8f69fb93
10 changed files with 191 additions and 227 deletions
|
|
@ -18,7 +18,13 @@
|
|||
<div class="filter-main-row">
|
||||
<div class="filter-search-box">
|
||||
<label for="q">Buscar por palabra clave</label>
|
||||
<input type="search" name="q" id="q" placeholder="Ej: Trump, California, IA..." value="{{ q or '' }}">
|
||||
<input
|
||||
type="search"
|
||||
name="q"
|
||||
id="q"
|
||||
placeholder="Ej: Trump, California, guerra en el mar Rojo..."
|
||||
value="{{ q or '' }}"
|
||||
>
|
||||
</div>
|
||||
|
||||
<div class="filter-actions">
|
||||
|
|
@ -51,7 +57,11 @@
|
|||
<select name="pais_id" id="pais_id">
|
||||
<option value="">— Todos —</option>
|
||||
{% for pais in paises %}
|
||||
<option value="{{ pais.id }}" data-continente-id="{{ pais.continente_id }}" {% if pais_id == pais.id %}selected{% endif %}>
|
||||
<option
|
||||
value="{{ pais.id }}"
|
||||
data-continente-id="{{ pais.continente_id }}"
|
||||
{% if pais_id == pais.id %}selected{% endif %}
|
||||
>
|
||||
{{ pais.nombre }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
|
|
@ -135,17 +145,14 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
const newUrl = `${form.action}?${params.toString()}`;
|
||||
|
||||
await cargarNoticiasFromURL(newUrl);
|
||||
// Actualizar historial
|
||||
window.history.pushState({ path: newUrl }, '', newUrl);
|
||||
}
|
||||
|
||||
// Submit manual
|
||||
form.addEventListener('submit', function(e) {
|
||||
e.preventDefault();
|
||||
cargarNoticias(false);
|
||||
});
|
||||
|
||||
// Toggle traducción/original
|
||||
const toggleOrig = document.getElementById('toggle-orig');
|
||||
const toggleTr = document.getElementById('toggle-tr');
|
||||
|
||||
|
|
@ -165,7 +172,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
});
|
||||
}
|
||||
|
||||
// Cambios en selects/fecha -> recarga automática
|
||||
continenteSelect.addEventListener('change', function() {
|
||||
filtrarPaises();
|
||||
cargarNoticias(false);
|
||||
|
|
@ -180,7 +186,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
cargarNoticias(false);
|
||||
});
|
||||
|
||||
// Debounce búsqueda
|
||||
let qTimer = null;
|
||||
qInput.addEventListener('input', function() {
|
||||
if (qTimer) clearTimeout(qTimer);
|
||||
|
|
@ -189,10 +194,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
}, 450);
|
||||
});
|
||||
|
||||
// Cargar países al inicio
|
||||
filtrarPaises();
|
||||
|
||||
// Soporte de navegación del historial
|
||||
window.addEventListener('popstate', function(e) {
|
||||
const url = (e.state && e.state.path) ? e.state.path : window.location.href;
|
||||
cargarNoticiasFromURL(url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue