@@ -3801,9 +3801,7 @@ <h3>Safety Levels</h3>
38013801 </ div>
38023802
38033803 < script >
3804- // Simple JavaScript to make dropdowns and other interactive elements work
38053804 document . addEventListener ( 'DOMContentLoaded' , function ( ) {
3806- // Dropdown toggle functionality
38073805 const dropdownToggles = document . querySelectorAll ( '.dropdown-toggle' ) ;
38083806 dropdownToggles . forEach ( toggle => {
38093807 toggle . addEventListener ( 'click' , function ( ) {
@@ -3812,7 +3810,6 @@ <h3>Safety Levels</h3>
38123810 } ) ;
38133811 } ) ;
38143812
3815- // Mobile menu toggle
38163813 const navToggle = document . querySelector ( '.nav-toggle' ) ;
38173814 const nav = document . getElementById ( 'nav' ) ;
38183815 if ( navToggle ) {
@@ -3821,7 +3818,6 @@ <h3>Safety Levels</h3>
38213818 } ) ;
38223819 }
38233820
3824- // Copy button functionality for code blocks
38253821 const copyButtons = document . querySelectorAll ( '.copy-button' ) ;
38263822 copyButtons . forEach ( button => {
38273823 button . addEventListener ( 'click' , function ( ) {
@@ -3838,7 +3834,6 @@ <h3>Safety Levels</h3>
38383834 } ) ;
38393835 } ) ;
38403836
3841- // Dark mode toggle (simple implementation)
38423837 const darkModeToggle = document . querySelector ( '.dark-mode-toggle' ) ;
38433838 if ( darkModeToggle ) {
38443839 darkModeToggle . addEventListener ( 'click' , function ( ) {
@@ -3854,7 +3849,6 @@ <h3>Safety Levels</h3>
38543849 } ) ;
38553850 }
38563851
3857- // Highlight active navigation item based on scroll position
38583852 function setActiveNavItem ( ) {
38593853 const sections = document . querySelectorAll ( 'section[id]' ) ;
38603854 const navLinks = document . querySelectorAll ( '.nav-link' ) ;
@@ -3882,14 +3876,11 @@ <h3>Safety Levels</h3>
38823876
38833877< script >
38843878 document . addEventListener ( 'DOMContentLoaded' , function ( ) {
3885- // Get all buttons with class "header-button"
38863879 const headerButtons = document . querySelectorAll ( '.header-button' ) ;
38873880
3888- // More reliable selection by checking content
38893881 let downloadButton = null ;
38903882 let githubButton = null ;
38913883
3892- // Identify buttons by their content
38933884 headerButtons . forEach ( button => {
38943885 if ( button . textContent . includes ( 'Download' ) ) {
38953886 downloadButton = button ;
@@ -3898,27 +3889,29 @@ <h3>Safety Levels</h3>
38983889 }
38993890 } ) ;
39003891
3901- // Set GitHub repository URL
39023892 const githubRepoUrl = 'https://github.com/CPScript/SystemScript' ;
39033893
3904- // Set download URL for the latest release
39053894 const downloadUrl = 'https://cpscript.github.io/SystemScript/IDE_wiki.html' ;
39063895
3907- // Add click event listener for GitHub button
3908- if ( githubButton ) {
3909- githubButton . addEventListener ( 'click' , function ( ) {
3910- window . open ( githubRepoUrl , '_blank' ) ;
3911- console . log ( 'Opening GitHub repo:' , githubRepoUrl ) ;
3896+ if ( downloadButton ) {
3897+ downloadButton . addEventListener ( 'click' , function ( ) {
3898+ window . location . href = downloadUrl ;
3899+ console . log ( 'Switching page:' , downloadUrl ) ;
39123900 } ) ;
39133901 } else {
3914- console . error ( 'GitHub button not found' ) ;
3902+ console . error ( 'Download button not found' ) ;
39153903 }
3916-
3917- // Add click event listener for Dowanload button
3904+
39183905 if ( downloadButton ) {
39193906 downloadButton . addEventListener ( 'click' , function ( ) {
3920- window . open ( downloadUrl , '_blank' ) ;
3921- console . log ( 'Switching page:' , downloadUrl ) ;
3907+ const downloadLink = document . createElement ( 'a' ) ;
3908+ downloadLink . href = downloadUrl ;
3909+ downloadLink . download = 'ssIDE.zip' ;
3910+
3911+ document . body . appendChild ( downloadLink ) ;
3912+ downloadLink . click ( ) ;
3913+ document . body . removeChild ( downloadLink ) ;
3914+ console . log ( 'Downloading from:' , downloadUrl ) ;
39223915 } ) ;
39233916 } else {
39243917 console . error ( 'Download button not found' ) ;
0 commit comments