PageSourceSearch

https://miridei.com/files/js/business/subscriptions.js

js miridei.com collected 2026-10-02 10:48:26 UTC 2,337 bytes, 53 lines download raw bytes

1// управление подпиской
2var subscriptions = {
3    // может ли подписаться на пуши
4    canSubscribePush: function () {
5        return navigator && "serviceWorker" in navigator && "PushManager" in window;
6    },
7    // подписка на пуши
8    subscribePush : function(options, onsuccess, onerror) {
9        navigator.serviceWorker.ready.then(
10            function(registration) {
11                registration.pushManager.subscribe({ userVisibleOnly: true })
12                    .then(function(sub) {
13                        var json = sub.toJSON();
14                        console.log(json);
15                        console.log(sub.getKey);
16                        $.post("/ajax/push/subscribe.ashx", {
17                            request: JSON.stringify({
18                                auth: json.keys ? json.keys.auth : null,
19                                endpoint: json.endpoint,
20                                p256dh: json.keys ? json.keys.p256dh : null,
21                                sections: options.sections,
22                                subscribeAll: options.subscribeAll
23                            })
24                        }).done(function (data) {
25                            if (data.ok && onsuccess) onsuccess({ subcription : data, info : json});
26                            else if (onerror) onerror({ message: data.text });
27                        });
28                    })
29                    .catch(function(error) {
30                        if (onerror) onerror(error);
31                    });
32            },
33            function(error) {
34                if (onerror) onerror(error);
35            }
36        );
37    },
38    // подписка на почту
39    subscribeEmail: function (email, options, onsuccess, onerror) {
40        $.post("/ajax/email/subscribe.ashx", {
41            request : JSON.stringify( {
42                email: email,
43                sections: options.sections,
44                subscribeAll: options.subscribeAll
45            })
46        }).done(function (data) {
47            if (data.ok && onsuccess) onsuccess(data);
48            else if (onerror) onerror({ message: data.text });
49        }).fail(function (error) {
50            if (onerror) onerror(error);
51        });
52    }
53};

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.