@@ -24,25 +24,25 @@ GitSync.prototype.addHandler = function(event, cb) {
2424
2525GitSync . prototype . _emit = function ( event , data ) {
2626 if ( this . callbacks [ event ] == undefined ) { return ; }
27- $ . each ( this . callbacks [ event ] , function ( i , ev ) {
27+ for ( let ev of this . callbacks [ event ] ) {
2828 ev ( data ) ;
29- } ) ;
29+ }
3030} ;
3131
3232
3333GitSync . prototype . start = function ( ) {
3434 // Start git pulling handled by SyncHandler, declared in handlers.py
35- var syncUrlParams = {
35+ let syncUrlParams = new URLSearchParams ( {
3636 repo : this . repo ,
3737 targetpath : this . targetpath
38- }
38+ } ) ;
3939 if ( typeof this . depth !== 'undefined' && this . depth != undefined ) {
40- syncUrlParams [ 'depth' ] = this . depth ;
40+ syncUrlParams . append ( 'depth' , this . depth ) ;
4141 }
4242 if ( typeof this . branch !== 'undefined' && this . branch != undefined ) {
43- syncUrlParams [ 'branch' ] = this . branch ;
43+ syncUrlParams . append ( 'branch' , this . branch ) ;
4444 }
45- var syncUrl = this . baseUrl + 'git-pull/api?' + $ . param ( syncUrlParams ) ;
45+ var syncUrl = this . baseUrl + 'git-pull/api?' + syncUrlParams . toString ( ) ;
4646
4747 this . eventSource = new EventSource ( syncUrl ) ;
4848 var that = this ;
@@ -68,56 +68,53 @@ function GitSyncView(termSelector, progressSelector, termToggleSelector) {
6868 this . term . loadAddon ( this . fit ) ;
6969
7070 this . visible = false ;
71- this . $ progress = $ ( progressSelector ) ;
71+ this . progress = document . querySelector ( progressSelector ) ;
7272
73- this . $ termToggle = $ ( termToggleSelector ) ;
74- this . termSelector = termSelector ;
73+ this . termToggle = document . querySelector ( termToggleSelector ) ;
74+ this . termElement = document . querySelector ( termSelector ) ;
7575
76- var that = this ;
77- this . $termToggle . click ( function ( ) {
78- that . setTerminalVisibility ( ! that . visible ) ;
79- } ) ;
76+ this . termToggle . onclick = ( ) => this . setTerminalVisibility ( ! this . visible )
8077}
8178
8279GitSyncView . prototype . setTerminalVisibility = function ( visible ) {
8380 if ( visible ) {
84- $ ( this . termSelector ) . parent ( ) . removeClass ( 'hidden' ) ;
81+ this . termElement . parentElement . classList . remove ( 'hidden' ) ;
8582 } else {
86- $ ( this . termSelector ) . parent ( ) . addClass ( 'hidden' ) ;
83+ this . termElement . parentElement . classList . add ( 'hidden' ) ;
8784 }
8885 this . visible = visible ;
8986 if ( visible ) {
9087 // See https://github.com/jupyterhub/nbgitpuller/pull/46 on why this is here.
9188 if ( ! this . term . element ) {
92- this . term . open ( $ ( this . termSelector ) [ 0 ] ) ;
89+ this . term . open ( this . termElement ) ;
9390 }
9491 this . fit . fit ( ) ;
9592 }
9693
9794}
9895
9996GitSyncView . prototype . setProgressValue = function ( val ) {
100- this . $ progress. attr ( 'aria-valuenow' , val ) ;
101- this . $ progress. css ( ' width' , val + '%' ) ;
97+ this . progress . setAttribute ( 'aria-valuenow' , val ) ;
98+ this . progress . style . width = val + '%' ;
10299} ;
103100
104101GitSyncView . prototype . getProgressValue = function ( ) {
105- return parseFloat ( this . $ progress. attr ( 'aria-valuenow' ) ) ;
102+ return parseFloat ( this . progress . getAttribute ( 'aria-valuenow' ) ) ;
106103} ;
107104
108105GitSyncView . prototype . setProgressText = function ( text ) {
109- this . $ progress. children ( 'span' ) . text ( text ) ;
106+ this . progress . querySelector ( 'span' ) . innerText = text ;
110107} ;
111108
112109GitSyncView . prototype . getProgressText = function ( ) {
113- return this . $ progress. children ( 'span' ) . text ( ) ;
110+ return this . progress . querySelector ( 'span' ) . innerText ;
114111} ;
115112
116113GitSyncView . prototype . setProgressError = function ( isError ) {
117114 if ( isError ) {
118- this . $ progress. addClass ( 'progress-bar-danger' ) ;
115+ this . progress . classList . add ( 'progress-bar-danger' ) ;
119116 } else {
120- this . $ progress. removeClass ( 'progress-bar-danger' ) ;
117+ this . progress . classList . remove ( 'progress-bar-danger' ) ;
121118 }
122119} ;
123120
@@ -127,14 +124,15 @@ var get_body_data = function(key) {
127124 * we should never have any encoded URLs anywhere else in code
128125 * until we are building an actual request
129126 */
130- var val = $ ( 'body' ) . data ( key ) ;
131- if ( typeof val === 'undefined' )
132- return val ;
127+ if ( ! document . body . hasAttribute ( 'data-' + key ) ) {
128+ return undefined ;
129+ }
130+ let val = document . body . getAttribute ( 'data-' + key ) ;
133131 return decodeURIComponent ( val ) ;
134132} ;
135133
136134var gs = new GitSync (
137- get_body_data ( 'baseUrl ' ) ,
135+ get_body_data ( 'base-url ' ) ,
138136 get_body_data ( 'repo' ) ,
139137 get_body_data ( 'branch' ) ,
140138 get_body_data ( 'depth' ) ,
@@ -169,8 +167,6 @@ gs.addHandler('error', function(data) {
169167} ) ;
170168gs . start ( ) ;
171169
172- $ ( '#header, #site' ) . show ( ) ;
173-
174170// Make sure we provide plenty of appearances of progress!
175171var progressTimers = [ ] ;
176172progressTimers . push ( setInterval ( function ( ) {
0 commit comments