@@ -5,17 +5,17 @@ define([
55 'base/js/dialog' ,
66 './dexie' ,
77 'jquery'
8- ] ,
9- function ( Jupyter , events , utils , dialog , dexie , $ ) {
8+ ] ,
9+ function ( Jupyter , events , utils , dialog , dexie , $ ) {
1010 var repoid = null ;
1111 var repoLabel = null ;
1212 var bindeRefUrl = null ;
1313 var binderPersistentUrl = null
1414 var db = null ;
1515 var dbname = 'jupyter-offlinenotebook' ;
1616
17- var initialise = function ( ) {
18- $ . getJSON ( utils . get_body_data ( 'baseUrl' ) + 'offlinenotebook/config' , function ( data ) {
17+ var initialise = function ( ) {
18+ $ . getJSON ( utils . get_body_data ( 'baseUrl' ) + 'offlinenotebook/config' , function ( data ) {
1919 repoid = data [ 'repoid' ] ;
2020 if ( repoid ) {
2121 console . log ( 'offline-notebook repoid: ' + repoid ) ;
@@ -33,11 +33,11 @@ define([
3333 } ) ;
3434 }
3535
36- var getDb = function ( ) {
36+ var getDb = function ( ) {
3737 if ( ! db ) {
3838 db = new dexie ( dbname ) ;
3939 // Only define indexed fields. pk: primary key
40- db . version ( 1 ) . stores ( { 'offlinenotebook' : 'pk,repoid,name,type' } ) ;
40+ db . version ( 1 ) . stores ( { 'offlinenotebook' : 'pk,repoid,name,type' } ) ;
4141 console . log ( 'offline-notebook: Opened IndexedDB' ) ;
4242 }
4343 return db ;
@@ -46,17 +46,17 @@ define([
4646 var addButtons = function ( ) {
4747 Jupyter . actions . register ( {
4848 'help' : 'Download visible' ,
49- 'icon' : 'fa-download' ,
49+ 'icon' : 'fa-download' ,
5050 'handler' : downloadNotebookFromBrowser
5151 } , 'offline-notebook-download' , 'offlinenotebook' ) ;
5252 Jupyter . actions . register ( {
5353 'help' : 'Save to browser storage' ,
54- 'icon' : 'fa-cloud-download' ,
54+ 'icon' : 'fa-cloud-download' ,
5555 'handler' : localstoreSaveNotebook
5656 } , 'offline-notebook-save' , 'offlinenotebook' ) ;
5757 Jupyter . actions . register ( {
5858 'help' : 'Restore from browser storage' ,
59- 'icon' : 'fa-cloud-upload' ,
59+ 'icon' : 'fa-cloud-upload' ,
6060 'handler' : localstoreLoadNotebook
6161 } , 'offline-notebook-load' , 'offlinenotebook' ) ;
6262
@@ -110,7 +110,7 @@ define([
110110 }
111111 if ( ! buttons ) {
112112 buttons = {
113- OK : { 'class' : 'btn-primary' }
113+ OK : { 'class' : 'btn-primary' }
114114 } ;
115115 }
116116 dialog . modal ( {
@@ -125,18 +125,18 @@ define([
125125 $ ( '<span/>' , {
126126 'text' : 'repoid: '
127127 } ) . append (
128- $ ( '<b/>' , {
129- 'text' : repoid
130- } )
131- ) ) ;
128+ $ ( '<b/>' , {
129+ 'text' : repoid
130+ } )
131+ ) ) ;
132132 var displayPath = $ ( '<div/>' ) . append (
133133 $ ( '<span/>' , {
134134 'text' : 'path: '
135135 } ) . append (
136- $ ( '<b/>' , {
137- 'text' : path
138- } )
139- ) ) ;
136+ $ ( '<b/>' , {
137+ 'text' : path
138+ } )
139+ ) ) ;
140140 return displayRepoid . append ( displayPath ) ;
141141 }
142142
@@ -157,12 +157,12 @@ define([
157157 'format' : 'json' ,
158158 'type' : 'notebook' ,
159159 'content' : nb
160- } ) . then ( function ( key ) {
160+ } ) . then ( function ( key ) {
161161 console . log ( 'offline-notebook saved: ' , key ) ;
162162 modalDialog (
163163 'Notebook saved to browser storage' ,
164164 repopathDisplay ) ;
165- } ) . catch ( function ( e ) {
165+ } ) . catch ( function ( e ) {
166166 var body = repopathDisplay . append (
167167 $ ( '<div/>' , {
168168 'text' : e
@@ -171,14 +171,14 @@ define([
171171 'Local storage IndexedDB error' ,
172172 body ,
173173 'alert alert-danger' ) ;
174- throw ( e ) ;
174+ throw ( e ) ;
175175 } ) ;
176176 }
177177
178178 function localstoreLoadNotebook ( ) {
179179 var path = Jupyter . notebook . notebook_path ;
180180 var primaryKey = 'repoid:' + repoid + ' path:' + path ;
181- getDb ( ) . offlinenotebook . get ( primaryKey ) . then ( function ( nb ) {
181+ getDb ( ) . offlinenotebook . get ( primaryKey ) . then ( function ( nb ) {
182182 var repopathDisplay = formatRepoPathforDialog ( repoid , path ) ;
183183 if ( nb ) {
184184 console . log ( 'offline-notebook found ' + primaryKey ) ;
@@ -205,27 +205,27 @@ define([
205205 repopathDisplay ,
206206 'alert alert-danger' ) ;
207207 }
208- } ) . catch ( function ( e ) {
208+ } ) . catch ( function ( e ) {
209209 var body = $ ( '<div/>' ) . append (
210210 $ ( '<div/>' , {
211211 'text' : primaryKey
212212 } ) ) . append (
213- $ ( '<div/>' , {
214- 'text' : e
215- } ) ) ;
213+ $ ( '<div/>' , {
214+ 'text' : e
215+ } ) ) ;
216216 modalDialog (
217217 'Local storage IndexedDB error' ,
218218 body ,
219219 'alert alert-danger' ) ;
220- throw ( e ) ;
220+ throw ( e ) ;
221221 } ) ;
222222 }
223223
224224 // Download https://jsfiddle.net/koldev/cW7W5/
225225 function downloadNotebookFromBrowser ( ) {
226226 var name = Jupyter . notebook . notebook_name ;
227227 var nb = getNotebookFromBrowser ( ) ;
228- var blob = new Blob ( [ JSON . stringify ( nb ) ] , { type : 'application/json' } ) ;
228+ var blob = new Blob ( [ JSON . stringify ( nb ) ] , { type : 'application/json' } ) ;
229229 var url = window . URL . createObjectURL ( blob ) ;
230230 var a = document . createElement ( 'a' ) ;
231231 document . body . appendChild ( a ) ;
@@ -267,11 +267,11 @@ define([
267267 'style' : 'flex-grow: 1; margin: 0;'
268268 } ) ) ;
269269 var button = $ ( '<button/>' , {
270- 'title' : 'Copy binder link to clipboard' ,
271- 'data-url' : binderUrl
272- } ) . click ( function ( ) {
273- copy_link_into_clipboard ( this ) ;
274- } )
270+ 'title' : 'Copy binder link to clipboard' ,
271+ 'data-url' : binderUrl
272+ } ) . click ( function ( ) {
273+ copy_link_into_clipboard ( this ) ;
274+ } )
275275 button . append (
276276 $ ( '<i/>' , {
277277 'class' : 'fa fa-clipboard'
@@ -290,4 +290,4 @@ define([
290290 return {
291291 load_ipython_extension : load_ipython_extension
292292 } ;
293- } ) ;
293+ } ) ;
0 commit comments