You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by ma...@apache.org on 2013/10/03 00:26:29 UTC

svn commit: r1528657 - /openoffice/ooo-site/trunk/content/download/test/download.js

Author: marcus
Date: Wed Oct  2 22:26:28 2013
New Revision: 1528657

URL: http://svn.apache.org/r1528657
Log:
ECMAScript support: Emulate 'indexOf()' function as MSIE 8 and older do not have implemented this

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=1528657&r1=1528656&r2=1528657&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/download/test/download.js (original)
+++ openoffice/ooo-site/trunk/content/download/test/download.js Wed Oct  2 22:26:28 2013
@@ -204,6 +204,24 @@ function getPlatform() {
 	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
+	if ( !( 'indexOf' in Array.prototype ) ) {
+	  Array.prototype.indexOf= function( find, i /*opt*/ ) {
+	    if ( i === undefined )
+	      i = 0;
+	    if ( i < 0 )
+	      i+= this.length;
+	    if ( i < 0 )
+	      i = 0;
+	    for ( var n = this.length; i < n; i++ ) {
+	      if ( i in this && this[ i ] === find )
+		return i;
+	    }
+	    return -1;
+	  };
+	}
+
 	if ( os ) {
 
 	  // Recognized but not supported platforms / OS, set $UI_PLATFORM to show it to the user