PageSourceSearch

https://asset.kompas.com/kgnotif/unregissw.js

js kompas.com collected 2026-09-27 20:54:39 UTC 1,860 bytes, 54 lines download raw bytes

1var domain = window.location.hostname;
2
3if(Notification.permission == "granted"  && document.cookie.indexOf('KgnotifDuplicateSwSuccess2=') == -1){
4
5    if(document.cookie.indexOf('KgnotifDuplicateSw=') != -1)
6    {
7        cookie_value = getCookieNotifDpt('KgnotifDuplicateSw');
8
9        if(cookie_value != domain)
10        {
11            // get all service workers registered
12            navigator.serviceWorker.getRegistrations().then(function(registrations){
13
14                // loop all service workers
15                for(let registration of registrations) {
16
17                    // find service worker selected
18                    if(registration.scope == 'https://'+domain+'/firebase-cloud-messaging-push-scope');
19                    {
20                        console.log('unregister selected service worker by scope / url / domain')
21                        registration.unregister();
22                        setCookieNotifDpt("KgnotifDuplicateSwSuccess2", 1, 1, domain);
23                    }
24                }
25            })
26        }
27    }
28    else
29    {
30        setCookieNotifDpt("KgnotifDuplicateSw", domain, 3650);
31    }
32}
33
34function setCookieNotifDpt(cname, cvalue, exdays, domain='.kompas.com') {
35    var d = new Date();
36    d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
37    var expires = "expires=" + d.toUTCString();
38    document.cookie = cname + "=" + cvalue + ";" + expires + ";domain="+domain+";path=/";
39}
40
41function getCookieNotifDpt(cname) {
42    var name = cname + "=";
43    var ca = document.cookie.split(";");
44    for (var i = 0; i < ca.length; i++) {
45        var c = ca[i];
46        while (c.charAt(0) == " ") {
47            c = c.substring(1);
48        }
49        if (c.indexOf(name) == 0) {
50            return c.substring(name.length, c.length);
51        }
52    }
53    return null;
54}

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.