@@ -5,11 +5,9 @@ function generateRegularUrl(hubUrl, urlPath, repoUrl, branch, compressed, conten
55 var url = new URL ( hubUrl ) ;
66
77 url . searchParams . set ( 'repo' , repoUrl ) ;
8-
98 if ( compressed ) {
109 url . searchParams . set ( 'content_provider' , contentProvider ) ;
1110 }
12-
1311 if ( urlPath ) {
1412 url . searchParams . set ( 'urlpath' , urlPath ) ;
1513 }
@@ -19,7 +17,7 @@ function generateRegularUrl(hubUrl, urlPath, repoUrl, branch, compressed, conten
1917 } else if ( contentProvider == "git" ) {
2018 url . searchParams . set ( 'branch' , "main" ) ;
2119 }
22-
20+
2321 if ( ! url . pathname . endsWith ( '/' ) ) {
2422 url . pathname += '/'
2523 }
@@ -35,11 +33,9 @@ function generateCanvasUrl(hubUrl, urlPath, repoUrl, branch, compressed, content
3533 var nextUrlParams = new URLSearchParams ( ) ;
3634
3735 nextUrlParams . append ( 'repo' , repoUrl ) ;
38-
3936 if ( compressed ) {
4037 nextUrlParams . append ( 'content_provider' , contentProvider ) ;
4138 }
42-
4339 if ( urlPath ) {
4440 nextUrlParams . append ( 'urlpath' , urlPath ) ;
4541 }
@@ -73,7 +69,6 @@ function generateBinderUrl(hubUrl, userName, envRepoName, envGitBranch, urlPath,
7369 if ( compressed ) {
7470 nextUrlParams . append ( 'content_provider' , contentProvider ) ;
7571 }
76-
7772 if ( urlPath ) {
7873 nextUrlParams . append ( 'urlpath' , urlPath ) ;
7974 }
@@ -127,25 +122,21 @@ function clearLinks(){
127122 document . getElementById ( 'canvas-link' ) . value = "" ;
128123}
129124
130-
131125function changeTab ( div ) {
132126 var hub = document . getElementById ( "hub" ) ;
133127 var hub_help_text = document . getElementById ( "hub-help-text" ) ;
134128 var env_repo_group = document . getElementById ( "env-repo-group" ) ;
135129 var env_repo = document . getElementById ( "env-repo" ) ;
136130 var id = div . id ;
137131 var form = document . getElementById ( 'linkgenerator' ) ;
138-
139132 clearLinks ( ) ;
140133 if ( id . includes ( "binder" ) ) {
141134 hub . placeholder = "https://mybinder.org" ;
142135 hub . value = "https://mybinder.org" ;
143136 hub_help_text . hidden = true ;
144137 hub . labels [ 0 ] . innerHTML = "BinderHub URL" ;
145-
146138 env_repo_group . style . display = '' ;
147139 env_repo . disabled = false ;
148-
149140 } else {
150141 hub . placeholder = "https://hub.example.com" ;
151142 hub . value = "" ;
@@ -173,7 +164,7 @@ function changeTab(div) {
173164 */
174165function generateCloneDirectoryName ( gitCloneUrl ) {
175166 if ( gitCloneUrl . slice ( - 1 ) == "/" )
176- gitCloneUrl = gitCloneUrl . slice ( 0 , - 1 ) ;
167+ gitCloneUrl = gitCloneUrl . slice ( 0 , - 1 ) ;
177168 var lastPart = gitCloneUrl . split ( '/' ) . slice ( - 1 ) [ 0 ] ;
178169 return lastPart . split ( ':' ) . slice ( - 1 ) [ 0 ] . replace ( / ( \. g i t | \. b u n d l e ) ? / , '' ) ;
179170}
@@ -216,7 +207,6 @@ function configureContentProviderAttrs(args){
216207
217208function displayLink ( ) {
218209 var form = document . getElementById ( 'linkgenerator' ) ;
219-
220210 form . classList . add ( 'was-validated' ) ;
221211 if ( form . checkValidity ( ) ) {
222212 var hubUrl = document . getElementById ( 'hub' ) . value ;
@@ -298,13 +288,13 @@ function populateFromQueryString() {
298288}
299289
300290function hideShowByClassName ( cls , hideShow ) {
301- [ ] . forEach . call ( document . querySelectorAll ( cls ) , function ( el ) {
302- el . style . display = hideShow ;
303- setDisabled = ( hideShow == 'none' )
304- $ ( el ) . find ( "input" ) . each ( function ( ) {
305- $ ( this ) . prop ( "disabled" , setDisabled ) ;
291+ [ ] . forEach . call ( document . querySelectorAll ( cls ) , function ( el ) {
292+ el . style . display = hideShow ;
293+ setDisabled = ( hideShow == 'none' )
294+ $ ( el ) . find ( "input" ) . each ( function ( ) {
295+ $ ( this ) . prop ( "disabled" , setDisabled ) ;
296+ } ) ;
306297 } ) ;
307- } ) ;
308298}
309299/**
310300 * Depending on the content provider selected this hides and shows the appropriate divs
@@ -338,7 +328,6 @@ function render() {
338328 var form = document . getElementById ( 'linkgenerator' ) ;
339329 var appName = form . querySelector ( 'input[name="app"]:checked' ) . value ;
340330
341-
342331 if ( appName == 'custom' ) {
343332 document . getElementById ( 'urlpath' ) . disabled = false ;
344333 document . getElementById ( 'filepath' ) . disabled = true ;
@@ -352,7 +341,6 @@ function render() {
352341 document . getElementById ( 'filepath' ) . disabled = false ;
353342 }
354343 }
355-
356344 displayLink ( ) ;
357345}
358346
@@ -371,11 +359,9 @@ function main() {
371359 element . addEventListener ( 'change' , function ( ) {
372360 displayContentProvider ( ) ;
373361 render ( ) ;
374- }
375- ) ;
362+ } ) ;
376363 }
377364 )
378-
379365 document . querySelectorAll ( '#linkgenerator input[type="text"], #linkgenerator input[type="url"]' ) . forEach (
380366 function ( element ) {
381367 element . addEventListener ( 'input' , render ) ;
@@ -394,7 +380,6 @@ function main() {
394380 }
395381 }
396382
397-
398383 // Do an initial render, to make sure our disabled / enabled properties are correctly set
399384 displayContentProvider ( ) ;
400385 render ( ) ;
0 commit comments