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/07/23 23:42:19 UTC
svn commit: r1612952 - /openoffice/ooo-site/trunk/content/index_url.html
Author: marcus
Date: Wed Jul 23 21:42:19 2014
New Revision: 1612952
URL: http://svn.apache.org/r1612952
Log:
Added debugging code
Modified:
openoffice/ooo-site/trunk/content/index_url.html
Modified: openoffice/ooo-site/trunk/content/index_url.html
URL: http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/index_url.html?rev=1612952&r1=1612951&r2=1612952&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/index_url.html (original)
+++ openoffice/ooo-site/trunk/content/index_url.html Wed Jul 23 21:42:19 2014
@@ -88,44 +88,77 @@
}
function setRedirect() {
- DL.NL_LANG = ""; // Set to empty as both variables must not be used in following function.
- DL.LANG_SEL = "";
- var lang_iso = DL.getLanguage(); // Get the language ISO code from browser guessed data.
- var lang_text = ""; // The message text that can be shown.
- var mode = ""; // Redirect mode.
-
+ 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.
+ var lang_mode = ""; // Customized redirect mode.
+ var lang_text = ""; // Customized message text that can be shown.
+ var link = ""; // Override redirect mode.
+/*
+ // 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;
+ };
+ }
+*/
// Query if the browser language is one of the released languages.
// The array has 3 elements per language (defined in "/download/globalvars.js"
for( var i = 0, j = DL.SEL_LANG.length; i < j; i = i + 3 ) {
// If the ISO code is found in the language array.
if( DL.SEL_LANG[ i ] === lang_iso ) {
// Query for the redirect method (defined in "/msg_prop_l10n.js", column 0).
- mode = l10n.index_redirect_text[ i / 3 * 2 ];
+ lang_mode = l10n.index_redirect_text[ i / 3 * 2 ];
lang_text = l10n.index_redirect_text[ i / 3 * 2 + 1 ];
break;
}
}
-// alert( String( document.location ).indexOf( "soft" ) );
-
+ alert( "ISO code: \t" + lang_iso + "\n"
+ + "Mode: \t\t" + lang_mode + "\n"
+ + "Text: \t\t" + lang_text + "\n" );
+
+ // Convert the browser URL into a string.
+ link = String( document.location );
+
// Does the browser URL contain already a redirect mode?
- if( String( document.location ).indexOf( "soft" ) != -1 ) {
- // Set override mode to "soft".
- mode = "soft";
- } else if( String( document.location ).indexOf( "none" ) != -1 ) {
- // Set override mode to "none".
- mode = "none";
+ // If yes, set the new redirect mode to override the customized mode.
+ if( link.indexOf( "hard" ) !== -1 ) {
+ lang_mode = "hard";
+ } else if( link.indexOf( "soft" ) !== -1 ) {
+ lang_mode = "soft";
+ } else if( link.indexOf( "none" ) !== -1 ) {
+ lang_mode = "none";
}
- switch( mode ) {
+ alert( "URL: \t\t" + document.location );
+
+ switch( lang_mode ) {
case "hard":
// Don't show a message, just redirect.
+ alert( "What redirect mode will be used? \t" + lang_mode );
window.open( "http://www.openoffice.org/" + lang_iso , "_self" );
break;
case "soft":
// Show a message and redirect on user's click.
// Assign the message text (defined in "/msg_prop_l10n.js", column 1).
+ alert( "What redirect mode will be used? \t" + lang_mode );
document.write( "<div id='redirect_box'"
+ " onclick='window.open( \"http://www.openoffice.org/" + lang_iso + "\", \"_self\" ); return false;'>"
+ "<p>" + lang_text + "</p>"
@@ -133,6 +166,7 @@
break;
case "none":
default:
+ alert( "What redirect mode will be used? \t" + lang_mode );
// Do and show nothing.
}