| OLD | NEW |
| (Empty) | |
| 1 <!-- |
| 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS |
| 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/PATEN
TS |
| 9 --> |
| 10 <!doctype html> |
| 11 <html> |
| 12 <head> |
| 13 <title>paper-progress demo</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="../../webcomponentsjs/webcomponents-lite.js"></script> |
| 20 <link rel="import" href="../../paper-styles/paper-styles.html"> |
| 21 <link rel="import" href="../../paper-styles/demo-pages.html"> |
| 22 <link rel="import" href="../paper-progress.html"> |
| 23 <link rel="import" href="../../paper-button/paper-button.html"> |
| 24 |
| 25 <style is="custom-style"> |
| 26 body { |
| 27 padding: 40px; |
| 28 } |
| 29 |
| 30 paper-progress { |
| 31 display: block; |
| 32 width: 100%; |
| 33 padding-top: 20px; |
| 34 padding-bottom: 20px; |
| 35 } |
| 36 |
| 37 paper-progress.blue { |
| 38 --paper-progress-active-color: var(--paper-light-blue-500); |
| 39 --paper-progress-secondary-color: var(--paper-light-blue-100); |
| 40 } |
| 41 |
| 42 paper-progress.red { |
| 43 --paper-progress-active-color: var(--paper-red-500); |
| 44 --paper-progress-secondary-color: var(--paper-red-100); |
| 45 } |
| 46 |
| 47 paper-progress.orange { |
| 48 --paper-progress-active-color: var(--paper-orange-500); |
| 49 --paper-progress-secondary-color: var(--paper-orange-100); |
| 50 } |
| 51 |
| 52 paper-progress.green { |
| 53 --paper-progress-active-color: var(--paper-light-green-500); |
| 54 --paper-progress-secondary-color: var(--paper-light-green-100); |
| 55 } |
| 56 </style> |
| 57 |
| 58 </head> |
| 59 <body> |
| 60 <div class="vertical layout"> |
| 61 <h4>Progress bar</h4> |
| 62 <div class="vertical-section"> |
| 63 <paper-progress></paper-progress> |
| 64 <paper-button raised onclick="startProgress();">Start</paper-button> |
| 65 </div> |
| 66 |
| 67 <h4>Indeterminate</h4> |
| 68 <div class="vertical-section"> |
| 69 <paper-progress indeterminate></paper-progress><br> |
| 70 <paper-progress class="blue" indeterminate alue="800" min="100" max="1000"
></paper-progress><br> |
| 71 </div> |
| 72 |
| 73 <h4>Color</h4> |
| 74 <div class="vertical-section"> |
| 75 <paper-progress value="40" class="blue"></paper-progress><br> |
| 76 <paper-progress value="800" min="100" max="1000" class="red"></paper-progr
ess><br> |
| 77 <paper-progress value="40" class="orange"></paper-progress><br> |
| 78 <paper-progress value="200" max="200" class="green"></paper-progress><br> |
| 79 <paper-progress value="40" secondary-progress="80" class="blue"></paper-pr
ogress><br> |
| 80 </div> |
| 81 </div> |
| 82 |
| 83 <script> |
| 84 |
| 85 var progress = document.querySelector('paper-progress'); |
| 86 var button = document.querySelector('paper-button'); |
| 87 |
| 88 var repeat, maxRepeat = 5, animating = false; |
| 89 |
| 90 function nextProgress() { |
| 91 animating = true; |
| 92 if (progress.value < progress.max) { |
| 93 progress.value += (progress.step || 1); |
| 94 } else { |
| 95 if (++repeat >= maxRepeat) { |
| 96 animating = false; |
| 97 button.disabled = false; |
| 98 return; |
| 99 } |
| 100 progress.value = progress.min; |
| 101 } |
| 102 |
| 103 requestAnimationFrame(nextProgress); |
| 104 } |
| 105 |
| 106 function startProgress() { |
| 107 repeat = 0; |
| 108 progress.value = progress.min; |
| 109 button.disabled = true; |
| 110 if (!animating) { |
| 111 nextProgress(); |
| 112 } |
| 113 } |
| 114 |
| 115 window.addEventListener('WebComponentsReady', function() { |
| 116 startProgress(); |
| 117 }); |
| 118 |
| 119 </script> |
| 120 |
| 121 </body> |
| 122 </html> |
| OLD | NEW |