-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
100 lines (90 loc) · 3.59 KB
/
script.js
File metadata and controls
100 lines (90 loc) · 3.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
document.addEventListener('DOMContentLoaded', function() {
// Definir los directorios y su información
const directories = [
{
id: 'n8n-funcionesdot',
title: 'Métodos de Transformación de Datos',
description: 'Documentación de funciones integradas para transformar datos en n8n',
icon: 'fa-code'
},
{
id: 'n8n-objetos-raiz',
title: 'Objetos Raíz',
description: 'Información sobre los objetos raíz disponibles en n8n',
icon: 'fa-object-group'
},
{
id: 'n8n-operadores-logicos',
title: 'Operadores Lógicos',
description: 'Documentación sobre operadores lógicos en n8n',
icon: 'fa-code-branch'
},
{
id: 'n8n-tipos-especiales',
title: 'Tipos Especiales',
description: 'Información sobre tipos de datos especiales en n8n',
icon: 'fa-star'
}
];
// Obtener el contenedor del menú
const menuContainer = document.getElementById('directoriesMenu');
// Generar elementos del menú dinámicamente
directories.forEach(dir => {
const menuItem = document.createElement('div');
menuItem.className = 'menu-item';
menuItem.innerHTML = `
<i class="fas ${dir.icon} menu-icon"></i>
<h3 class="menu-title">${dir.title}</h3>
<p class="menu-description">${dir.description}</p>
`;
// Agregar evento para navegar al directorio al hacer clic
menuItem.addEventListener('click', function() {
window.location.href = `${dir.id}/index.html`;
});
menuContainer.appendChild(menuItem);
});
// Agregar botón "Volver al menú principal" a todas las páginas index.html de los subdirectorios
if (!window.location.pathname.endsWith('index.html') && !window.location.pathname.endsWith('/')) {
// Estamos en una página de subdirectorio
addReturnButton();
}
});
// Función para agregar el botón de regreso al menú principal en cada subdirectorio
function addReturnButton() {
// Verificar si ya existe un botón de retorno
if (document.querySelector('.return-btn')) return;
// Crear el botón de retorno
const header = document.querySelector('header');
if (header) {
const returnBtn = document.createElement('div');
returnBtn.className = 'return-btn';
returnBtn.innerHTML = '<i class="fas fa-home"></i> Volver al menú principal';
returnBtn.addEventListener('click', function() {
window.location.href = '../index.html';
});
header.appendChild(returnBtn);
// Agregar estilos para el botón
const style = document.createElement('style');
style.textContent = `
.return-btn {
position: fixed;
top: 20px;
right: 20px;
background-color: var(--primary-color);
color: white;
padding: 10px 15px;
border-radius: var(--border-radius);
cursor: pointer;
z-index: 100;
box-shadow: var(--shadow);
display: flex;
align-items: center;
gap: 8px;
}
.return-btn:hover {
background-color: var(--secondary-color);
}
`;
document.head.appendChild(style);
}
}