33 .download-hero
44 .version-info
55 .version-number #{version}
6- .release-date #{assets .windows .releaseDate }
6+ .release-date #{assets .windows .x64 . releaseDate || assets . windows . arm64 . releaseDate }
77
88 // Auto-detect OS and show primary download button
99 .primary-download
3636 return ' x64' ;
3737 }
3838
39+ function detectWindowsArchitecture () {
40+ // Check for ARM64 support in Windows
41+ if (navigator .userAgent .includes (' ARM64' ) || navigator .userAgent .includes (' WOW64; ARM64' )) {
42+ return ' arm64' ;
43+ }
44+ return ' x64' ; // Default to x64
45+ }
46+
3947 function getRecommendedDownload (os ) {
4048 const downloads = {
4149 windows: {
42- name: ' Windows 10/11 x64' ,
43- items: ! {JSON .stringify (assets .windows .items )}
50+ x64: {
51+ name: ' Windows x64' ,
52+ items: ! {JSON .stringify (assets .windows .x64 .items )}
53+ },
54+ arm64: {
55+ name: ' Windows ARM64' ,
56+ items: ! {JSON .stringify (assets .windows .arm64 .items )}
57+ }
4458 },
4559 mac: {
4660 name: ' Mac OS' ,
5266 }
5367 };
5468
55- const osData = downloads[os];
56- if (osData && osData .items .length > 0 ) {
57- let recommended;
58-
59- if (os === ' mac' ) {
60- const arch = detectMacArchitecture ();
61- // Try to find the appropriate Mac version
62- recommended = osData .items .find (item => {
63- if (arch === ' arm64' ) {
64- return item .name .includes (' arm64' ) || item .name .includes (' apple-silicon' );
65- } else {
66- return item .name .includes (' x64' ) || item .name .includes (' intel' ) ||
67- (! item .name .includes (' arm64' ) && item .name .includes (' .dmg' ));
68- }
69- });
70- } else {
71- // For Windows and Linux, get the most appropriate download
72- recommended = osData .items .find (item =>
73- item .name .includes (' Setup' ) ||
74- item .name .includes (' .exe' ) ||
75- item .name .includes (' .dmg' ) ||
76- item .name .includes (' .deb' )
77- );
69+ if (os === ' windows' ) {
70+ const arch = detectWindowsArchitecture ();
71+ const osData = downloads .windows [arch];
72+ if (osData && osData .items .length > 0 ) {
73+ // For Windows, prioritize installer .exe files
74+ let recommended = osData .items .find (item =>
75+ item .name .includes (' installer' ) && item .name .endsWith (' .exe' )
76+ ) || osData .items .find (item =>
77+ item .name .endsWith (' .exe' )
78+ ) || osData .items [0 ];
79+
80+ return {
81+ osName: ` ${ osData .name } ` ,
82+ download: recommended
83+ };
84+ }
85+ // Fallback to x64 if ARM64 not available
86+ if (arch === ' arm64' && downloads .windows .x64 .items .length > 0 ) {
87+ const osData = downloads .windows .x64 ;
88+ let recommended = osData .items .find (item =>
89+ item .name .includes (' installer' ) && item .name .endsWith (' .exe' )
90+ ) || osData .items .find (item =>
91+ item .name .endsWith (' .exe' )
92+ ) || osData .items [0 ];
93+
94+ return {
95+ osName: ` ${ osData .name } (ARM64 version not available)` ,
96+ download: recommended
97+ };
98+ }
99+ } else {
100+ const osData = downloads[os];
101+ if (osData && osData .items .length > 0 ) {
102+ let recommended;
103+
104+ if (os === ' mac' ) {
105+ const arch = detectMacArchitecture ();
106+ // Try to find the appropriate Mac version
107+ recommended = osData .items .find (item => {
108+ if (arch === ' arm64' ) {
109+ return item .name .includes (' arm64' ) || item .name .includes (' apple-silicon' );
110+ } else {
111+ return item .name .includes (' x64' ) || item .name .includes (' intel' ) ||
112+ (! item .name .includes (' arm64' ) && item .name .includes (' .dmg' ));
113+ }
114+ });
115+ } else {
116+ // For Linux, get the most appropriate download
117+ recommended = osData .items .find (item =>
118+ item .name .includes (' .deb' ) ||
119+ item .name .includes (' .AppImage' )
120+ );
121+ }
122+
123+ // Fallback to first item if no specific match
124+ recommended = recommended || osData .items [0 ];
125+
126+ return {
127+ osName: osData .name + (os === ' mac' ? ` (${ detectMacArchitecture ()} )` : ' ' ),
128+ download: recommended
129+ };
78130 }
79-
80- // Fallback to first item if no specific match
81- recommended = recommended || osData .items [0 ];
82-
83- return {
84- osName: osData .name + (os === ' mac' ? ` (${ detectMacArchitecture ()} )` : ' ' ),
85- download: recommended
86- };
87131 }
88132 return null ;
89133 }
131175
132176 .tab-content
133177 .tab-panel.active ( data-tab ="windows" )
134- .os-downloads
135- h3 #{assets .windows .name }
136- .download-grid
137- - for (let obj of assets .windows .items )
138- .download-item
139- .download-info
140- .download-name
141- - if (obj .tag )
142- span.tag [#{obj .tag } ]
143- span.name #{obj .name }
144- - if (obj .desc )
145- .download-desc #{obj .desc }
146- .download-links
147- a.download-link.primary ( href =obj .browser_download_url ) GitHub
148- a.download-link ( href =obj .sourceforgeUrl ) SourceForge
149- a.download-link ( href ='https://gh-proxy.com/' + obj .browser_download_url ) gh-proxy.com
178+ .arch-tabs
179+ .arch-tab-buttons
180+ button.arch-tab-btn.active ( data-arch ="x64" ) x64
181+ button.arch-tab-btn ( data-arch ="arm64" ) ARM64
182+ - if (assets .windows .win7 && assets .windows .win7 .items .length > 0 )
183+ button.arch-tab-btn ( data-arch ="win7" ) Windows 7
184+
185+ .arch-tab-content
186+ .arch-tab-panel.active ( data-arch ="x64" )
187+ .os-downloads
188+ h3 #{assets .windows .x64 .name }
189+ .download-grid
190+ - for (let obj of assets .windows .x64 .items )
191+ .download-item
192+ .download-info
193+ .download-name
194+ - if (obj .tag )
195+ span.tag [#{obj .tag } ]
196+ span.name #{obj .name }
197+ - if (obj .desc )
198+ .download-desc #{obj .desc }
199+ .download-links
200+ a.download-link.primary ( href =obj .browser_download_url ) GitHub
201+ a.download-link ( href =obj .sourceforgeUrl ) SourceForge
202+ a.download-link ( href ='https://gh-proxy.com/' + obj .browser_download_url ) gh-proxy.com
203+
204+ .arch-tab-panel ( data-arch ="arm64" )
205+ .os-downloads
206+ h3 #{assets .windows .arm64 .name }
207+ .download-grid
208+ - for (let obj of assets .windows .arm64 .items )
209+ .download-item
210+ .download-info
211+ .download-name
212+ - if (obj .tag )
213+ span.tag [#{obj .tag } ]
214+ span.name #{obj .name }
215+ - if (obj .desc )
216+ .download-desc #{obj .desc }
217+ .download-links
218+ a.download-link.primary ( href =obj .browser_download_url ) GitHub
219+ a.download-link ( href =obj .sourceforgeUrl ) SourceForge
220+ a.download-link ( href ='https://gh-proxy.com/' + obj .browser_download_url ) gh-proxy.com
221+
222+ - if (assets .windows .win7 && assets .windows .win7 .items .length > 0 )
223+ .arch-tab-panel ( data-arch ="win7" )
224+ .os-downloads
225+ h3 #{assets .windows .win7 .name }
226+ .download-grid
227+ - for (let obj of assets .windows .win7 .items )
228+ .download-item
229+ .download-info
230+ .download-name
231+ - if (obj .tag )
232+ span.tag [#{obj .tag } ]
233+ span.name #{obj .name }
234+ - if (obj .desc )
235+ .download-desc #{obj .desc }
236+ .download-links
237+ a.download-link.primary ( href =obj .browser_download_url ) GitHub
238+ a.download-link ( href =obj .sourceforgeUrl ) SourceForge
239+ a.download-link ( href ='https://gh-proxy.com/' + obj .browser_download_url ) gh-proxy.com
150240
151241 .tab-panel ( data-tab ="mac" )
152242 .os-downloads
167257 a.download-link ( href ='https://gh-proxy.com/' + obj .browser_download_url ) gh-proxy.com
168258
169259 .tab-panel ( data-tab ="linux" )
170- .linux- arch-tabs
260+ .arch-tabs
171261 .arch-tab-buttons
172262 button.arch-tab-btn.active ( data-arch ="x86_64" ) x86_64
173263 button.arch-tab-btn ( data-arch ="x86_64_legacy" ) x86_64 Legacy
@@ -329,26 +419,48 @@ script.
329419 });
330420 });
331421
332- // Linux architecture sub-tabs functionality
333- const archTabButtons = document .querySelectorAll (' .arch-tab-btn' );
334- const archTabPanels = document .querySelectorAll (' .arch-tab-panel' );
422+ // Architecture sub-tabs functionality (unified for both Linux and Windows)
423+ function initArchitectureTabs (tabContainer ) {
424+ const archTabButtons = tabContainer .querySelectorAll (' .arch-tab-btn' );
425+ const archTabPanels = tabContainer .querySelectorAll (' .arch-tab-panel' );
335426
336- function activateArchTab (archName ) {
337- archTabButtons .forEach (btn => {
338- const isTarget = btn .getAttribute (' data-arch' ) === archName;
339- btn .classList .toggle (' active' , isTarget);
340- });
341- archTabPanels .forEach (panel => {
342- const isTarget = panel .getAttribute (' data-arch' ) === archName;
343- panel .classList .toggle (' active' , isTarget);
427+ function activateArchTab (archName ) {
428+ archTabButtons .forEach (btn => {
429+ const isTarget = btn .getAttribute (' data-arch' ) === archName;
430+ btn .classList .toggle (' active' , isTarget);
431+ });
432+ archTabPanels .forEach (panel => {
433+ const isTarget = panel .getAttribute (' data-arch' ) === archName;
434+ panel .classList .toggle (' active' , isTarget);
435+ });
436+ }
437+
438+ // Set default architecture
439+ if (tabContainer .closest (' [data-tab="windows"]' )) {
440+ // For Windows, detect architecture
441+ try {
442+ const windowsArch = typeof detectWindowsArchitecture === ' function' ? detectWindowsArchitecture () : ' x64' ;
443+ activateArchTab (windowsArch);
444+ } catch (e) {
445+ activateArchTab (' x64' );
446+ }
447+ } else if (tabContainer .closest (' [data-tab="linux"]' )) {
448+ // For Linux, default to x86_64
449+ activateArchTab (' x86_64' );
450+ }
451+
452+ archTabButtons .forEach (button => {
453+ button .addEventListener (' click' , function () {
454+ const targetArch = this .getAttribute (' data-arch' );
455+ activateArchTab (targetArch);
456+ });
344457 });
345458 }
346459
347- archTabButtons .forEach (button => {
348- button .addEventListener (' click' , function () {
349- const targetArch = this .getAttribute (' data-arch' );
350- activateArchTab (targetArch);
351- });
460+ // Initialize architecture tabs for both Windows and Linux
461+ const archTabContainers = document .querySelectorAll (' .arch-tabs' );
462+ archTabContainers .forEach (container => {
463+ initArchitectureTabs (container);
352464 });
353465 });
354466
@@ -358,9 +470,10 @@ script.
358470 .changelog-content
359471 .changelog-version
360472 b #{version}
361- small.release-date #{assets .windows .releaseDate }
473+ small.release-date #{assets .windows .x64 . releaseDate || assets . windows . arm64 . releaseDate }
362474 .changelog-notes
363- - let rns = assets .windows .releaseNote .split (' \r\n ' ).filter (d => d .trim ())
475+ - let releaseNote = assets .windows .x64 .releaseNote || assets .windows .arm64 .releaseNote || ' '
476+ - let rns = releaseNote .split (' \r\n ' ).filter (d => d .trim ())
364477 - for (let rn of rns) {
365478 - if (rn .startsWith (' ---' )) {
366479 .changelog-separator #{rn}
0 commit comments