# HG changeset patch # User David Soria Parra # Date 1254625408 -7200 # Node ID dd7fababf8b6835c1222520a0546188e43dd40d2 # Parent b18d0f96829dfc682810bcf83ac9c40b99c60f1e Working version of the download button with simple OS detection diff -r b18d0f96829d -r dd7fababf8b6 .hgsubstate --- a/.hgsubstate Sun Oct 04 04:21:47 2009 +0200 +++ b/.hgsubstate Sun Oct 04 05:03:28 2009 +0200 @@ -1,1 +1,1 @@ -6293e2d423105e6abe6a21f81d3ab67616ea2096 content +a65bad2173f210d817556679c0dfc8ae93c95f66 content diff -r b18d0f96829d -r dd7fababf8b6 static/javascript/download.js --- a/static/javascript/download.js Sun Oct 04 04:21:47 2009 +0200 +++ b/static/javascript/download.js Sun Oct 04 05:03:28 2009 +0200 @@ -1,10 +1,28 @@ -function os_detection() { - var OSName="Source"; - if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows"; - if (navigator.appVersion.indexOf("Mac")!=-1) OSName="Mac OS X"; - if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX"; - if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux"; - - document.write(OSName); +function Download() { + this.downloads = new Array(); } +Download.prototype = { + + parse_os: function() { + var OSName="Source code"; + if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows"; + if (navigator.appVersion.indexOf("Mac")!=-1) OSName="Mac OS X"; + if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX"; + if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux"; + + return OSName; + }, + + os_detection: function() { + document.write(this.parse_os()); + }, + + os_link: function() { + document.location.href = this.downloads[this.parse_os()]; + }, + + register_download:function(type, url) { + this.downloads[type] = url; + } +} diff -r b18d0f96829d -r dd7fababf8b6 templates/base.html --- a/templates/base.html Sun Oct 04 04:21:47 2009 +0200 +++ b/templates/base.html Sun Oct 04 05:03:28 2009 +0200 @@ -9,6 +9,14 @@ + Mercurial SCM @@ -47,10 +55,10 @@
{% block sidebar %} - + Download now Mercurial 1.3.1 - +
Requirements
diff -r b18d0f96829d -r dd7fababf8b6 templates/data --- a/templates/data Sun Oct 04 04:21:47 2009 +0200 +++ b/templates/data Sun Oct 04 05:03:28 2009 +0200 @@ -1,1 +1,9 @@ -{% set downloads = {'1.3.1': {'windows': 'linkwin', 'os.x': 'linkosx'}} %} \ No newline at end of file +{% set downloads = { + 'current': '1.3.1', + '1.3.1': { + 'Windows (Tortoise HG)': 'http://bitbucket.org/tortoisehg/stable/downloads/TortoiseHg-0.8.1-hg-1.3.1.exe', + 'Windows': 'http://mercurial.berkwood.com/binaries/Mercurial-1.3.1.exe', + 'Mac OS X 10.6': 'http://mercurial.berkwood.com/binaries/Mercurial-1.3.1-py2.6-macosx10.6.zip', + 'Mac OS X 10.5': 'http://mercurial.berkwood.com/binaries/Mercurial-1.3.1-py2.5-macosx10.5.zip', + 'Source code': 'http://www.selenic.com/mercurial/release/mercurial-1.3.1.tar.gz'}} +%} diff -r b18d0f96829d -r dd7fababf8b6 templates/frontpage.html --- a/templates/frontpage.html Sun Oct 04 04:21:47 2009 +0200 +++ b/templates/frontpage.html Sun Oct 04 05:03:28 2009 +0200 @@ -36,17 +36,6 @@
-

Download

- {% for version in downloads %} -

{{ version }}

- - - {% endfor %} -

Quick Start

Clone a project and create a patch