cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / browser / resources / pdf / elements / viewer-page-indicator / viewer-page-indicator.js
blob2cf279b68b1a3cfb21d78d3c9b032c87e20ecb78
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
3 // found in the LICENSE file.
5 Polymer({
6 is: 'viewer-page-indicator',
8 properties: {
9 label: {
10 type: String,
11 value: '1'
14 index: {
15 type: Number,
16 observer: 'indexChanged'
19 pageLabels: {
20 type: Array,
21 value: null,
22 observer: 'pageLabelsChanged'
26 timerId: undefined,
28 ready: function() {
29 var callback = this.fadeIn.bind(this, 2000);
30 window.addEventListener('scroll', function() {
31 requestAnimationFrame(callback);
32 });
35 initialFadeIn: function() {
36 this.fadeIn(6000);
39 fadeIn: function(displayTime) {
40 var percent = window.scrollY /
41 (document.body.scrollHeight -
42 document.documentElement.clientHeight);
43 this.style.top = percent *
44 (document.documentElement.clientHeight - this.offsetHeight) + 'px';
45 this.style.opacity = 1;
46 clearTimeout(this.timerId);
48 this.timerId = setTimeout(function() {
49 this.style.opacity = 0;
50 this.timerId = undefined;
51 }.bind(this), displayTime);
54 pageLabelsChanged: function() {
55 this.indexChanged();
58 indexChanged: function() {
59 if (this.pageLabels)
60 this.label = this.pageLabels[this.index];
61 else
62 this.label = String(this.index + 1);
64 });