am 6f03bd60: am ce478d54: am 7e453280: am 52dd2067: fix two bugs in site script. 1. Fix URL path check for reference docs to initalize api level and sidenav. Previously, this condition was never true, so the sidenav would not be initialized under default conditions an

* commit '6f03bd6092cba47d073e8bdc131d1cba89fa6c7c':
  fix two bugs in site script. 1. Fix URL path check for reference docs to initalize api level and sidenav. Previously, this condition was never true, so the sidenav would not be initialized under default conditions and the reference drag bar would not appear. 2. Fix the recent change to the 'scroll into view' script so that it works properly in a multi-pane sidenav (reference docs) by again making the offset measurement relative to the parent container (but much better than was done before).
This commit is contained in:
Scott Main 2013-08-15 14:57:11 -07:00 committed by Android Git Automerger
commit b8edbc0f7e

View file

@ -183,7 +183,6 @@ $(document).ready(function() {
$("#nav-x li.google a").addClass("selected");
} else {
$("#nav-x li.reference a").addClass("selected");
changeApiLevel(); // turn things grey
}
} else if ((rootDir == "tools") || (rootDir == "sdk")) {
$("#nav-x li.tools a").addClass("selected");
@ -825,14 +824,13 @@ function scrollIntoView(nav) {
// If no selected item found, exit
return;
}
var selectedOffset = $selected.offset().top; // measure offset from top, relative to entire page
if (selectedOffset > $nav.height() * .8) { // multiply nav height by .8 so we move up any
// items more than 80% down the nav
// scroll the item up by an amount 125px less than the window height (account for site header)
// and then multiply nav height by .8 to match the 80% threshold used above
api.scrollTo(0, selectedOffset - 125 - ($nav.height() * .8), false);
// get the selected item's offset from its container nav by measuring the item's offset
// relative to the document then subtract the container nav's offset relative to the document
var selectedOffset = $selected.offset().top - $nav.offset().top;
if (selectedOffset > $nav.height() * .8) { // multiply nav height by .8 so we move up the item
// if it's more than 80% down the nav
// scroll the item up by an amount equal to 80% the container nav's height
api.scrollTo(0, selectedOffset - ($nav.height() * .8), false);
}
}
}
@ -2232,10 +2230,10 @@ function escapeHTML(string) {
/* ######################################################## */
/* Initialize some droiddoc stuff, but only if we're in the reference */
if (location.pathname.indexOf("/reference")) {
if(!location.pathname.indexOf("/reference-gms/packages.html")
&& !location.pathname.indexOf("/reference-gcm/packages.html")
&& !location.pathname.indexOf("/reference/com/google") == 0) {
if (location.pathname.indexOf("/reference") == 0) {
if(!(location.pathname.indexOf("/reference-gms/packages.html") == 0)
&& !(location.pathname.indexOf("/reference-gcm/packages.html") == 0)
&& !(location.pathname.indexOf("/reference/com/google") == 0)) {
$(document).ready(function() {
// init available apis based on user pref
changeApiLevel();