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

Unified Diff: chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js

Issue 853603002: Merge html-office-public repo into src (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months 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/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js
diff --git a/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js b/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js
new file mode 100644
index 0000000000000000000000000000000000000000..8612e170348f1894f46296e0dc5e2be93c984c33
--- /dev/null
+++ b/chrome/browser/resources/pdf/elements/viewer-page-indicator/viewer-page-indicator.js
@@ -0,0 +1,42 @@
+// Copyright 2014 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.
+
+Polymer('viewer-page-indicator', {
+ label: '1',
+ index: 0,
+ timerId: undefined,
+ pageLabels: null,
+ ready: function() {
+ var callback = this.fadeIn.bind(this, 2000);
+ window.addEventListener('scroll', function() {
+ requestAnimationFrame(callback);
+ });
+ },
+ initialFadeIn: function() {
+ this.fadeIn(6000);
+ },
+ fadeIn: function(displayTime) {
+ var percent = window.scrollY /
+ (document.body.scrollHeight -
+ document.documentElement.clientHeight);
+ this.style.top = percent *
+ (document.documentElement.clientHeight - this.offsetHeight) + 'px';
+ this.style.opacity = 1;
+ clearTimeout(this.timerId);
+
+ this.timerId = setTimeout(function() {
+ this.style.opacity = 0;
+ this.timerId = undefined;
+ }.bind(this), displayTime);
+ },
+ pageLabelsChanged: function() {
+ this.indexChanged();
+ },
+ indexChanged: function() {
+ if (this.pageLabels)
+ this.label = this.pageLabels[this.index];
+ else
+ this.label = String(this.index + 1);
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698