PageSourceSearch

https://rondoniaovivo.com/js/pwa-install.js?id=e425debadf1ad665c726bb7b40f6f67e

js rondoniaovivo.com collected 2026-09-24 18:43:33 UTC 2,911 bytes, 118 lines download raw bytes

1// ===============================
2// ACodex PRO FINAL
3// ===============================
4
5window.deferredPrompt = null;
6
7function getHojeLocal() {
8    let d = new Date();
9    let dia = String(d.getDate()).padStart(2, '0');
10    let mes = String(d.getMonth() + 1).padStart(2, '0');
11    let ano = d.getFullYear();
12    return `${ano}-${mes}-${dia}`;
13}
14
15function setCookie(nome, valor, dias) {
16    let d = new Date();
17    d.setTime(d.getTime() + (dias * 24 * 60 * 60 * 1000));
18    let expires = "expires=" + d.toUTCString();
19    document.cookie = nome + "=" + valor + ";" + expires + ";path=/";
20}
21
22function getCookie(nome) {
23    let name = nome + "=";
24    let ca = document.cookie.split(';');
25    for (let i = 0; i < ca.length; i++) {
26        let c = ca[i].trim();
27        if (c.indexOf(name) === 0) {
28            return c.substring(name.length, c.length);
29        }
30    }
31    return null;
32}
33
34function podeExibirBanner() {
35
36    if (window.matchMedia('(display-mode: standalone)').matches) return false;
37    if (window.navigator.standalone === true) return false;
38
39    let hoje = getHojeLocal();
40    let ultimaExibicao = localStorage.getItem('pwaLastShown');
41
42    if (ultimaExibicao === hoje) return false;
43
44    let cookieExibido = getCookie('pwaShown');
45    if (cookieExibido === '1') return false;
46
47    let recusadoEm = localStorage.getItem('pwaDismissedAt');
48
49    if (recusadoEm) {
50        let dias = (Date.now() - recusadoEm) / (1000 * 60 * 60 * 24);
51        if (dias < 7) return false;
52    }
53
54    return true;
55}
56
57function mostrarBanner() {
58
59    if (!podeExibirBanner()) return;
60
61    if (!window.deferredPrompt) return;
62
63    $("#pwaInstallBox").removeClass("d-none").hide().fadeIn();
64
65    let hoje = getHojeLocal();
66
67    localStorage.setItem('pwaLastShown', hoje);
68
69    setCookie('pwaShown', '1', 1);
70
71    $.post('/event/', { evento: 'mostrar_instalacao' });
72}
73
74$(document).ready(function () {
75
76    window.addEventListener('beforeinstallprompt', function (e) {
77        e.preventDefault();
78        window.deferredPrompt = e;
79
80        if (podeExibirBanner()) {
81            setTimeout(() => {
82                mostrarBanner();
83            }, 5000);
84        }
85    });
86
87    $("#btnInstalar").click(async function () {
88
89        if (!window.deferredPrompt) return;
90
91        $.post('/event/', { evento: 'clicou_instalar' });
92
93        window.deferredPrompt.prompt();
94
95        const choice = await window.deferredPrompt.userChoice;
96
97        if (choice.outcome === 'accepted') {
98
99            $.post('/event/', { evento: 'instalado' });
100
101        } else {
102
103            localStorage.setItem('pwaDismissedAt', Date.now());
104
105            $.post('/event/', { evento: 'recusado' });
106        }
107
108        window.deferredPrompt = null;
109
110        $("#pwaInstallBox").fadeOut();
111    });
112
113    $("#btnFechar").click(function () {
114        localStorage.setItem('pwaDismissedAt', Date.now());
115        $("#pwaInstallBox").fadeOut();
116    });
117
118});

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.