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('viewer-password-screen', {
6 text: 'This document is password protected. Please enter a password.',
13 this.successMessage = '✔' // Tick.
14 this.$.successMessage.style.color = 'rgb(0,125,0)';
18 this.successMessage = '✘'; // Cross.
19 this.$.successMessage.style.color = 'rgb(255,0,0)';
20 this.$.password.disabled = false;
21 this.$.submit.disabled = false;
22 this.$.password.focus();
23 this.$.password.select();
26 // Prevent the default form submission behavior.
28 if (this.$.password.value.length == 0)
30 this.successMessage = '...';
31 this.$.successMessage.style.color = 'rgb(0,0,0)';
32 this.$.password.disabled = true;
33 this.$.submit.disabled = true;
34 this.fire('password-submitted', {password: this.$.password.value});
36 activeChanged: function() {
37 clearTimeout(this.timerId);
38 this.timerId = undefined;
40 this.style.visibility = 'visible';
41 this.style.opacity = 1;
42 this.successMessage = '';
43 this.$.password.focus();
45 this.style.opacity = 0;
46 this.timerId = setTimeout(function() {
47 this.style.visibility = 'hidden'