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.