diff options
| author | meow <woem> | 2022-05-06 07:21:19 +0300 |
|---|---|---|
| committer | meow <woem> | 2022-05-06 07:21:19 +0300 |
| commit | fd890f9c0a78635a3ea1ab56ec5a735fef27c1c4 (patch) | |
| tree | 54eb0506221eb12c5ce92a53511598a5d89f45d1 /assets/js/notifications.js | |
| parent | 835237382fd2e316a5e118dafc929f6ffb8e33fd (diff) | |
| download | invidious-fd890f9c0a78635a3ea1ab56ec5a735fef27c1c4.tar.gz invidious-fd890f9c0a78635a3ea1ab56ec5a735fef27c1c4.tar.bz2 invidious-fd890f9c0a78635a3ea1ab56ec5a735fef27c1c4.zip | |
fix helpers storage
Diffstat (limited to 'assets/js/notifications.js')
| -rw-r--r-- | assets/js/notifications.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/assets/js/notifications.js b/assets/js/notifications.js index f8cc750b..568f5ff6 100644 --- a/assets/js/notifications.js +++ b/assets/js/notifications.js @@ -48,7 +48,7 @@ function create_notification_stream(subscriptions) { } delivered.push(notification.videoId); - helpers.storage.set('notification_count', parseInt(helpers.storage.get('notification_count') || '0') + 1); + helpers.storage.set('notification_count', (helpers.storage.get('notification_count') || 0) + 1); var notification_ticker = document.getElementById('notification_ticker'); if (parseInt(helpers.storage.get('notification_count')) > 0) { @@ -72,7 +72,12 @@ function handle_notification_error(event) { } addEventListener('load', function (e) { - helpers.storage.set('notification_count', document.getElementById('notification_count') ? document.getElementById('notification_count').innerText : '0'); + var notification_count = document.getElementById('notification_count'); + if (notification_count) { + helpers.storage.set('notification_count', parseInt(notification_count.innerText)); + } else { + helpers.storage.set('notification_count', 0); + } if (helpers.storage.get('stream')) { helpers.storage.remove('stream'); |
