Merge "update css for header offset alignment and remove obsolete h1 styles for distribute docs. cross-dependency with CL I023fdd70a7071cbb7a8dfde853f1393eb6c59fa0" into klp-docs
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index 23f0660..95acec4 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -19,7 +19,6 @@
/****** ON LOAD SET UP STUFF *********/
-var navBarIsFixed = false;
$(document).ready(function() {
// load json file for JD doc search suggestions
@@ -347,7 +346,20 @@
// Set up the course landing pages for Training with class names and descriptions
if ($('body.trainingcourse').length) {
var $classLinks = $selListItem.find('ul li a').not('#nav .nav-section .nav-section ul a');
- var $classDescriptions = $classLinks.attr('description');
+
+ // create an array for all the class descriptions
+ var $classDescriptions = new Array($classLinks.length);
+ var lang = getLangPref();
+ $classLinks.each(function(index) {
+ var langDescr = $(this).attr(lang + "-description");
+ if (typeof langDescr !== 'undefined' && langDescr !== false) {
+ // if there's a class description in the selected language, use that
+ $classDescriptions[index] = langDescr;
+ } else {
+ // otherwise, use the default english description
+ $classDescriptions[index] = $(this).attr("description");
+ }
+ });
var $olClasses = $('<ol class="class-list"></ol>');
var $liClass;
@@ -359,7 +371,7 @@
$classLinks.each(function(index) {
$liClass = $('<li></li>');
$h2Title = $('<a class="title" href="'+$(this).attr('href')+'"><h2>' + $(this).html()+'</h2><span></span></a>');
- $pSummary = $('<p class="description">' + $(this).attr('description') + '</p>');
+ $pSummary = $('<p class="description">' + $classDescriptions[index] + '</p>');
$olLessons = $('<ol class="lesson-list"></ol>');
@@ -398,7 +410,7 @@
var stylesheet = $('link[rel="stylesheet"][class="fullscreen"]');
setNavBarLeftPos(); // do this even if sidenav isn't fixed because it could become fixed
// make sidenav behave when resizing the window and side-scolling is a concern
- if (navBarIsFixed) {
+ if (sticky) {
if ((stylesheet.attr("disabled") == "disabled") || stylesheet.length == 0) {
updateSideNavPosition();
} else {
@@ -918,19 +930,19 @@
if ($("#doc-col").height() < $("#side-nav").height()) {
shouldBeSticky = false;
}
+ // Account for horizontal scroll
+ var scrollLeft = $(window).scrollLeft();
+ // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
+ if (sticky && (scrollLeft != prevScrollLeft)) {
+ updateSideNavPosition();
+ prevScrollLeft = scrollLeft;
+ }
// Don't continue if the header is sufficently far away
// (to avoid intensive resizing that slows scrolling)
if (sticky == shouldBeSticky) {
return;
}
- // Account for horizontal scroll
- var scrollLeft = $(window).scrollLeft();
- // When the sidenav is fixed and user scrolls horizontally, reposition the sidenav to match
- if (navBarIsFixed && (scrollLeft != prevScrollLeft)) {
- updateSideNavPosition();
- prevScrollLeft = scrollLeft;
- }
// If sticky header visible and position is now near top, hide sticky
if (sticky && !shouldBeSticky) {
@@ -2642,7 +2654,7 @@
}
function updateSidenavFixedWidth() {
- if (!navBarIsFixed) return;
+ if (!sticky) return;
$('#devdoc-nav').css({
'width' : $('#side-nav').css('width'),
'margin' : $('#side-nav').css('margin')
@@ -2653,7 +2665,7 @@
}
function updateSidenavFullscreenWidth() {
- if (!navBarIsFixed) return;
+ if (!sticky) return;
$('#devdoc-nav').css({
'width' : $('#side-nav').css('width'),
'margin' : $('#side-nav').css('margin')
@@ -3538,7 +3550,6 @@
while (i < resources.length) {
var cardSize = cardSizes[j++ % cardSizes.length];
cardSize = cardSize.replace(/^\s+|\s+$/,'');
- // console.log("cardsize is " + cardSize);
// Some card sizes do not get a plusone button, such as where space is constrained
// or for cards commonly embedded in docs (to improve overall page speed).
plusone = !((cardSize == "6x2") || (cardSize == "6x3") ||