view static/javascript/download.js @ 298:dd116d3107d8

downloads: Downloads for Mercurial 1.4.2
author David Soria Parra <dsp@php.net>
date Tue, 05 Jan 2010 22:06:59 +0100
parents dd7fababf8b6
children
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) 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;
    }
}