@@ -9,17 +9,31 @@ requirejs([
9
9
] , function ( $ , dialog , i18n , _ , IPython ) {
10
10
'use strict' ;
11
11
$ ( '#notebook_about' ) . click ( function ( ) {
12
+ // The baseUrlPrefix is only injected in the document by nbclassic.
13
+ const is_nbclassic = document . baseUrlPrefix !== undefined ;
12
14
// use underscore template to auto html escape
13
15
if ( sys_info ) {
14
- var text = i18n . msg . _ ( 'You are using Jupyter NbClassic.' ) ;
15
- text = text + '<br/><br/>' ;
16
- text = text + i18n . msg . _ ( 'The version of the Jupyter server is: ' ) ;
17
- text = text + _ . template ( '<b><%- version %></b>' ) ( { version : sys_info . jupyter_server_version } ) ;
18
- if ( sys_info . commit_hash ) {
19
- text = text + _ . template ( '-<%- hash %>' ) ( { hash : sys_info . commit_hash } ) ;
16
+ var text = '' ;
17
+ if ( is_nbclassic ) {
18
+ text = text + i18n . msg . _ ( 'You are using Jupyter NbClassic.' ) ;
19
+ text = text + '<br/><br/>' ;
20
+ text = text + i18n . msg . _ ( 'The version of the Jupyter server is: ' ) ;
21
+ text = text + _ . template ( '<b><%- version %></b>' ) ( { version : sys_info . jupyter_server_version } ) ;
22
+ if ( sys_info . commit_hash ) {
23
+ text = text + _ . template ( '-<%- hash %>' ) ( { hash : sys_info . commit_hash } ) ;
24
+ }
25
+ text = text + '<br/>' ;
26
+ text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version' ;
27
+ }
28
+ else {
29
+ text = text + i18n . msg . _ ( 'You are using Jupyter Notebook.' ) ;
30
+ text = text + '<br/><br/>' ;
31
+ text = text + i18n . msg . _ ( 'The version of the notebook server is: ' ) ;
32
+ text = text + _ . template ( '<b><%- version %></b>' ) ( { version : sys_info . notebook_version } ) ;
33
+ if ( sys_info . commit_hash ) {
34
+ text = text + _ . template ( '-<%- hash %>' ) ( { hash : sys_info . commit_hash } ) ;
35
+ }
20
36
}
21
- text = text + '<br/>' ;
22
- text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version' ;
23
37
text = text + '<br/>' ;
24
38
text = text + i18n . msg . _ ( 'The server is running on this version of Python:' ) ;
25
39
text = text + _ . template ( '<br/><pre>Python <%- pyver %></pre>' ) ( {
@@ -36,11 +50,19 @@ requirejs([
36
50
body . append ( $ ( '<h4/>' ) . text ( i18n . msg . _ ( 'Cannot find sys_info!' ) ) ) ;
37
51
body . append ( $ ( '<p/>' ) . html ( text ) ) ;
38
52
}
39
- dialog . modal ( {
40
- title : i18n . msg . _ ( 'About Jupyter NbClassic' ) ,
41
- body : body ,
42
- buttons : { 'OK' : { } }
43
- } ) ;
53
+ if ( is_nbclassic ) {
54
+ dialog . modal ( {
55
+ title : i18n . msg . _ ( 'About Jupyter NbClassic' ) ,
56
+ body : body ,
57
+ buttons : { 'OK' : { } }
58
+ } ) ;
59
+ } else {
60
+ dialog . modal ( {
61
+ title : i18n . msg . _ ( 'About Jupyter Notebook' ) ,
62
+ body : body ,
63
+ buttons : { 'OK' : { } }
64
+ } ) ;
65
+ }
44
66
try {
45
67
IPython . notebook . session . kernel . kernel_info ( function ( data ) {
46
68
kinfo . html ( $ ( '<pre/>' ) . text ( data . content . banner ) ) ;
0 commit comments