PageSourceSearch

https://andina.pe/agencia/js/qr-modal.js?v=20260506

js andina.pe collected 2026-10-01 09:02:37 UTC 3,386 bytes, 84 lines download raw bytes

1// ============================================================================
2// qr-modal.js
3// Lógica del modal QR (App Store / Google Play) y limpieza de href="#" vacíos.
4// Compartido por los master pages que renderizan ucSeccion.ascx
5// (mpInicio, mpHome, Clean, Especiales, mpAndinaWide).
6// Requiere jQuery (cargado antes que este archivo).
7// ============================================================================
8
9$(document).ready(function () {
10
11    // ------------------------------------------------------------------------
12    // Evita que <a href="#"> ensucie la URL con un "#" vacío al hacer clic.
13    // Aplica a triggers de Materialize/Bootstrap (button-collapse,
14    // dropdown-button, collapsible-header, íconos sociales placeholder…)
15    // que existen como pivots de JS, no para navegar. Solo cancela el
16    // default del navegador; los handlers existentes siguen ejecutándose.
17    // ------------------------------------------------------------------------
18    $(document).on('click', 'a[href="#"]', function (e) {
19        e.preventDefault();
20    });
21
22    // ------------------------------------------------------------------------
23    // Modal QR (App Store / Google Play) — implementación standalone.
24    // No usa $.fn.modal (ni de Bootstrap ni de Materialize) para no chocar
25    // con otras llamadas a .modal() del header o sección. Se controla solo
26    // con jQuery vanilla: mostrar/ocultar el <div> con fadeIn/fadeOut y
27    // forzar el z-index correcto en línea.
28    // Eventos namespaced (.qrmodal) para evitar colisiones.
29    // ------------------------------------------------------------------------
30
31    var $modalAppStore   = $('#modal-app-store');
32    var $modalGooglePlay = $('#modal-google-play');
33    var $overlays        = $('.modal-overlay');
34
35    function cerrarTodos() {
36        $modalAppStore.stop(true, true).fadeOut(150);
37        $modalGooglePlay.stop(true, true).fadeOut(150);
38        $overlays.stop(true, true).fadeOut(150);
39    }
40
41    function abrir($modal) {
42        // Oculta el otro y el overlay sin animación, luego muestra el deseado
43        $modalAppStore.stop(true, true).hide();
44        $modalGooglePlay.stop(true, true).hide();
45        $modal.css({ top: '10%', zIndex: 1003, opacity: 1 }).fadeIn(150);
46        $overlays.stop(true, true).fadeIn(150);
47    }
48
49    // Triggers (botones de App Store / Google Play en ucSeccion)
50    $(document).on('click.qrmodal', '.btn-modal-appstore', function (e) {
51        e.preventDefault();
52        e.stopPropagation();
53        abrir($modalAppStore);
54    });
55
56    $(document).on('click.qrmodal', '.btn-modal-googleplay', function (e) {
57        e.preventDefault();
58        e.stopPropagation();
59        abrir($modalGooglePlay);
60    });
61
62    // Cerrar — botón "SALIR" dentro de cada modal
63    $(document).on('click.qrmodal',
64        '#close-modal-app-store, #close-modal-google-play',
65        function (e) {
66            e.preventDefault();
67            e.stopPropagation();
68            cerrarTodos();
69        }
70    );
71
72    // Cerrar — clic en el overlay (zona oscura fuera del modal)
73    $(document).on('click.qrmodal', '.modal-overlay', function () {
74        cerrarTodos();
75    });
76
77    // Cerrar — tecla ESC
78    $(document).on('keydown.qrmodal', function (e) {
79        if (e.key === 'Escape' || e.keyCode === 27) {
80            cerrarTodos();
81        }
82    });
83
84});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.