@@ -125,6 +125,11 @@ function setupElements() {
125
125
// const songSearch = document.getElementById(`songSearch`);
126
126
// const artistSearch = document.getElementById(`artistSearch`);
127
127
const querySearch = document . getElementById ( `querySearch` ) ;
128
+ if ( window . NO_JS ) {
129
+ searchButton . remove ( ) ;
130
+ querySearch . remove ( ) ;
131
+ return ;
132
+ }
128
133
searchButton . addEventListener ( 'click' , ( ) => {
129
134
location . href = ( useQuestionMark ? '?' : '' ) + `${ TekstowoAPIInstance . ConstantURLPaths . search } ,` + querySearch . value . replace ( / \s / g, "+" ) + ".html" ;
130
135
} ) ;
@@ -163,6 +168,8 @@ const TekstowoAPIInstance = initializeTekstowo();
163
168
*/
164
169
function injectComments ( postInfo , postType ) {
165
170
document . getElementsByClassName ( "comments-section" ) [ 0 ] . before ( docCreateElement ( "p" , { textContent : "Loaded comments: " , style : "text-align: center;" , id : "loadedCommentsCount" } , [ docCreateElement ( "p" , { textContent : "0" , style : "display: inline;" } ) , docCreateElement ( "p" , { textContent : `/${ postInfo . commentCount } ` , style : "display: inline;" } ) ] ) ) ;
171
+ if ( window . NO_JS )
172
+ return ;
166
173
document . getElementsByClassName ( "comments-section" ) [ 0 ] . appendChild ( docCreateElement ( "button" , {
167
174
textContent : "Load comments" ,
168
175
onclick ( ) {
@@ -245,6 +252,8 @@ function loadLyricsViewer(currentUrlInfo) {
245
252
}
246
253
document . getElementsByClassName ( "metadata-section" ) [ 0 ] . appendChild ( newTable ) ;
247
254
document . title = lyrics . lyricsName + " - lyrics and translation of the song" ;
255
+ if ( window . NO_JS )
256
+ window . bridgeTest . finishedDeferred . resolve ( ) ;
248
257
} ) ;
249
258
} ) ;
250
259
}
@@ -345,16 +354,23 @@ function loadSearchResults(currentUrlInfo) {
345
354
const result = searchResults . pageCount ;
346
355
for ( let i = 0 ; i < result ; i ++ ) {
347
356
const newButton = document . createElement ( 'button' ) ;
348
- newButton . textContent = i + 1 ;
349
- newButton . onclick = ( ) => {
350
- location . href = ( useQuestionMark ? '?' : '' ) + `${ TekstowoAPIInstance . ConstantURLPaths . search } ,` + settings . tytul + ",strona," + ( i + 1 ) + ".html" ;
351
- } ;
357
+ if ( ! window . NO_JS ) {
358
+ newButton . textContent = i + 1 ;
359
+ newButton . onclick = ( ) => {
360
+ location . href = ( useQuestionMark ? '?' : '' ) + `${ TekstowoAPIInstance . ConstantURLPaths . search } ,` + settings . tytul + ",strona," + ( i + 1 ) + ".html" ;
361
+ } ;
362
+ }
363
+ else {
364
+ newButton . appendChild ( docCreateElement ( "a" , { textContent : i + 1 , href : ( useQuestionMark ? '?' : '' ) + `${ TekstowoAPIInstance . ConstantURLPaths . search } ,` + settings . tytul + ",strona," + ( i + 1 ) + ".html" } ) ) ;
365
+ }
352
366
if ( ( i + 1 ) . toString ( ) == settings . strona || ( settings . strona == undefined && ( i + 1 ) == 1 ) )
353
367
newButton . style . color = "red" ;
354
368
pageSelection . appendChild ( newButton ) ;
355
369
}
356
370
}
357
371
document . title = "Search - lyrics and translations" ;
372
+ if ( window . NO_JS )
373
+ window . bridgeTest . finishedDeferred . resolve ( ) ;
358
374
} ) ;
359
375
} ) ;
360
376
}
@@ -501,6 +517,8 @@ function loadArtistSongList(currentUrlInfo) {
501
517
}
502
518
}
503
519
document . title = "Search - lyrics and translations" ;
520
+ if ( window . NO_JS )
521
+ window . bridgeTest . finishedDeferred . resolve ( ) ;
504
522
} ) ;
505
523
} ) ;
506
524
}
@@ -549,6 +567,8 @@ function loadArtistProfile(currentUrlInfo) {
549
567
) ,
550
568
) ] ) ) ;
551
569
document . title = response . displayName + " - photos, discography" ;
570
+ if ( window . NO_JS )
571
+ window . bridgeTest . finishedDeferred . resolve ( ) ;
552
572
} ) ;
553
573
} ) ;
554
574
}
@@ -588,11 +608,17 @@ function processOperation() {
588
608
case TekstowoAPIInstance . ConstantURLPaths . artistProfile :
589
609
loadArtistProfile ( currentUrl ) ;
590
610
break ;
591
- case "" :
611
+ case "" : {
612
+ if ( window . NO_JS )
613
+ window . bridgeTest . finishedDeferred . resolve ( ) ;
592
614
break ;
593
- default :
615
+ }
616
+ default : {
594
617
alert ( "Operation (currently) unsupported." ) ;
618
+ if ( window . NO_JS )
619
+ window . bridgeTest . finishedDeferred . resolve ( ) ;
595
620
break ;
621
+ }
596
622
}
597
623
}
598
624
// eslint-disable-next-line no-unused-vars
0 commit comments