|
From: Yoda-JM <yo...@us...> - 2010-12-07 00:34:01
|
Module: web
Branch: bluestyle
Commit: 4b681508e6cb599efd039feb3af29ea510aa17b6
Author: Vincent Le Ligeour <yo...@us...>
Date: Tue Dec 7 01:33:40 2010 +0100
Fixed OS detection
---
htdocs-binary/download.js | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/htdocs-binary/download.js b/htdocs-binary/download.js
index aa30eb2..089af4c 100644
--- a/htdocs-binary/download.js
+++ b/htdocs-binary/download.js
@@ -1,15 +1,21 @@
function smartDownload() {
var e = document.getElementById('download');
var agent = navigator.appVersion;
- if (agent.indexOf('Linux') != -1) return;
- if (agent.indexOf('Macintosh') != -1) {
+ if (navigator.platform.indexOf("Win32") != -1 || navigator.platform.indexOf("Win64") != -1) {
+ // Windows
+ e.href = 'http://sourceforge.net/projects/performous/files/performous/0.6.1/Performous-0.6.1.exe/download';
+ e.title = 'Performous 0.6.1 (Windows)';
+ return;
+ } else if (navigator.platform.indexOf("Linux") != -1) {
+ // Linux
+ return;
+ } else if (navigator.userAgent.indexOf("Mac OS X") != -1 || navigator.userAgent.indexOf("MSIE 5.2") != -1 || navigator.platform.indexOf("Mac") != -1) {
+ // Mac/Mac OS X
e.href = 'http://sourceforge.net/projects/performous/files/performous/0.5.0/Performous-0.5.0.dmg/download';
e.title = 'Performous 0.5.0 (OS X 10.5)';
return;
- }
- if (agent.indexOf('Windows') != -1) {
- e.href = 'http://sourceforge.net/projects/performous/files/performous/0.6.1/Performous-0.6.1.exe/download';
- e.title = 'Performous 0.6.1 (Windows)';
+ } else {
+ // Other
return;
}
}
|