summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Dougherty <ddougherty@google.com>2014-05-19 18:12:52 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-19 18:12:52 +0000
commit7a62e01c0baa27d7cff53b4ac4d082710691e8c4 (patch)
tree21b6aa49d4297e86d62740f45e5be42c2128fa84
parent8074ff4d0f962a933586b9809d1f1bdffe1fe5ed (diff)
parent63168ffff85e8888c003588b4beeab6769d578ed (diff)
downloadbuild-7a62e01c0baa27d7cff53b4ac4d082710691e8c4.zip
build-7a62e01c0baa27d7cff53b4ac4d082710691e8c4.tar.gz
build-7a62e01c0baa27d7cff53b4ac4d082710691e8c4.tar.bz2
am 63168fff: am b4cb3ebc: am ca1230c9: Minor fixes for handling cross-browser load issues and positioning of #headings.
* commit '63168ffff85e8888c003588b4beeab6769d578ed': Minor fixes for handling cross-browser load issues and positioning of #headings.
-rw-r--r--tools/droiddoc/templates-sdk/assets/css/default.css19
-rw-r--r--tools/droiddoc/templates-sdk/assets/js/docs.js172
2 files changed, 100 insertions, 91 deletions
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 4b99ca1..522b237 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -713,6 +713,7 @@ ul#title-tabs li a:active {
color: #33b5e5;
border-bottom-color: #33b5e5; } }
+h1:target,
h2:target,
h3:target {
-webkit-animation-name: glowheader;
@@ -1131,7 +1132,7 @@ h3 {
h3, h4 {
color:#333;
line-height: 20px;
- margin: 10px 0;
+ margin: 10px 0 14px 0;
}
h4 {
font-size: 16px;
@@ -5137,10 +5138,12 @@ a.download-sdk {
margin-bottom: 0px;
font-size: 20px;
color: #363636;
+ padding-top: 70px;
+ margin-top:-60px;
}
.headerLine hr {
overflow: hidden;
- margin: 42px 0 0 0;
+ margin: 30px 0 0 0;
}
.article-detail #body-content {
@@ -5365,11 +5368,11 @@ a.download-sdk {
.resource-flow-layout:after {
content: ".";
display: block;
- height: 0;
+ height: 10;
+ position:relative;
clear: both;
visibility: hidden;
}
-
.resource-card:hover {
cursor: pointer;
}
@@ -6383,4 +6386,12 @@ height:30px;
div.jd-descr > .resource-widget[data-section=distribute\/tools]
.section-card-menu .card-info ul li {
border-top-color: #7e3794 !important;
+}
+
+div.jd-descr > h2:before, h3:before {
+display:block;
+content: " ";
+margin-top:-60px;
+height: 70px;
+visibility:hidden;
} \ No newline at end of file
diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js
index e6befe3..d8d5732 100644
--- a/tools/droiddoc/templates-sdk/assets/js/docs.js
+++ b/tools/droiddoc/templates-sdk/assets/js/docs.js
@@ -884,102 +884,98 @@ function writeCookie(cookie, val, section, expiration) {
/* ######### END COOKIES! ########## */
-
-
+var sticky = false;
var stickyTop;
+var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
/* Sets the vertical scoll position at which the sticky bar should appear.
This method is called to reset the position when search results appear or hide */
function setStickyTop() {
stickyTop = $('#header-wrapper').outerHeight() - $('#sticky-header').outerHeight();
}
-
-/*
+/*
* Displays sticky nav bar on pages when dac header scrolls out of view
*/
-(function() {
- $(document).ready(function() {
-
- setStickyTop();
- var sticky = false;
- var hiding = false;
- var $stickyEl = $('#sticky-header');
- var $menuEl = $('.menu-container');
-
- var prevScrollLeft = 0; // used to compare current position to previous position of horiz scroll
-
- $(window).scroll(function() {
- // Exit if there's no sidenav
- if ($('#side-nav').length == 0) return;
- // Exit if the mouse target is a DIV, because that means the event is coming
- // from a scrollable div and so there's no need to make adjustments to our layout
- if (event.target.nodeName == "DIV") {
- return;
- }
-
-
- var top = $(window).scrollTop();
- // we set the navbar fixed when the scroll position is beyond the height of the site header...
- var shouldBeSticky = top >= stickyTop;
- // ... except if the document content is shorter than the sidenav height.
- // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
- if ($("#doc-col").height() < $("#side-nav").height()) {
- shouldBeSticky = false;
- }
-
- // 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;
- }
+$(window).scroll(function(event) {
+
+ setStickyTop();
+ var hiding = false;
+ var $stickyEl = $('#sticky-header');
+ var $menuEl = $('.menu-container');
+ // Exit if there's no sidenav
+ if ($('#side-nav').length == 0) return;
+ // Exit if the mouse target is a DIV, because that means the event is coming
+ // from a scrollable div and so there's no need to make adjustments to our layout
+ if ($(event.target).nodeName == "DIV") {
+ return;
+ }
- // If sticky header visible and position is now near top, hide sticky
- if (sticky && !shouldBeSticky) {
- sticky = false;
- hiding = true;
- // make the sidenav static again
- $('#devdoc-nav')
- .removeClass('fixed')
- .css({'width':'auto','margin':''})
- .prependTo('#side-nav');
- // delay hide the sticky
- $menuEl.removeClass('sticky-menu');
- $stickyEl.fadeOut(250);
- hiding = false;
-
- // update the sidenaav position for side scrolling
- updateSideNavPosition();
- } else if (!sticky && shouldBeSticky) {
- sticky = true;
- $stickyEl.fadeIn(10);
- $menuEl.addClass('sticky-menu');
-
- // make the sidenav fixed
- var width = $('#devdoc-nav').width();
- $('#devdoc-nav')
- .addClass('fixed')
- .css({'width':width+'px'})
- .prependTo('#body-content');
-
- // update the sidenaav position for side scrolling
- updateSideNavPosition();
+ var top = $(window).scrollTop();
+ // we set the navbar fixed when the scroll position is beyond the height of the site header...
+ var shouldBeSticky = top >= stickyTop;
+ // ... except if the document content is shorter than the sidenav height.
+ // (this is necessary to avoid crazy behavior on OSX Lion due to overscroll bouncing)
+ if ($("#doc-col").height() < $("#side-nav").height()) {
+ shouldBeSticky = false;
+ }
- } else if (hiding && top < 15) {
- $menuEl.removeClass('sticky-menu');
- $stickyEl.hide();
- hiding = false;
- }
+ // 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) {
+ sticky = false;
+ hiding = true;
+ // make the sidenav static again
+ $('#devdoc-nav')
+ .removeClass('fixed')
+ .css({'width':'auto','margin':''})
+ .prependTo('#side-nav');
+ // delay hide the sticky
+ $menuEl.removeClass('sticky-menu');
+ $stickyEl.fadeOut(250);
+ hiding = false;
+
+ // update the sidenaav position for side scrolling
+ updateSideNavPosition();
+ } else if (!sticky && shouldBeSticky) {
+ sticky = true;
+ $stickyEl.fadeIn(10);
+ $menuEl.addClass('sticky-menu');
+
+ // make the sidenav fixed
+ var width = $('#devdoc-nav').width();
+ $('#devdoc-nav')
+ .addClass('fixed')
+ .css({'width':width+'px'})
+ .prependTo('#body-content');
+
+ // update the sidenaav position for side scrolling
+ updateSideNavPosition();
+
+ } else if (hiding && top < 15) {
+ $menuEl.removeClass('sticky-menu');
+ $stickyEl.hide();
+ hiding = false;
+ }
+ resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
+});
- resizeNav(250); // pass true in order to delay the scrollbar re-initialization for performance
- });
+/*
+ * Manages secion card states and nav resize to conclude loading
+ */
+(function() {
+ $(document).ready(function() {
// Stack hover states
$('.section-card-menu').each(function(index, el) {
@@ -1827,6 +1823,11 @@ function search_changed(e, kd, toroot)
}
// Stop here if Google results are showing
else if ($("#searchResults").is(":visible")) {
+ //If search_results is scrolled out of view, scroll to top on input
+ if ((sticky ) && (search.value != "")) {
+ $('body,html').animate({scrollTop:0}, '500', 'swing');
+ }
+ // if results aren't showing (and text not empty), return true to allow search to execute
return true;
}
// 38 UP ARROW
@@ -2505,8 +2506,6 @@ $(window).hashchange( function(){
if (!$("#searchResults").is(":hidden")) {
hideResults();
}
- // Adjust the scroll position to account for sticky header
- $(window).scrollTop($(window).scrollTop() - 60);
return;
}
@@ -3517,7 +3516,6 @@ function showSamples() {
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") ||