annotate static/javascript/download.js @ 265:9e56363c57a5

Use mercurial.selenic.com instead of selenic.com/mercurial
author David Soria Parra <dsp@php.net>
date Fri, 16 Oct 2009 00:33:09 +0200
parents dd7fababf8b6
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
260
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
1 function Download() {
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
2 this.downloads = new Array();
255
4a52186008ee Add a first version of the sidebar
David Soria Parra <dsp@php.net>
parents:
diff changeset
3 }
4a52186008ee Add a first version of the sidebar
David Soria Parra <dsp@php.net>
parents:
diff changeset
4
260
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
5 Download.prototype = {
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
6
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
7 parse_os: function() {
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
8 var OSName="Source code";
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
9 if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
10 if (navigator.appVersion.indexOf("Mac")!=-1) OSName="Mac OS X";
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
11 if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
12 if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
13
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
14 return OSName;
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
15 },
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
16
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
17 os_detection: function() {
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
18 document.write(this.parse_os());
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
19 },
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
20
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
21 os_link: function() {
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
22 document.location.href = this.downloads[this.parse_os()];
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
23 },
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
24
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
25 register_download:function(type, url) {
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
26 this.downloads[type] = url;
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
27 }
dd7fababf8b6 Working version of the download button with simple OS detection
David Soria Parra <dsp@php.net>
parents: 255
diff changeset
28 }