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

Side by Side Diff: elements/viewer-progress-bar/viewer-progress-bar.html

Issue 152913003: Add page indicator and progress bar polymer elements (Closed) Base URL: https://chromium.googlesource.com/chromium/html-office-public.git@master
Patch Set: Created 6 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 <polymer-element name="viewer-progress-bar" attributes="progress text">
2 <template>
3 <link rel="stylesheet" href="viewer-progress-bar.css">
4 <div class="scaler">
5 <ul id="segments"></ul>
6 <div class="center-circle"></div>
7 </div>
8 <div id="text">{{text}}</div>
9 </template>
10 <script>
11 Polymer('viewer-progress-bar', {
12 progress: 0,
13 text: 'Loading',
14 segments: [],
15 ready: function() {
16 var NUM_SEGMENTS = 8;
ganetsky1 2014/02/05 16:55:20 You could make this component more resuable and co
raymes 2014/02/07 00:33:41 I had a try at doing this but the math to do the s
raymes 2014/02/10 01:47:45 I ended up changing this to be generic. Done!
17 for (var i = 0; i < NUM_SEGMENTS; ++i) {
18 var segment = document.createElement('li');
19 segment.classList.add('segment');
20 this.$.segments.appendChild(segment);
ganetsky1 2014/02/05 16:55:20 It would be better if you just cloned a DOM nome i
raymes 2014/02/07 00:33:41 I tried to do the templating but it didn't work fo
21 this.segments.push(segment);
22 }
23 this.progressChanged();
24 },
25 progressChanged: function() {
26 var numVisible = this.progress * this.segments.length / 100.0;
27 for (var i = 0; i < this.segments.length; i++) {
28 this.segments[i].style.visibility =
29 i < numVisible ? 'visible' : 'hidden';
30 }
31
32 if (this.progress == 100)
33 this.style.opacity = 0;
34 },
35 });
36 </script>
37 </polymer-element>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698