OLD | NEW |
| (Empty) |
1 <!-- | |
2 @license | |
3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | |
4 This code may only be used under the BSD style license found at http://polym
er.github.io/LICENSE.txt | |
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS
.txt | |
6 The complete set of contributors may be found at http://polymer.github.io/CO
NTRIBUTORS.txt | |
7 Code distributed by Google as part of the polymer project is also | |
8 subject to an additional IP rights grant found at http://polymer.github.io/P
ATENTS.txt | |
9 --> | |
10 <!doctype html> | |
11 <html> | |
12 <head> | |
13 <title>paper-progress</title> | |
14 | |
15 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> | |
16 <meta name="mobile-web-app-capable" content="yes"> | |
17 <meta name="apple-mobile-web-app-capable" content="yes"> | |
18 | |
19 <script src="../platform/platform.js"></script> | |
20 | |
21 <link rel="import" href="paper-progress.html"> | |
22 <link rel="import" href="../paper-button/paper-button.html"> | |
23 | |
24 <style shim-shadowdom> | |
25 | |
26 body { | |
27 font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial; | |
28 margin: 0; | |
29 padding: 24px; | |
30 } | |
31 | |
32 paper-progress { | |
33 display: block; | |
34 width: 100%; | |
35 padding: 25px 0; | |
36 } | |
37 | |
38 paper-progress.pink::shadow #activeProgress { | |
39 background-color: #e91e63; | |
40 } | |
41 | |
42 paper-progress.pink::shadow #secondaryProgress { | |
43 background-color: #f8bbd0; | |
44 } | |
45 | |
46 </style> | |
47 | |
48 </head> | |
49 <body unresolved> | |
50 | |
51 <paper-progress></paper-progress> | |
52 | |
53 <paper-button raised onclick="startProgress();">Start</paper-button> | |
54 | |
55 <br><br><br> | |
56 | |
57 <paper-progress value="40"></paper-progress><br> | |
58 | |
59 <paper-progress value="800" min="100" max="1000"></paper-progress><br> | |
60 | |
61 <paper-progress value="40" secondaryProgress="80"></paper-progress><br> | |
62 | |
63 <paper-progress value="200" max="200"></paper-progress><br> | |
64 | |
65 <paper-progress class="pink" value="80"></paper-progress><br> | |
66 | |
67 <paper-progress class="pink" value="40" secondaryProgress="80"></paper-progres
s> | |
68 | |
69 <script> | |
70 | |
71 var progress = document.querySelector('paper-progress'); | |
72 var button = document.querySelector('paper-button'); | |
73 | |
74 var repeat, maxRepeat = 5, animating = false; | |
75 | |
76 function nextProgress() { | |
77 animating = true; | |
78 if (progress.value < progress.max) { | |
79 progress.value += (progress.step || 1); | |
80 } else { | |
81 if (++repeat >= maxRepeat) { | |
82 animating = false; | |
83 button.disabled = false; | |
84 return; | |
85 } | |
86 progress.value = progress.min; | |
87 } | |
88 progress.async(nextProgress); | |
89 } | |
90 | |
91 function startProgress() { | |
92 repeat = 0; | |
93 progress.value = progress.min; | |
94 button.disabled = true; | |
95 if (!animating) { | |
96 nextProgress(); | |
97 } | |
98 } | |
99 | |
100 addEventListener('polymer-ready', function() { | |
101 startProgress(); | |
102 }); | |
103 | |
104 </script> | |
105 | |
106 </body> | |
107 </html> | |
OLD | NEW |