File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ function checkNotifications ( ) {
2
+ var notificationIndicator = document . querySelector ( '.notification-indicator' ) ;
3
+ if ( notificationIndicator && notificationIndicator . getAttribute ( 'data-ga-click' ) === 'Header, notification' ) {
4
+ var notificationCount = parseInt ( notificationIndicator . getAttribute ( 'data-count' ) ) ;
5
+ if ( notificationCount > 0 ) {
6
+ var options = {
7
+ body : 'You have ' + notificationCount + ' new notifications on GitHub.' ,
8
+ icon : 'icon.png'
9
+ } ;
10
+ var notification = new Notification ( 'GitHub Notification' , options ) ;
11
+ }
12
+ }
13
+ }
14
+
15
+ if ( Notification . permission === 'granted' ) {
16
+ checkNotifications ( ) ;
17
+ } else if ( Notification . permission !== 'denied' ) {
18
+ Notification . requestPermission ( ) . then ( function ( permission ) {
19
+ if ( permission === 'granted' ) {
20
+ checkNotifications ( ) ;
21
+ }
22
+ } ) ;
23
+ }
24
+
25
+ setInterval ( checkNotifications , 30000 ) ;
26
+
You can’t perform that action at this time.
0 commit comments