From a29e96e3bfc4dafdcda1d4910f88807048169feb Mon Sep 17 00:00:00 2001 From: Andrew Gerrand Date: Wed, 5 Aug 2015 15:31:48 +1000 Subject: [PATCH] godoc/static: redirect to download from installation instructions page Change-Id: If29d04ced7404d6ba8761f734b4a16fe96959635 Reviewed-on: https://go-review.googlesource.com/13200 Reviewed-by: Chris Broadfoot --- godoc/static/godocs.js | 12 +++++++++++- godoc/static/static.go | 19 ++++++++++++++++++- godoc/static/style.css | 7 +++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/godoc/static/godocs.js b/godoc/static/godocs.js index eee508d521..997616c45b 100644 --- a/godoc/static/godocs.js +++ b/godoc/static/godocs.js @@ -254,7 +254,7 @@ function personalizeInstallInstructions() { } var filename = s.substr(prefix.length); - var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)-([a-z0-9]+)\.(.+)$/ + var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9-.]+)?\.([a-z.]+)$/; $('.downloadFilename').text(filename); $('.hideFromDownload').hide(); var m = filenameRE.exec(filename); @@ -281,6 +281,16 @@ function personalizeInstallInstructions() { $('#windowsZipInstructions').hide(); } } + + var download = "https://storage.googleapis.com/golang/" + filename; + + var message = $('

'+ + 'Your download should begin shortly. '+ + 'If it does not, click this link.

'); + message.find('a').attr('href', download); + message.insertAfter('#nav'); + + window.location = download; } $(document).ready(function() { diff --git a/godoc/static/static.go b/godoc/static/static.go index 49d54204f7..a4b3451286 100644 --- a/godoc/static/static.go +++ b/godoc/static/static.go @@ -819,7 +819,7 @@ function personalizeInstallInstructions() { } var filename = s.substr(prefix.length); - var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)-([a-z0-9]+)\.(.+)$/ + var filenameRE = /^go1\.\d+(\.\d+)?([a-z0-9]+)?\.([a-z0-9]+)(-[a-z0-9-.]+)?\.([a-z.]+)$/; $('.downloadFilename').text(filename); $('.hideFromDownload').hide(); var m = filenameRE.exec(filename); @@ -846,6 +846,16 @@ function personalizeInstallInstructions() { $('#windowsZipInstructions').hide(); } } + + var download = "https://storage.googleapis.com/golang/" + filename; + + var message = $('

'+ + 'Your download should begin shortly. '+ + 'If it does not, click this link.

'); + message.find('a').attr('href', download); + message.insertAfter('#nav'); + + window.location = download; } $(document).ready(function() { @@ -3399,6 +3409,13 @@ a.error { display: none; } +.downloading { + background: #F9F9BE; + padding: 10px; + text-align: center; + border-radius: 5px; +} + @media (max-width: 930px) { #heading-wide { display: none; diff --git a/godoc/static/style.css b/godoc/static/style.css index 241fa90333..4d2b07a78d 100644 --- a/godoc/static/style.css +++ b/godoc/static/style.css @@ -643,6 +643,13 @@ a.error { display: none; } +.downloading { + background: #F9F9BE; + padding: 10px; + text-align: center; + border-radius: 5px; +} + @media (max-width: 930px) { #heading-wide { display: none;