Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ea33de7 authored by Scott Main's avatar Scott Main Committed by Android Git Automerger
Browse files

am 086e7f8b: am 79935f59: am 015d616a: docs: use devsite hdf bool as a...

am 086e7f8b: am 79935f59: am 015d616a: docs: use devsite hdf bool as a javascript condition for managing the lang toggle. sync the sdk and ds templates so we can move toward one template set

# Via Android Git Automerger (2) and Scott Main (1)
* commit '086e7f8b':
  docs: use devsite hdf bool as a javascript condition for managing the lang toggle. sync the sdk and ds templates so we can move toward one template set
parents f0b7415e 086e7f8b
Loading
Loading
Loading
Loading
+18 −4
Original line number Diff line number Diff line
@@ -15,8 +15,10 @@ var SITE_ROOT = toRoot + basePath.substring(1,basePath.indexOf("/",1));

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(){
@@ -1051,9 +1053,21 @@ function changeLangPref(lang, submit) {
  // keep this for 50 years
  //alert("expires: " + expires)
  writeCookie("pref_lang", lang, null, expires);

  //  #######  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);
    }
  }
}

function loadLangPref() {
+1 −6
Original line number Diff line number Diff line
@@ -330,12 +330,7 @@ def:custom_left_nav() ?><?cs
    call:about_nav() ?><?cs 
  else ?><?cs 
    call:default_left_nav() ?> <?cs 
  /if ?>
    <script>
      $(document).ready(function() {
        changeNavLang(getLangPref());
        });
    </script><?cs 
  /if ?><?cs 
/def ?>

<?cs # appears at the bottom of every page ?><?cs 
+5 −0
Original line number Diff line number Diff line
@@ -25,6 +25,11 @@ type="text/css">
<script src="//android-dot-devsite.googleplex.com/_static/js/android_3p-bundle.js" type="text/javascript"></script>
<script type="text/javascript">
  var toRoot = "<?cs var:toroot ?>";
  <?cs if:devsite ?>
  var devsite = true;
  <?cs else ?>
  var devsite = false;
  <?cs /if ?>
</script>
<script src="<?cs var:toroot ?>assets/js/docs.js" type="text/javascript"></script>
<?cs if:reference.gms || reference.gcm || google?>
+50 −31
Original line number Diff line number Diff line
@@ -15,6 +15,11 @@ var SITE_ROOT = toRoot + basePath.substring(1,basePath.indexOf("/",1));

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')) {
@@ -489,6 +494,36 @@ false; // navigate across topic boundaries only in design docs
  
  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_";
  }

});

@@ -576,28 +611,6 @@ addLoadEvent( function() {
  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_";
  }
}



@@ -1034,20 +1047,26 @@ function changeNavLang(lang) {
  });
}

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);

  //  #######  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 (refresh) {
    l = getBaseUri(location.pathname);
    window.location = l;
    if (submit) {
      window.location = getBaseUri(location.pathname);
    }
  }
}

+1 −6
Original line number Diff line number Diff line
@@ -330,12 +330,7 @@ def:custom_left_nav() ?><?cs
    call:about_nav() ?><?cs 
  else ?><?cs 
    call:default_left_nav() ?> <?cs 
  /if ?>
    <script>
      $(document).ready(function() {
        changeDocLang(getLangPref());
        });
    </script><?cs 
  /if ?><?cs 
/def ?>

<?cs # appears at the bottom of every page ?><?cs 
Loading