Author: marcus
Date: Mon Feb 10 21:43:18 2014
New Revision: 1566759
URL: http://svn.apache.org/r1566759
Log:
Code beautifying
Modified:
openoffice/ooo-site/trunk/content/download/test/download.js
Modified: openoffice/ooo-site/trunk/content/download/test/download.js
URL:
http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/download/test/download.js?rev=1566759&r1=1566758&r2=1566759&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download.js Mon Feb 10
21:43:18 2014
@@ -26,19 +26,12 @@ var CHECKSUM_KEYS = ""; // The
KEYS f
var CHECKSUM_ASC = ""; // The ASC file as
download URL
var CHECKSUM_MD5 = ""; // The MD5 file as
download URL
var CHECKSUM_SHA256 = ""; // The SHA256 file as
download URL
+var SOURCEFORGE = false; // The download
URL points to Soureforge
+var DL_OTHER = false; // The download URL
points to 'other.html'
+var ARCHIVE = false; // The download URL
points to the ASF archive
var ERROR = false; // The download URL is
correct (false) or not (true)?
/*
- * Initialize the download script and set all global variables with data
- */
-function initializeDL() {
- getLanguage();
- getPlatform();
- getFilesize();
- getLink();
-}
-
-/*
* Get array and ISO code for language
* Depends on $NL_LANGUAGE
*/
@@ -149,18 +142,20 @@ function getLink() {
// If platform is too old (e.g., Mac OS X 10.6 or older), then
do not provide a download link.
// But instead link to an AOO file in the archive.
if ( OLD_PLATFORM ) {
- LINK = "http://archive.apache.org/dist/openoffice/";
- ERROR = true;
+ LINK = "http://archive.apache.org/dist/openoffice/";
+ ARCHIVE = true;
+ ERROR = true;
return LINK;
}
if ( URL_PLATFORM == "" ) {
// If no platform was recognized, set the "other.html"
webpage as alternative download URL
- if ( UI_PLATFORM == "" ) {
- UI_PLATFORM = "an unknown platform/OS";
- }
- LINK = "http://www.openoffice.org/download/other.html";
- ERROR = true;
+ if ( UI_PLATFORM == "" )
+ UI_PLATFORM = "unknown platform/OS";
+
+ LINK =
"http://www.openoffice.org/download/other.html";
+ OTHER = true;
+ ERROR = true;
return LINK;
} else {
// If platform was recognized, get the download
filename and checksum filename
@@ -183,6 +178,7 @@ function getLink() {
CHECKSUM_ASC = chk_link + ".asc";
CHECKSUM_MD5 = chk_link + ".md5";
CHECKSUM_SHA256 = chk_link + ".sha256";
+ SOURCEFORGE = true;
}
return LINK;
@@ -192,6 +188,7 @@ function getLink() {
LINK = LINK + "/Apache_OpenOffice_" + "_" +
NL_LANGUAGE + EXTENSION;
chk_link = PEOPLE_BASE_URL + "/binaries/" + NL_LANGUAGE
+ "/Apache_OpenOffice_" + VERSION;
chk_link = chk_link + "_" + URL_PLATFORM + "_" +
NL_LANGUAGE + EXTENSION;
+ SOURCEFORGE = true;
return LINK;
*/
} else {
@@ -207,9 +204,9 @@ function getLink() {
function getPlatform() {
// For more help or data see: "http://www.useragentstring.com"
- var os = navigator.platform.toLowerCase();
- var ua = navigator.userAgent.toLowerCase();
- var av = navigator.appVersion.toLowerCase();
+ var os = navigator.platform.toLowerCase();
+ var ua = navigator.userAgent.toLowerCase();
+ var av = navigator.appVersion.toLowerCase();
// Add ECMA262-5 Array methods if not supported natively
// To workaround that MSIE 8 and older do not support this function
@@ -232,9 +229,6 @@ function getPlatform() {
if ( os ) {
// Recognized but not supported platforms / OS, set $UI_PLATFORM to
show it to the user
- if ( os.indexOf( "sunos" ) != -1 ) { UI_PLATFORM
= "Solaris x86 (PKG)";
- if ( ua.indexOf( "sun4u" ) != -1 ) UI_PLATFORM
= "Solaris SPARC (PKG)";
- }
if ( os.indexOf( "os/2" ) != -1 ) UI_PLATFORM
= "OS/2";
if ( os.indexOf( "freebsd" ) != -1 ) UI_PLATFORM
= "FreeBSD (PKG)";
if ( os.indexOf( "openbsd" ) != -1 ) UI_PLATFORM
= "OpenBSD";
@@ -248,12 +242,16 @@ function getPlatform() {
if ( os.indexOf( "vms" ) != -1 ) UI_PLATFORM
= "OpenVMS";
if ( os.indexOf( "alphaserver" ) != -1 ) UI_PLATFORM
= "AlphaServer";
if ( os.indexOf( "qnx" ) != -1 ) UI_PLATFORM
= "QNX";
- if ( os.indexOf( "x11" ) != -1 ) UI_PLATFORM
= "an unknown OS (X11 support)";
-
+ if ( os.indexOf( "x11" ) != -1 ) UI_PLATFORM
= "unknown OS (X11 support)";
if ( os.indexOf( "arm" ) != -1 ) UI_PLATFORM
= "ARM mobile devices";
-
+ if ( os.indexOf( "sunos" ) != -1 ) UI_PLATFORM
= "Solaris x86 (PKG)";
+ if ( ua.indexOf( "sun4u" ) != -1 ) { UI_PLATFORM
= "Solaris SPARC (PKG)";
+ OLD_PLATFORM
= true;
+ }
if ( ua.indexOf( "ppc" ) != -1 ||
- ua.indexOf( "power_pc" ) != -1 ) UI_PLATFORM
= "Mac OS PPC (DMG)";
+ ua.indexOf( "power_pc" ) != -1 ) { UI_PLATFORM
= "Mac OS PPC (DMG)";
+ OLD_PLATFORM
= true;
+ }
if ( ua.indexOf( "iphone" ) != -1 ||
ua.indexOf( "ipad" ) != -1 ||
ua.indexOf( "ipod" ) != -1 ) UI_PLATFORM
= "Apple iPhone/iPad/iPod";
@@ -272,16 +270,14 @@ function getPlatform() {
if ( ua.indexOf( "widerweb" ) != -1 ) UI_PLATFORM
= "mobile phones (WiderWeb)";
if ( ua.indexOf( "brew" ) != -1 ) UI_PLATFORM
= "smartphones (BREW)";
if ( ua.indexOf( "hiptop" ) != -1 ) UI_PLATFORM
= "smartphones (Hiptop)";
-
if ( ua.indexOf( "playstation" ) != -1 ) UI_PLATFORM
= "Sony Playstation";
if ( ua.indexOf( "psp" ) != -1 ) UI_PLATFORM
= "Sony Playstation Portable";
if ( ua.indexOf( "nintendo" ) != -1 ) UI_PLATFORM
= "Nintendo game console";
if ( ua.indexOf( "wii" ) != -1 ) UI_PLATFORM
= "Nintendo Wii game console";
// If the $UI_PLATFORM variable is already filled, then something was
recognized and no more work is need
- if ( UI_PLATFORM ) {
+ if ( UI_PLATFORM != "" )
return;
- }
// Windows, x86 or mobile?
if ( os.indexOf( "windows" ) != -1 ||
@@ -344,9 +340,9 @@ function getPlatform() {
}
// If nothing was recognized until now, set $UI_PLATFORM to show it to
the user
- if ( ! UI_PLATFORM ) {
- ERROR = true;
- UI_PLATFORM = "an unknown platform/OS";
+ if ( UI_PLATFORM == "" ) {
+ UI_PLATFORM = "unknown platform/OS";
+ ERROR = true;
}
return;
}
@@ -383,13 +379,13 @@ function getFilesize() {
// If a platform was found and no error occurred, assign the array data
and filesize from the release matrix
if ( RELEASE_MATRIX_PLATFORM_POS > -1 && !ERROR ) {
// Assign all values from the release matrix of language and
platform
- RELEASE_MATRIX_PLATFORM = release_matrix[ LANG_ISO ][
RELEASE_MATRIX_PLATFORM_POS ];
+ RELEASE_MATRIX_PLATFORM = release_matrix[ LANG_ISO ][
RELEASE_MATRIX_PLATFORM_POS ];
// Assign the file size (column 2) from the release matrix of
language and platform
- FILESIZE = release_matrix[ LANG_ISO ][
RELEASE_MATRIX_PLATFORM_POS ][ 2 ];
+ FILESIZE = release_matrix[ LANG_ISO ][
RELEASE_MATRIX_PLATFORM_POS ][ 2 ];
} else {
- ERROR = true;
- FILESIZE = 0;
+ ERROR = true;
+ FILESIZE = 0;
}
return FILESIZE;