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

Unified Diff: elements/viewer-page-indicator/viewer-page-indicator.js

Issue 213223004: Make all the polymer elements CSP compliant. (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 side-by-side diff with in-line comments
Download patch
Index: elements/viewer-page-indicator/viewer-page-indicator.js
diff --git a/elements/viewer-page-indicator/viewer-page-indicator.js b/elements/viewer-page-indicator/viewer-page-indicator.js
new file mode 100644
index 0000000000000000000000000000000000000000..e22b5a6f91c496e2e3b2ee36080d10bff8527589
--- /dev/null
+++ b/elements/viewer-page-indicator/viewer-page-indicator.js
@@ -0,0 +1,31 @@
+// 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', {
+ text: '1',
+ timerId: undefined,
+ 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);
+ }
+});
« no previous file with comments | « elements/viewer-page-indicator/viewer-page-indicator.html ('k') | elements/viewer-password-screen/viewer-password-screen.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698