Mercurial > hg-website
changeset 353:a6c7665d9f67
Merge
author | David Soria Parra <dsp@php.net> |
---|---|
date | Mon, 22 Nov 2010 20:10:42 +0100 |
parents | c3b461c0b97f (current diff) 987caba84824 (diff) |
children | 3e0b0dc69adf |
files | .hgsubstate |
diffstat | 4 files changed, 75 insertions(+), 46 deletions(-) [+] |
line wrap: on
line diff
--- a/static/css/styles.css Mon Nov 22 20:10:34 2010 +0100 +++ b/static/css/styles.css Mon Nov 22 20:10:42 2010 +0100 @@ -43,6 +43,7 @@ dt { font-weight: bold; margin-top: 10px; } dt em { font-style: normal; display: block; font-weight: normal; } +dd em { font-style: normal; font-weight: bolder; } dd { background: url(../images/bullet.gif) no-repeat 10px .5em; padding-left: 20px; } /* @@ -65,6 +66,7 @@ .latest thead td, .latest thead th { background: #00B5F1; color: #fff; font-weight: bold; } thead td, thead th { background: #999; color: #fff; font-weight: bold; } tbody td { border-bottom: 1px solid #ccc; } +tbody td em { font-style: normal; font-weight: bolder; } /* * Quotes
--- a/static/js/download.js Mon Nov 22 20:10:34 2010 +0100 +++ b/static/js/download.js Mon Nov 22 20:10:42 2010 +0100 @@ -1,40 +1,74 @@ -function Download() { - this.downloads = {}; +function Download (source) { + this.version = source[0]; + this.regex = source[1]; + this.url = source[2]; + this.desc = source[3]; } Download.prototype = { + matches: function (ua) { + if (ua.match(this.regex)) + return true; + return false; + }, - parse_os: function() { - var OSName="Source code"; - if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows"; - if (navigator.appVersion.indexOf("Mac")!=-1) { - if (navigator.userAgent.indexOf("10.6")!=-1 || /* firefox */ - navigator.userAgent.indexOf("10_6") !=-1) { /* chrome */ - OSName="Mac OS X 10.6"; - } else { - OSName="Mac OS X 10.5"; - } + download: function () { + document.location.href = this.url; + return false; + }, + + attr: function (key) { + return this[key]; + }, + + write: function (key) { + document.write(this[key]); + } +} + + +var Downloader = { + downloads: [], + + init: function (sources) { + for (i in sources) { + var source = new Download(sources[i]); + this.downloads.push(source); } - 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()); + select: function () { + var ua = navigator.userAgent; + for (i in this.downloads) { + if (this.downloads[i].matches(ua)) { + return this.downloads[i]; + } + } + return null; }, - os_link: function() { - var os = this.parse_os(); - if (this.downloads[os]) { - document.location.href = this.downloads[os]; - return false; + listall: function () { + // copy the download list + var downloads = this.downloads.slice(0); + // alpha-sort it by description (case-folded) + downloads.sort(function (a, b) { + a = a.desc.toLowerCase(); + b = b.desc.toLowerCase(); + return (b < a) - (a < b); + }); + + var desc; + for (i in downloads) { + var dl = downloads[i]; + var ua = navigator.userAgent; + if (dl.matches(ua)) + desc = '<em>' + dl.desc + '</em>'; + else + desc = dl.desc; + document.write('<tr>\n<td>' + desc + '</td>' + + '<td></td>' + + '<td><a href="' + dl.url + '">download</a></td>' + + '</tr>'); } - return true; - }, - - register_download:function(type, url) { - this.downloads[type] = url; } -} +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/static/manual.dat Mon Nov 22 20:10:42 2010 +0100 @@ -0,0 +1,2 @@ +10 1.7.1 .*Macintosh.*10.6.* http://mercurial.berkwood.com/binaries/Mercurial-1.7.1-py2.6-macosx10.6.zip Mercurial 1.7.1 for MacOS X 10.6 +10 1.7.1 .*Macintosh.*10.5.* http://mercurial.berkwood.com/binaries/Mercurial-1.7.1-py2.5-macosx10.5.zip Mercurial 1.7.1 for MacOS X 10.5
--- a/templates/base.html Mon Nov 22 20:10:34 2010 +0100 +++ b/templates/base.html Mon Nov 22 20:10:42 2010 +0100 @@ -1,5 +1,3 @@ -{% from 'data' import downloads %} - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> @@ -8,16 +6,12 @@ <link href="/css/styles.css" type="text/css" rel="stylesheet"> <script type="text/javascript" src="/js/typeface.js"></script> <script type="text/javascript" src="/js/optimer_regular.typeface.js"></script> + <script type="text/javascript" src="/js/common.js"></script> + <script type="text/javascript" src="/sources.js"></script> <script type="text/javascript" src="/js/download.js"></script> - <script type="text/javascript" src="/js/common.js"></script> - <script language="javascript" type="text/javascript"> - {% set download = downloads[downloads['current']] %} - var dl = new Download(); - dl.register_download('Windows', "{{ download['Windows']}}"); - dl.register_download('Mac OS X 10.6', "{{ download['Mac OS X 10.6']}}"); - dl.register_download('Mac OS X 10.5', "{{ download['Mac OS X 10.5']}}"); - dl.register_download('UNIX', "{{ download['Source code']}}"); - dl.register_download('Linux', "{{ download['Source code']}}"); + <script language="javascript"> + Downloader.init(sources); + var dl = Downloader.select(); </script> <link rel="shortcut icon" type="image/x-icon" href="/images/favicon.ico"> @@ -58,19 +52,16 @@ </div> <div class="col"> {% block sidebar %} - <a class="download typeface-js" href="/downloads" onClick="javascript:return dl.os_link();"> + <a class="download typeface-js" href="/downloads" onClick="return dl.download();"> <strong>Download now</strong> - Mercurial <em>{{ downloads['current'] }}</em> - <span><script language="javascript">dl.os_detection();</script></span> + Mercurial <em><script language="Javascript">dl.write('version');</script></em> + <span><script language="javascript">dl.write('desc');</script></span> </a> <dl> <dt>Another OS?<br><em>Get Mercurial for:</em></dt> <dd><a href="/downloads">Mac OS X</a></dd> <dd><a href="/downloads">Windows</a></dd> <dd><a href="/downloads">other</a></dd> - - <dt>Requirements</dt> - <dd><a href="http://www.python.org">Python 2.4</a> (already included in binary packages)</dd> </dl> {% endblock %} </div>