var navBarIsFixed = false;
$(document).ready(function() {
- // move the lang selector into the overflow menu
- $("#moremenu .mid div.header:last").after($("#language").detach());
+ if (devsite) {
+ // move the lang selector into the overflow menu
+ $("#moremenu .mid div.header:last").after($("#language").detach());
+ }
// init the fullscreen toggle click event
$('#nav-swap .fullscreen').click(function(){
// keep this for 50 years
//alert("expires: " + expires)
writeCookie("pref_lang", lang, null, expires);
- if (submit) {
- $("#setlang").submit();
+
+ // ####### TODO: Remove this condition once we're stable on devsite #######
+ // This condition is only needed if we still need to support legacy GAE server
+ if (devsite) {
+ // Switch language when on Devsite server
+ if (submit) {
+ $("#setlang").submit();
+ }
+ } else {
+ // Switch language when on legacy GAE server
+ changeDocLang(lang);
+ if (submit) {
+ window.location = getBaseUri(location.pathname);
+ }
}
}
var navBarIsFixed = false;
$(document).ready(function() {
+ if (devsite) {
+ // move the lang selector into the overflow menu
+ $("#moremenu .mid div.header:last").after($("#language").detach());
+ }
+
// init the fullscreen toggle click event
$('#nav-swap .fullscreen').click(function(){
if ($(this).hasClass('disabled')) {
resizeNav();
+ /* init the language selector based on user cookie for lang */
+ loadLangPref();
+ changeNavLang(getLangPref());
+
+ /* setup event handlers to ensure the overflow menu is visible while picking lang */
+ $("#language select")
+ .mousedown(function() {
+ $("div.morehover").addClass("hover"); })
+ .blur(function() {
+ $("div.morehover").removeClass("hover"); });
+
+ /* some global variable setup */
+ resizePackagesNav = $("#resize-packages-nav");
+ classesNav = $("#classes-nav");
+ devdocNav = $("#devdoc-nav");
+
+ var cookiePath = "";
+ if (location.href.indexOf("/reference/") != -1) {
+ cookiePath = "reference_";
+ } else if (location.href.indexOf("/guide/") != -1) {
+ cookiePath = "guide_";
+ } else if (location.href.indexOf("/tools/") != -1) {
+ cookiePath = "tools_";
+ } else if (location.href.indexOf("/training/") != -1) {
+ cookiePath = "training_";
+ } else if (location.href.indexOf("/design/") != -1) {
+ cookiePath = "design_";
+ } else if (location.href.indexOf("/distribute/") != -1) {
+ cookiePath = "distribute_";
+ }
});
prettyPrint();
} );
-function init() {
- //resizeNav();
-
- resizePackagesNav = $("#resize-packages-nav");
- classesNav = $("#classes-nav");
- devdocNav = $("#devdoc-nav");
-
- var cookiePath = "";
- if (location.href.indexOf("/reference/") != -1) {
- cookiePath = "reference_";
- } else if (location.href.indexOf("/guide/") != -1) {
- cookiePath = "guide_";
- } else if (location.href.indexOf("/tools/") != -1) {
- cookiePath = "tools_";
- } else if (location.href.indexOf("/training/") != -1) {
- cookiePath = "training_";
- } else if (location.href.indexOf("/design/") != -1) {
- cookiePath = "design_";
- } else if (location.href.indexOf("/distribute/") != -1) {
- cookiePath = "distribute_";
- }
-}
});
}
-function changeDocLang(lang) {
- changeNavLang(lang);
-}
-
-function changeLangPref(lang, refresh) {
+function changeLangPref(lang, submit) {
var date = new Date();
expires = date.toGMTString(date.setTime(date.getTime()+(10*365*24*60*60*1000)));
// keep this for 50 years
//alert("expires: " + expires)
writeCookie("pref_lang", lang, null, expires);
- changeDocLang(lang);
- if (refresh) {
- l = getBaseUri(location.pathname);
- window.location = l;
+
+ // ####### TODO: Remove this condition once we're stable on devsite #######
+ // This condition is only needed if we still need to support legacy GAE server
+ if (devsite) {
+ // Switch language when on Devsite server
+ if (submit) {
+ $("#setlang").submit();
+ }
+ } else {
+ // Switch language when on legacy GAE server
+ changeDocLang(lang);
+ if (submit) {
+ window.location = getBaseUri(location.pathname);
+ }
}
}