@@ -2112,63 +2112,62 @@ <h3>Hardware Recommendations</h3>
21122112 } ) ;
21132113 </ script >
21142114
2115- < script >
2116-
2117- document . addEventListener ( 'DOMContentLoaded' , function ( ) {
2118- const owner = 'CPScript' ;
2119- const repo = 'SystemScript' ;
2120- const repoUrl = `https://github.com/${ owner } /${ repo } ` ;
2121-
2122- const downloadButton = document . querySelector ( '.header-button:first-of-type' ) ;
2123- if ( downloadButton ) {
2124- downloadButton . addEventListener ( 'click' , function ( ) {
2125- const originalText = downloadButton . innerHTML ;
2126- downloadButton . innerHTML = '<span class="icon-download"></span> Fetching release...' ;
2127- downloadButton . disabled = true ;
2128-
2129- fetch ( `https://github.com/${ owner } /${ repo } /releases` )
2130- . then ( response => {
2131- if ( ! response . ok ) {
2132- throw new Error ( 'GitHub API request failed' ) ;
2133- }
2134- return response . json ( ) ;
2135- } )
2136- . then ( data => {
2137- if ( data . assets && data . assets . length > 0 ) {
2138- const asset = data . assets [ 0 ] ;
2139- const downloadUrl = asset . browser_download_url ;
2140-
2141- const downloadLink = document . createElement ( 'a' ) ;
2142- downloadLink . href = downloadUrl ;
2143- downloadLink . download = asset . name ;
2144- downloadLink . style . display = 'none' ;
2145- document . body . appendChild ( downloadLink ) ;
2146- downloadLink . click ( ) ;
2147- document . body . removeChild ( downloadLink ) ;
2148-
2149- downloadButton . innerHTML = `<span class="icon-download"></span> Download IDE (V: ${ data . tag_name } )` ;
2150- } else {
2151- throw new Error ( 'No download assets found' ) ;
2152- }
2153- } )
2154- . catch ( error => {
2155- console . error ( 'Download error:' , error ) ;
2156- window . open ( `${ repoUrl } /releases/latest` , '_blank' ) ;
2157- downloadButton . innerHTML = originalText ;
2158- } )
2159- . finally ( ( ) => {
2160- downloadButton . disabled = false ;
2161- } ) ;
2162- } ) ;
2163- }
2164-
2165- const githubButton = document . querySelector ( '.header-button:last-of-type' ) ;
2166- if ( githubButton ) {
2167- githubButton . addEventListener ( 'click' , function ( ) {
2168- window . open ( repoUrl , '_blank' ) ;
2169- } ) ;
2170- }
2171- } ) ;
2172- </ script >
2115+ < script >
2116+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
2117+ const owner = 'CPScript' ;
2118+ const repo = 'SystemScript' ;
2119+ const repoUrl = `https://github.com/${ owner } /${ repo } ` ;
2120+
2121+ const downloadButton = document . querySelector ( '.header-button:first-of-type' ) ;
2122+ if ( downloadButton ) {
2123+ downloadButton . addEventListener ( 'click' , function ( ) {
2124+ const originalText = downloadButton . innerHTML ;
2125+ downloadButton . innerHTML = '<span class="icon-download"></span> Fetching release...' ;
2126+ downloadButton . disabled = true ;
2127+
2128+ fetch ( `https://api.github.com/repos/${ owner } /${ repo } /releases/latest` )
2129+ . then ( response => {
2130+ if ( ! response . ok ) {
2131+ throw new Error ( 'GitHub API request failed' ) ;
2132+ }
2133+ return response . json ( ) ;
2134+ } )
2135+ . then ( data => {
2136+ if ( data . assets && data . assets . length > 0 ) {
2137+ const asset = data . assets [ 0 ] ;
2138+ const downloadUrl = asset . browser_download_url ;
2139+
2140+ const downloadLink = document . createElement ( 'a' ) ;
2141+ downloadLink . href = downloadUrl ;
2142+ downloadLink . download = asset . name ;
2143+ downloadLink . style . display = 'none' ;
2144+ document . body . appendChild ( downloadLink ) ;
2145+ downloadLink . click ( ) ;
2146+ document . body . removeChild ( downloadLink ) ;
2147+
2148+ downloadButton . innerHTML = `<span class="icon-download"></span> Download IDE (V: ${ data . tag_name } )` ;
2149+ } else {
2150+ throw new Error ( 'No download assets found' ) ;
2151+ }
2152+ } )
2153+ . catch ( error => {
2154+ console . error ( 'Download error:' , error ) ;
2155+ window . open ( `${ repoUrl } /releases/latest` , '_blank' ) ;
2156+ downloadButton . innerHTML = originalText ;
2157+ } )
2158+ . finally ( ( ) => {
2159+ downloadButton . disabled = false ;
2160+ } ) ;
2161+ } ) ;
2162+ }
2163+
2164+ const githubButton = document . querySelector ( '.header-button:last-of-type' ) ;
2165+ if ( githubButton ) {
2166+ githubButton . addEventListener ( 'click' , function ( ) {
2167+ window . open ( repoUrl , '_blank' ) ;
2168+ } ) ;
2169+ }
2170+ } ) ;
2171+ </ script >
21732172</ body >
21742173</ html>
0 commit comments