dmencu 2.2.13 → 2.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,84 @@
1
1
  doctype html
2
2
  html(lang="en")
3
3
  head
4
- title Offline
4
+ meta(charset="utf-8")
5
+ meta(name="viewport", content="width=device-width, initial-scale=1.0")
6
+ title Sin Conexión
7
+ style.
8
+ body {
9
+ margin: 0;
10
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
11
+ background-color: #f3f4f6;
12
+ color: #111827;
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ min-height: 100vh;
17
+ }
18
+ .card {
19
+ background: #ffffff;
20
+ padding: 2rem;
21
+ border-radius: 8px;
22
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
23
+ text-align: center;
24
+ max-width: 360px;
25
+ width: 85%;
26
+ }
27
+ .spinner {
28
+ border: 3px solid #e5e7eb;
29
+ border-top: 3px solid #2563eb;
30
+ border-radius: 50%;
31
+ width: 24px;
32
+ height: 24px;
33
+ animation: spin 1s linear infinite;
34
+ margin: 0 auto 1.25rem auto;
35
+ }
36
+ @keyframes spin {
37
+ 0% { transform: rotate(0deg); }
38
+ 100% { transform: rotate(360deg); }
39
+ }
40
+ h1 {
41
+ font-size: 1.25rem;
42
+ font-weight: 600;
43
+ margin: 0 0 0.5rem 0;
44
+ }
45
+ p {
46
+ font-size: 0.9rem;
47
+ color: #4b5563;
48
+ margin: 0;
49
+ }
5
50
  script.
6
- // Función para forzar la carga limpia de la SPA desde la caché
7
- function redirigirACampo() {
8
- // Reemplazamos el historial para asegurarnos de apuntar limpiamente a la entrada
9
- // Esto evita que arrastre hashes viejos o subrutas que rompan el inicio offline
10
- var urlCampo = window.location.origin + window.location.pathname.replace(/\\/[^\\/]*$/, '') + '/campo';
11
-
12
- history.replaceState(null, '', urlCampo);
13
- // Forzamos la recarga. El Service Worker ahora recibirá la petición limpia de '/campo'
14
- // y servirá el recurso correcto desde la caché, levantando la SPA.
15
- window.location.reload();
51
+ var segundos = 3;
52
+
53
+ function redirigir() {
54
+ try {
55
+ var currentUrl = new URL(window.location.href);
56
+ var pathParts = currentUrl.pathname.split('/');
57
+ pathParts.pop();
58
+ pathParts.push('campo');
59
+
60
+ history.replaceState(null, '', currentUrl.origin + pathParts.join('/'));
61
+ window.location.reload();
62
+ } catch (e) {
63
+ history.replaceState(null, '', '/campo');
64
+ window.location.reload();
65
+ }
66
+ }
67
+
68
+ function countdown() {
69
+ var el = document.getElementById('segundos');
70
+ if (el) el.textContent = segundos;
71
+ if (segundos <= 0) {
72
+ redirigir();
73
+ } else {
74
+ segundos--;
75
+ setTimeout(countdown, 1000);
76
+ }
16
77
  }
17
78
 
18
- // Opcional: Si querés que sea automático apenas se queden offline,
19
- // descomentá la siguiente línea:
20
- window.addEventListener('load', redirigirACampo);
79
+ window.addEventListener('load', countdown);
21
80
  body
22
- div#offline
23
- h1 No hay conexión de internet
24
- p Verifique su conexión de internet y vuelva a intentarlo
25
- // Al hacer clic, ejecutamos la lógica de redirección forzada por JS
26
- a(href="javascript:void(0)", onclick="redirigirACampo()") Volver a hoja de ruta
81
+ .card
82
+ .spinner
83
+ h1 No hay conexión a internet
84
+ p Volviendo a hoja de ruta en #[span#segundos 3] segundos...
@@ -1,26 +1,84 @@
1
1
  doctype html
2
2
  html(lang="en")
3
3
  head
4
- title Offline
4
+ meta(charset="utf-8")
5
+ meta(name="viewport", content="width=device-width, initial-scale=1.0")
6
+ title Sin Conexión
7
+ style.
8
+ body {
9
+ margin: 0;
10
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
11
+ background-color: #f3f4f6;
12
+ color: #111827;
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ min-height: 100vh;
17
+ }
18
+ .card {
19
+ background: #ffffff;
20
+ padding: 2rem;
21
+ border-radius: 8px;
22
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
23
+ text-align: center;
24
+ max-width: 360px;
25
+ width: 85%;
26
+ }
27
+ .spinner {
28
+ border: 3px solid #e5e7eb;
29
+ border-top: 3px solid #2563eb;
30
+ border-radius: 50%;
31
+ width: 24px;
32
+ height: 24px;
33
+ animation: spin 1s linear infinite;
34
+ margin: 0 auto 1.25rem auto;
35
+ }
36
+ @keyframes spin {
37
+ 0% { transform: rotate(0deg); }
38
+ 100% { transform: rotate(360deg); }
39
+ }
40
+ h1 {
41
+ font-size: 1.25rem;
42
+ font-weight: 600;
43
+ margin: 0 0 0.5rem 0;
44
+ }
45
+ p {
46
+ font-size: 0.9rem;
47
+ color: #4b5563;
48
+ margin: 0;
49
+ }
5
50
  script.
6
- // Función para forzar la carga limpia de la SPA desde la caché
7
- function redirigirACampo() {
8
- // Reemplazamos el historial para asegurarnos de apuntar limpiamente a la entrada
9
- // Esto evita que arrastre hashes viejos o subrutas que rompan el inicio offline
10
- var urlCampo = window.location.origin + window.location.pathname.replace(/\\/[^\\/]*$/, '') + '/campo';
11
-
12
- history.replaceState(null, '', urlCampo);
13
- // Forzamos la recarga. El Service Worker ahora recibirá la petición limpia de '/campo'
14
- // y servirá el recurso correcto desde la caché, levantando la SPA.
15
- window.location.reload();
51
+ var segundos = 3;
52
+
53
+ function redirigir() {
54
+ try {
55
+ var currentUrl = new URL(window.location.href);
56
+ var pathParts = currentUrl.pathname.split('/');
57
+ pathParts.pop();
58
+ pathParts.push('campo');
59
+
60
+ history.replaceState(null, '', currentUrl.origin + pathParts.join('/'));
61
+ window.location.reload();
62
+ } catch (e) {
63
+ history.replaceState(null, '', '/campo');
64
+ window.location.reload();
65
+ }
66
+ }
67
+
68
+ function countdown() {
69
+ var el = document.getElementById('segundos');
70
+ if (el) el.textContent = segundos;
71
+ if (segundos <= 0) {
72
+ redirigir();
73
+ } else {
74
+ segundos--;
75
+ setTimeout(countdown, 1000);
76
+ }
16
77
  }
17
78
 
18
- // Opcional: Si querés que sea automático apenas se queden offline,
19
- // descomentá la siguiente línea:
20
- window.addEventListener('load', redirigirACampo);
79
+ window.addEventListener('load', countdown);
21
80
  body
22
- div#offline
23
- h1 No hay conexión de internet
24
- p Verifique su conexión de internet y vuelva a intentarlo
25
- // Al hacer clic, ejecutamos la lógica de redirección forzada por JS
26
- a(href="javascript:void(0)", onclick="redirigirACampo()") Volver a hoja de ruta
81
+ .card
82
+ .spinner
83
+ h1 No hay conexión a internet
84
+ p Volviendo a hoja de ruta en #[span#segundos 3] segundos...
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dmencu",
3
3
  "description": "DM Encu - Encuestas en dispositivo móvil",
4
- "version": "2.2.13",
4
+ "version": "2.2.14",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "main": "dist/server/server/app-dmencu.js",