Mercurial > hg-website
view static/js/download.js @ 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 | b7d326bc57f9 |
children | 657b465caaa2 |
line wrap: on
line source
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) { 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"; } } 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() { var os = this.parse_os(); if (this.downloads[os]) { document.location.href = this.downloads[os]; return false; } return true; }, register_download:function(type, url) { this.downloads[type] = url; } }