File tree Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Expand file tree Collapse file tree 1 file changed +17
-12
lines changed Original file line number Diff line number Diff line change 24
24
</ div >
25
25
26
26
< script >
27
- var getUrlParameter = function getUrlParameter ( sParam ) {
28
- var sPageURL = window . location . search . substring ( 1 ) ,
29
- sURLVariables = sPageURL . split ( '&' ) , sParameterName , i ;
30
- for ( i = 0 ; i < sURLVariables . length ; i ++ ) {
31
- sParameterName = sURLVariables [ i ] . split ( '=' ) ;
32
- if ( sParameterName [ 0 ] === sParam ) {
33
- return typeof sParameterName [ 1 ] === undefined ? true : decodeURIComponent ( sParameterName [ 1 ] ) ;
34
- }
27
+ const getUrlParameter = ( sParam ) => {
28
+ const paramValue = new URLSearchParams ( window . location . search . substring ( 1 ) ) . get ( sParam ) ?? "" ;
29
+ if ( 0 < paramValue . length ) {
30
+ return decodeURIComponent ( paramValue ) ;
35
31
}
36
32
return false ;
37
33
} ;
38
34
39
- jQuery ( "#urlTextBox" ) . text ( getUrlParameter ( "url" ) ) ;
40
- jQuery ( "#retryButton" ) . click ( function ( ) {
41
- window . open ( "antennapod-subscribe://" + getUrlParameter ( "url" ) ) ;
42
- } ) ;
35
+ const urlTextBox = document . getElementById ( "urlTextBox" ) ;
36
+ const retryButton = document . getElementById ( "retryButton" ) ;
37
+ if ( getUrlParameter ( "url" ) === false ) {
38
+ urlTextBox . textContent = "URL not available" ;
39
+ retryButton . disabled = true ;
40
+ retryButton . textContent += " (error)" ;
41
+
42
+ } else {
43
+ urlTextBox . textContent = getUrlParameter ( "url" ) ;
44
+ retryButton . onclick = ( ) => {
45
+ window . open ( "antennapod-subscribe://" + getUrlParameter ( "url" ) ) ;
46
+ } ;
47
+ }
43
48
</ script >
You can’t perform that action at this time.
0 commit comments