Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(698)

Unified Diff: chrome/common/extensions/docs/static/js/scroll.js

Issue 102593005: Clean patch with DCC static content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests for sidenav_data_source Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/static/js/scroll.js
diff --git a/chrome/common/extensions/docs/static/js/scroll.js b/chrome/common/extensions/docs/static/js/scroll.js
deleted file mode 100644
index e8226e90b65f3c72cc4cb40d46718035991d179c..0000000000000000000000000000000000000000
--- a/chrome/common/extensions/docs/static/js/scroll.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Scroll handling.
-//
-// Switches the sidebar between floating on the left and position:fixed
-// depending on whether it's scrolled into view, and manages the scroll-to-top
-// button: click logic, and when to show it.
-(function() {
-
-var sidebar = document.getElementById('gc-sidebar');
-var scrollToTop = document.getElementById('scroll-to-top');
-var offsetTop = sidebar.offsetTop;
-
-function relayout() {
- // Obviously, this code executes every time the window scrolls, so avoid
- // putting things in here.
- var isFloatingSidebar = sidebar.classList.contains('floating');
- var isShowingScrollToTop = !scrollToTop.classList.contains('hidden');
-
- var floatSidebar = false;
- var showScrollToTop = false;
-
- if (window.scrollY > offsetTop) {
- // Scrolled past the top of the sidebar.
- if (window.innerHeight >= sidebar.scrollHeight) {
- // The whole sidebar fits in the window. Make it always visible.
- floatSidebar = true;
- } else {
- // Whole sidebar doesn't fit, so show the scroll-to-top button instead.
- showScrollToTop = true;
- }
- }
-
- if (floatSidebar != isFloatingSidebar)
- sidebar.classList.toggle('floating', floatSidebar);
- if (isShowingScrollToTop != showScrollToTop)
- scrollToTop.classList.toggle('hidden', !showScrollToTop);
-}
-
-window.addEventListener('scroll', relayout);
-setTimeout(relayout, 0);
-
-scrollToTop.addEventListener('click', function() {
- window.scrollTo(0, 0);
-});
-
-}());
« no previous file with comments | « chrome/common/extensions/docs/static/js/fatnav.js ('k') | chrome/common/extensions/docs/static/js/search.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698