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/13 15:16:48 UTC
svn commit: r1610190 - /openoffice/ooo-site/trunk/content/index_redirect.html
Author: marcus
Date: Sun Jul 13 13:16:47 2014
New Revision: 1610190
URL: http://svn.apache.org/r1610190
Log:
Re-worked the redirect function to redirect immediately or show first a clickable message
Modified:
openoffice/ooo-site/trunk/content/index_redirect.html
Modified: openoffice/ooo-site/trunk/content/index_redirect.html
URL: http://svn.apache.org/viewvc/openoffice/ooo-site/trunk/content/index_redirect.html?rev=1610190&r1=1610189&r2=1610190&view=diff
==============================================================================
--- openoffice/ooo-site/trunk/content/index_redirect.html (original)
+++ openoffice/ooo-site/trunk/content/index_redirect.html Sun Jul 13 13:16:47 2014
@@ -87,32 +87,70 @@
}
}
- function showRedirectBox() {
+ 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 language as native name.
- var redirect = false; // Should the found language be used to redirect (false/true)?
+ var lang_text = ""; // The message text that can be shown.
+// var redirect = false; // Set a hard-redirect without showing a message (false/true)?
+// var show = false; // Should the found language be used to redirect (false/true)?
// 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 language was found.
- if( DL.SEL_LANG[ i ] === lang_iso ) {
- // Only if the language is OK to redirect, assign the text and set redirect = true.
- if( l10n.index_redirect_text[ i / 3 * 2 ] === "y" ) {
- lang_text = l10n.index_redirect_text[ i / 3 * 2 + 1 ];
- redirect = true;
- }
- break;
- }
+ // If the ISO code is found in the language array.
+ if( DL.SEL_LANG[ i ] === lang_iso ) {
+/*
+ // Only if the language is OK to redirect, assign the text and set redirect = true.
+ if( l10n.index_redirect_text[ i / 3 * 2 ] === "y" ) {
+ lang_text = l10n.index_redirect_text[ i / 3 * 2 + 1 ];
+ redirect = true;
+ }
+ break;
+*/
+ // Query for the redirect method (defined in "/msg_prop_l10n.js", column 0).
+ switch( l10n.index_redirect_text[ i / 3 * 2 ] ) {
+ case "hard":
+ // Don't show a message, just redirect.
+ alert( "Just for debugging purpose:" + "\n\n"
+ + "Browser language ISO code: \t\t" + lang_iso + "\n"
+ + "Redirect method? \t\t\t\t" + "Hard, without message" + "\n" );
+
+ window.open( "http://www.openoffice.org/" + lang_iso , "_self" );
+ break;
+ case "soft":
+ // Show a message and redirect on user's click.
+ alert( "Just for debugging purpose:" + "\n\n"
+ + "Browser language ISO code: \t\t" + lang_iso + "\n"
+ + "Redirect method? \t\t\t\t" + "Soft, with message" + "\n"
+ + "Position in language array: \t\t" + i / 3 + "\n"
+ + "Found language text: \t\t\t" + lang_text );
+
+ // Assign the message text (defined in "/msg_prop_l10n.js", column 1).
+ lang_text = l10n.index_redirect_text[ i / 3 * 2 + 1 ];
+// redirect = true;
+ document.write( "<div id='redirect_box'"
+ + " onclick='window.open( \"http://www.openoffice.org/" + lang_iso
+ + "\", \"_blank\" ); return false;'>"
+// + " onclick='window.open( \"http://www.openoffice.org/" + lang_iso
+// + "\", \"_self\" ); return false;'>"
+ + "<p>" + lang_text + "</p>"
+ + "</div>" ); // redirect box
+ break;
+ case "none":
+ default:
+ // Do and show nothing.
+ lang_text = l10n.index_redirect_text[ i / 3 * 2 + 1 ];
+ alert( "Just for debugging purpose:" + "\n\n"
+ + "Browser language ISO code: \t\t" + lang_iso + "\n"
+ + "Redirect method? \t\t\t\t" + "None, do and show nothing" + "\n"
+ + "Position in language array: \t\t" + i / 3 + "\n"
+ + "Found language text: \t\t\t" + lang_text );
+ }
+ break;
+ }
}
-
- alert( "Just for debugging purpose:" + "\n\n"
- + "Browser language ISO code: \t\t" + lang_iso + "\n"
- + "Is it OK to redirect? \t\t\t\t" + redirect + "\n"
- + "Position in language array: \t\t" + i / 3 + "\n"
- + "Found language text: \t\t\t" + lang_text );
-
+/*
// Show redirect box or not?
if( redirect ) {
// Show redirect box with defined background color and the text with link and cursor as poiner.
@@ -122,7 +160,7 @@
+ "<p>" + lang_text + "</p>"
+ "</div>" ); // redirect box
}
-
+*/
return;
}
</script>
@@ -147,7 +185,7 @@ screen reader.
// Show redirect box.
// Let the user decide to click to get to their localized NL website or not.
// Change to 'true' if you want to show the text that is defined in the variables above.
- showRedirectBox( true );
+ setRedirect();
//-->
</script>