Skip to content

Commit 089b333

Browse files
committed
Automagically adjust the download link on Windows
When Javascript is enabled and we detect that we are running inside a 32-bit or 64-bit Windows browser, we can just as well adjust the download to avoid unnecessary clicks on the users' side. This closes git-for-windows/git#467 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent cca659c commit 089b333

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ <h3><span class="gittext">Git for Windows SDK</span> : Contributing Code</h3>
114114
$(".fancybox-thumb").fancybox({
115115
padding: 0
116116
});
117+
118+
/* Replace the download link if a Windows browser was detected */
119+
try {
120+
var agent = window.navigator.userAgent;
121+
var href = $('.version > a')[0].href.match(/^(.*\/)tag(\/.*)$/);
122+
var version = $('.version > a')[0].title.match(/^Version ([0-9.]*)/);
123+
if (!agent.match(/Windows/) || !href || !version)
124+
throw 0;
125+
var bitness = agent.match(/(WOW|Win)64/) ? '64' : '32';
126+
var url = href[1] + 'download' + href[2] + '/Git-' + version[1] + '-' + bitness + '-bit.exe';
127+
$('a.button:contains("Download")')[0].href = url;
128+
} catch(e) {}
117129
});
118130
</script>
119131
</body>

0 commit comments

Comments
 (0)