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 2014/11/21 22:54:24 UTC

svn commit: r1641006 - /openoffice/ooo-site/trunk/content/scripts/ooo.js

Author: marcus
Date: Fri Nov 21 21:54:23 2014
New Revision: 1641006

URL: http://svn.apache.org/r1641006
Log:
Changed JS code to use customized values for height and width of the graphic in the event box

Modified:
    openoffice/ooo-site/trunk/content/scripts/ooo.js

Modified: openoffice/ooo-site/trunk/content/scripts/ooo.js
URL: http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/scripts/ooo.js?rev=1641006&r1=1641005&r2=1641006&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/scripts/ooo.js (original)
+++ openoffice/ooo-site/trunk/content/scripts/ooo.js Fri Nov 21 21:54:23 2014
@@ -1,10 +1,12 @@
 /*
  * Overview of all methods (functions) of the global object "INDEX"
  * ----------------------------------------------------------------
- * function INDEX.follow       ( platform )
- * function INDEX.showEventBox ()
- * function INDEX.showAlertBox ()
- * function INDEX.setRedirect  ()
+ * function INDEX.createIndexOf	()
+ * function INDEX.getURLQuery	()
+ * function INDEX.follow	( platform )
+ * function INDEX.showEventBox	()
+ * function INDEX.showAlertBox	()
+ * function INDEX.setRedirect 	()
  */
 
 
@@ -13,6 +15,84 @@
 var INDEX = new Object();
 
 /*
+ * Create the "indexOf" function when the browser does not support it
+ * @param:  None
+ * @return: i - The value from the index position of the array
+ */
+INDEX.createIndexOf = function() {
+	// 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 ) {		// 'i' is an optional parameter.
+			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;
+		};
+	}
+}
+
+/*
+ * Get the value from an browser URL query
+ * @param:  None
+ * @return: q_value - The value from the browser URL query
+ */
+INDEX.getURLQuery = function() {
+	// Parse the URL for a query if it contains a value that should be used as an language ISO code.
+
+	// Does the browser URL contain a query with "?" and "=" characters at all?
+	if( decodeURI( window.location ).indexOf( "?" ) == -1 &&
+	    decodeURI( window.location ).indexOf( "=" ) == -1 ) {
+		// If not return an empty string and exit.
+		return "";
+	}
+
+	// Create the "indexOf" function when the browser does not support it.
+	INDEX.createIndexOf();
+
+	var query		= new Object();
+	var q_pair		= window.location.search.substring( 1 ).split( "?" );
+	var position		= 0;
+	var q_name, q_value	= "";
+
+ 	for ( var i = 0; i < q_pair.length; i++ ) {
+		// Assign the position of the "=" character, so where the name ends and the value starts.
+ 		position = q_pair[ i ].indexOf( "=" );
+
+		// If the position is not found (-1) then just go on.
+		if ( position === -1 ) {
+			continue;
+		}
+
+		// Assign the name of the query pair.
+		q_name		= q_pair[ i ].substring( 0, position );
+		// Assign the value of the query pair.
+		q_value		= q_pair[ i ].substring( position + 1 );
+		query[ q_name ]	= decodeURI( q_value );
+	}
+/*
+	alert( ""
+	+ "Query pair: "  + "\t" + q_pair  + "\n"
+	+ "Query name: "  + "\t" + q_name  + "\n"
+	+ "Query value: " + "\t" + q_value + "\n"
+	+ "" );
+*/
+	// Return the query value.
+	return q_value;
+}
+
+/*
  * Link AOO to a social media
  * @param:  platform - The social media (Apache Blog, Facebook, Twitter, Google+) that the scriping should link to
  * @return: None
@@ -53,7 +133,9 @@ INDEX.showEventBox = function() {
 			      + "<a href='" + l10n.index_event_box_graphic_href
 				+ "' title='" + l10n.index_event_box_graphic_title + "' target='_blank'>"
 				  + "<img src='" + l10n.index_event_box_graphic_src
-				  + "' alt='" + l10n.index_event_box_graphic_alt + "' />"
+				  + "alt='" + l10n.index_event_box_graphic_alt + "'"
+				  + "height='" + l10n.index_event_box_graphic_height + "'"
+				  + "width='" + l10n.index_event_box_graphic_width + "' />"
 			      + "</a>"
 			    + "</p>"
 
@@ -125,6 +207,7 @@ INDEX.showAlertBox = function() {
 
 INDEX.setRedirect = function() {
 	// The text is defined in "/msg_prop_l10n.js".
+
 	DL.NL_LANG	= "";					// Set to empty as both variables ...
 	DL.LANG_SEL	= "";					// ... must not be used in following function.
 	var lang_iso	= DL.getLanguage();			// Get the language ISO code from browser guessed data.
@@ -132,6 +215,9 @@ INDEX.setRedirect = function() {
 	var lang_text	= "";					// Customized message text that can be shown.
 	var link	= "";					// Override redirect mode.
 
+	// Create the "indexOf" function when the browser does not support it.
+	INDEX.createIndexOf();
+
 	// 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 ) ) {