diff static/js/download.js @ 303:59e0087c784a

Move javascript directory to js directory We have a nameclash on the server as a common javascript directory is mapped to /javascript. So that we do not clash we use our own one named js.
author David Soria Parra <dsp@php.net>
date Tue, 09 Mar 2010 02:24:24 +0100
parents static/javascript/download.js@dd7fababf8b6
children b7d326bc57f9
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/static/js/download.js	Tue Mar 09 02:24:24 2010 +0100
@@ -0,0 +1,28 @@
+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;
+    }
+}