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

Side by Side Diff: elements/viewer-page-indicator/viewer-page-indicator.js

Issue 236723003: Allow the PDF page indicator to accept a list of page labels (Closed) Base URL: https://chromium.googlesource.com/chromium/html-office-public.git@master
Patch Set: Created 6 years, 8 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 unified diff | Download patch
« no previous file with comments | « elements/viewer-page-indicator/viewer-page-indicator.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 Polymer('viewer-page-indicator', { 5 Polymer('viewer-page-indicator', {
6 text: '1', 6 label: '1',
7 index: 0,
7 timerId: undefined, 8 timerId: undefined,
9 pageLabels: null,
8 ready: function() { 10 ready: function() {
9 var callback = this.fadeIn.bind(this, 2000); 11 var callback = this.fadeIn.bind(this, 2000);
10 window.addEventListener('scroll', function() { 12 window.addEventListener('scroll', function() {
11 requestAnimationFrame(callback); 13 requestAnimationFrame(callback);
12 }); 14 });
13 }, 15 },
14 initialFadeIn: function() { 16 initialFadeIn: function() {
15 this.fadeIn(6000); 17 this.fadeIn(6000);
16 }, 18 },
17 fadeIn: function(displayTime) { 19 fadeIn: function(displayTime) {
18 var percent = window.scrollY / 20 var percent = window.scrollY /
19 (document.body.scrollHeight - 21 (document.body.scrollHeight -
20 document.documentElement.clientHeight); 22 document.documentElement.clientHeight);
21 this.style.top = percent * 23 this.style.top = percent *
22 (document.documentElement.clientHeight - this.offsetHeight) + 'px'; 24 (document.documentElement.clientHeight - this.offsetHeight) + 'px';
23 this.style.opacity = 1; 25 this.style.opacity = 1;
24 clearTimeout(this.timerId); 26 clearTimeout(this.timerId);
25 27
26 this.timerId = setTimeout(function() { 28 this.timerId = setTimeout(function() {
27 this.style.opacity = 0; 29 this.style.opacity = 0;
28 this.timerId = undefined; 30 this.timerId = undefined;
29 }.bind(this), displayTime); 31 }.bind(this), displayTime);
32 },
33 pageLabelsChanged: function() {
34 this.indexChanged();
35 },
36 indexChanged: function() {
37 if (this.pageLabels)
38 this.label = this.pageLabels[this.index];
39 else
40 this.label = String(this.index + 1);
30 } 41 }
31 }); 42 });
OLDNEW
« no previous file with comments | « elements/viewer-page-indicator/viewer-page-indicator.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698