@@ -12,12 +12,12 @@ define([
12
12
"jquery" ,
13
13
"base/js/namespace" ,
14
14
"require" ,
15
- ] , function ( $ , IPython , require ) {
15
+ ] , function ( $ , Jupyter , require ) {
16
16
"use strict" ;
17
17
18
18
var params = {
19
19
sticky : false ,
20
- sound : false
20
+ play_sound : false
21
21
} ;
22
22
23
23
var current_time = function ( ) {
@@ -63,7 +63,7 @@ define([
63
63
64
64
var add_permissions_button = function ( ) {
65
65
if ( $ ( "#permissions-button" ) . length === 0 ) {
66
- IPython . toolbar . add_buttons_group ( [
66
+ Jupyter . toolbar . add_buttons_group ( [
67
67
{
68
68
'label' : 'Grant Notification Permissions' ,
69
69
'icon' : 'fa-check' ,
@@ -106,13 +106,13 @@ define([
106
106
if ( enabled && ! first_start && ! busy_kernel && elapsed_time >= min_time ) {
107
107
var opts = {
108
108
body : "Kernel is now idle\n(ran for " + Math . round ( elapsed_time ) + " secs)" ,
109
- icon : "/ static/base/images/favicon.ico",
109
+ icon : Jupyter . notebook . base_url + " static/base/images/favicon.ico",
110
110
requireInteraction : params . sticky
111
111
} ;
112
112
if ( params . sound ) {
113
113
opts [ "sound" ] = require . toUrl ( "./notify.mp3" ) ;
114
114
}
115
- var n = new Notification ( IPython . notebook . notebook_name , opts ) ;
115
+ var n = new Notification ( Jupyter . notebook . notebook_name , opts ) ;
116
116
n . onclick = function ( event ) { window . focus ( ) ; }
117
117
}
118
118
if ( first_start ) {
@@ -121,24 +121,24 @@ define([
121
121
} ;
122
122
123
123
var load_state = function ( ) {
124
- if ( ! IPython . notebook ) return ;
124
+ if ( ! Jupyter . notebook ) return ;
125
125
126
- if ( "notify_time" in IPython . notebook . metadata ) {
127
- min_time = IPython . notebook . metadata . notify_time ;
126
+ if ( "notify_time" in Jupyter . notebook . metadata ) {
127
+ min_time = Jupyter . notebook . metadata . notify_time ;
128
128
enabled = true ;
129
129
}
130
130
} ;
131
131
132
132
var save_state = function ( ) {
133
133
if ( enabled ) {
134
- if ( IPython . notebook . metadata . notify_time !== min_time ) {
135
- IPython . notebook . metadata . notify_time = min_time ;
136
- IPython . notebook . set_dirty ( ) ;
134
+ if ( Jupyter . notebook . metadata . notify_time !== min_time ) {
135
+ Jupyter . notebook . metadata . notify_time = min_time ;
136
+ Jupyter . notebook . set_dirty ( ) ;
137
137
}
138
138
} else {
139
- if ( IPython . notebook . metadata . hasOwnProperty ( 'notify_time' ) ) {
140
- delete IPython . notebook . metadata . notify_time ;
141
- IPython . notebook . set_dirty ( ) ;
139
+ if ( Jupyter . notebook . metadata . hasOwnProperty ( 'notify_time' ) ) {
140
+ delete Jupyter . notebook . metadata . notify_time ;
141
+ Jupyter . notebook . set_dirty ( ) ;
142
142
}
143
143
}
144
144
} ;
@@ -156,16 +156,16 @@ define([
156
156
} ;
157
157
158
158
var setup_notifier = function ( ) {
159
- $ ( [ IPython . events ] ) . on ( 'kernel_starting.Kernel' , function ( ) {
159
+ $ ( [ Jupyter . events ] ) . on ( 'kernel_starting.Kernel' , function ( ) {
160
160
first_start = true ; // reset first_start status when restarting the kernel
161
161
} ) ;
162
162
163
- $ ( [ IPython . events ] ) . on ( 'kernel_busy.Kernel' , function ( ) {
163
+ $ ( [ Jupyter . events ] ) . on ( 'kernel_busy.Kernel' , function ( ) {
164
164
busy_kernel = true ;
165
165
start_time = current_time ( ) ; // reset the timer
166
166
} ) ;
167
167
168
- $ ( [ IPython . events ] ) . on ( 'kernel_idle.Kernel' , function ( ) {
168
+ $ ( [ Jupyter . events ] ) . on ( 'kernel_idle.Kernel' , function ( ) {
169
169
busy_kernel = false ; // Used to make sure that kernel doesn't go busy again within the timeout set below.
170
170
setTimeout ( notify , 500 ) ;
171
171
} ) ;
0 commit comments