From 5f163d279cd2038de213e13919bdb51788b71ed7 Mon Sep 17 00:00:00 2001 From: Coia Prant Date: Fri, 30 May 2025 22:46:00 +0800 Subject: [PATCH 1/2] Fix download button href replace jQuery was dropped. Link: https://github.com/git-for-windows/git-for-windows.github.io/pull/62 Replace download button href replace to `getElementById` Signed-off-by: Coia Prant --- layouts/_default/baseof.html | 2 +- layouts/partials/header.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 234c0b80..943c25c4 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -45,7 +45,7 @@ var architecture = browser.architecture == "arm" ? "arm64" : "64-bit"; var url = href[1] + 'download' + href[2] + '/Git-' + version[1] + '-' + architecture + '.exe'; - $('a.button:contains("Download")')[0].href = url; + document.getElementById("download").href = url; }) } catch(e) {} {{ end -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index f78680b7..c26b33f5 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -17,7 +17,7 @@

We bring the awesome Git SCM to Windows

- Download + Download Contribute
From bbbcf70225879d97abdaae412e434e876181c5e1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 2 Jun 2025 11:02:36 +0200 Subject: [PATCH 2/2] Really avoid any jQuery construct In https://github.com/git-for-windows/git-for-windows.github.io/pull/76, I merged a contribution that purported to fix the problem that the download button no longer pointed to the appropriate installer. The underlying root cause is that that logic relied on jQuery, but we recently got rid of it (because our copy was ridiculously outdated). The problem with that PR is that it had an incomplete solution, still leaving `$(...)` calls in place. This here commit fixes that. Signed-off-by: Johannes Schindelin --- layouts/_default/baseof.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 943c25c4..472ef96e 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -34,8 +34,9 @@ {{ if eq "home" .Kind -}} /* Replace the download link if a Windows browser was detected */ try { - var href = $('.version > a')[0].href.match(/^(.*\/)tag(\/.*)$/); - var version = $('.version > a')[0].title.match(/^Version ([0-9.]*)(\(([0-9]*)?\))?/); + var a = document.querySelector('.version > a') + var href = a?.href.match(/^(.*\/)tag(\/.*)$/); + var version = a?.title.match(/^Version ([0-9.]*)(\(([0-9]*)?\))?/); if (!href || !version || !navigator.userAgentData) throw 0;