|
|
@ -1,6 +1,6 @@
|
|
|
|
var notifications, delivered;
|
|
|
|
var notifications, delivered;
|
|
|
|
|
|
|
|
|
|
|
|
function get_subscriptions(callback, failures) {
|
|
|
|
function get_subscriptions(callback, failures = 1) {
|
|
|
|
if (failures >= 10) {
|
|
|
|
if (failures >= 10) {
|
|
|
|
return
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -92,7 +92,21 @@ function create_notification_stream(subscriptions) {
|
|
|
|
notifications.stream();
|
|
|
|
notifications.stream();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('storage', function (e) {
|
|
|
|
window.addEventListener('load', function (e) {
|
|
|
|
|
|
|
|
localStorage.setItem('notification_count', document.getElementById('notification_count') ? document.getElementById('notification_count').innerText : '0');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem('stream')) {
|
|
|
|
|
|
|
|
localStorage.removeItem('stream');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
|
|
if (!localStorage.getItem('stream')) {
|
|
|
|
|
|
|
|
get_subscriptions(create_notification_stream);
|
|
|
|
|
|
|
|
localStorage.setItem('stream', true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, Math.random() * 1000 + 10);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('storage', function (e) {
|
|
|
|
if (e.key === 'stream' && !e.newValue) {
|
|
|
|
if (e.key === 'stream' && !e.newValue) {
|
|
|
|
if (notifications) {
|
|
|
|
if (notifications) {
|
|
|
|
localStorage.setItem('stream', true);
|
|
|
|
localStorage.setItem('stream', true);
|
|
|
@ -115,21 +129,7 @@ window.addEventListener('storage', function (e) {
|
|
|
|
'<i class="icon ion-ios-notifications-outline"></i>';
|
|
|
|
'<i class="icon ion-ios-notifications-outline"></i>';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('load', function (e) {
|
|
|
|
|
|
|
|
localStorage.setItem('notification_count', document.getElementById('notification_count') ? document.getElementById('notification_count').innerText : '0');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (localStorage.getItem('stream')) {
|
|
|
|
|
|
|
|
localStorage.removeItem('stream');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
|
|
|
if (!localStorage.getItem('stream')) {
|
|
|
|
|
|
|
|
get_subscriptions(create_notification_stream);
|
|
|
|
|
|
|
|
localStorage.setItem('stream', true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}, Math.random() * 1000 + 10);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
window.addEventListener('unload', function (e) {
|
|
|
|
window.addEventListener('unload', function (e) {
|
|
|
|