You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by bu...@apache.org on 2014/11/21 22:56:24 UTC
svn commit: r930033 - in /websites/staging/ooo-site/trunk: cgi-bin/ content/
content/scripts/ooo.js
Author: buildbot
Date: Fri Nov 21 21:56:24 2014
New Revision: 930033
Log:
Staging update by buildbot for ooo-site
Modified:
websites/staging/ooo-site/trunk/cgi-bin/ (props changed)
websites/staging/ooo-site/trunk/content/ (props changed)
websites/staging/ooo-site/trunk/content/scripts/ooo.js
Propchange: websites/staging/ooo-site/trunk/cgi-bin/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Nov 21 21:56:24 2014
@@ -1 +1 @@
-1640988
+1641006
Propchange: websites/staging/ooo-site/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Nov 21 21:56:24 2014
@@ -1 +1 @@
-1640988
+1641006
Modified: websites/staging/ooo-site/trunk/content/scripts/ooo.js
==============================================================================
--- websites/staging/ooo-site/trunk/content/scripts/ooo.js (original)
+++ websites/staging/ooo-site/trunk/content/scripts/ooo.js Fri Nov 21 21:56:24 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 ) ) {