changeset 313:1de4a7a49d94

Link to download page when javascript disabled or OS not detected. (issue2192)
author Laurens Holst <laurens.hg@grauw.nl>
date Sun, 16 May 2010 14:47:03 +0200
parents 91aa10eeb6f0
children 657b465caaa2
files static/js/download.js templates/base.html
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/static/js/download.js	Fri May 14 09:53:31 2010 +0200
+++ b/static/js/download.js	Sun May 16 14:47:03 2010 +0200
@@ -26,7 +26,12 @@
     },
 
     os_link: function() {
-        document.location.href = this.downloads[this.parse_os()];
+        var os = this.parse_os();
+        if (this.downloads[os]) {
+            document.location.href = this.downloads[os];
+            return false;
+        }
+        return true;
     },
 
     register_download:function(type, url) {
--- a/templates/base.html	Fri May 14 09:53:31 2010 +0200
+++ b/templates/base.html	Sun May 16 14:47:03 2010 +0200
@@ -58,7 +58,7 @@
                     </div>
                     <div class="col">
                         {% block sidebar %}
-                        <a class="download typeface-js" href="#" onClick="javascript:dl.os_link()">
+                        <a class="download typeface-js" href="/downloads" onClick="javascript:return dl.os_link();">
                                     <strong>Download now</strong>
                                     Mercurial <em>{{ downloads['current'] }}</em>
                                     <span><script language="javascript">dl.os_detection();</script></span>