OLD | NEW |
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({ | 5 Polymer({ |
6 is: 'viewer-page-indicator', | 6 is: 'viewer-page-indicator', |
7 | 7 |
8 properties: { | 8 properties: { |
9 label: { | 9 label: { |
10 type: String, | 10 type: String, |
(...skipping 24 matching lines...) Expand all Loading... |
35 initialFadeIn: function() { | 35 initialFadeIn: function() { |
36 this.fadeIn(6000); | 36 this.fadeIn(6000); |
37 }, | 37 }, |
38 | 38 |
39 fadeIn: function(displayTime) { | 39 fadeIn: function(displayTime) { |
40 var percent = window.scrollY / | 40 var percent = window.scrollY / |
41 (document.body.scrollHeight - | 41 (document.body.scrollHeight - |
42 document.documentElement.clientHeight); | 42 document.documentElement.clientHeight); |
43 this.style.top = percent * | 43 this.style.top = percent * |
44 (document.documentElement.clientHeight - this.offsetHeight) + 'px'; | 44 (document.documentElement.clientHeight - this.offsetHeight) + 'px'; |
45 <if expr="is_macosx"> | 45 // <if expr="is_macosx"> |
46 // On the Mac, if overlay scrollbars are enabled, prevent them from | 46 // On the Mac, if overlay scrollbars are enabled, prevent them from |
47 // overlapping the triangle. | 47 // overlapping the triangle. |
48 if (window.innerWidth == document.body.scrollWidth) | 48 if (window.innerWidth == document.body.scrollWidth) |
49 this.style.right = '16px'; | 49 this.style.right = '16px'; |
50 else | 50 else |
51 this.style.right = '0px'; | 51 this.style.right = '0px'; |
52 </if> | 52 // </if> |
53 this.style.opacity = 1; | 53 this.style.opacity = 1; |
54 clearTimeout(this.timerId); | 54 clearTimeout(this.timerId); |
55 | 55 |
56 this.timerId = setTimeout(function() { | 56 this.timerId = setTimeout(function() { |
57 this.style.opacity = 0; | 57 this.style.opacity = 0; |
58 this.timerId = undefined; | 58 this.timerId = undefined; |
59 }.bind(this), displayTime); | 59 }.bind(this), displayTime); |
60 }, | 60 }, |
61 | 61 |
62 pageLabelsChanged: function() { | 62 pageLabelsChanged: function() { |
63 this.indexChanged(); | 63 this.indexChanged(); |
64 }, | 64 }, |
65 | 65 |
66 indexChanged: function() { | 66 indexChanged: function() { |
67 if (this.pageLabels) | 67 if (this.pageLabels) |
68 this.label = this.pageLabels[this.index]; | 68 this.label = this.pageLabels[this.index]; |
69 else | 69 else |
70 this.label = String(this.index + 1); | 70 this.label = String(this.index + 1); |
71 } | 71 } |
72 }); | 72 }); |
OLD | NEW |