| OLD | NEW |
| 1 <polymer-element name="viewer-toolbar" attributes="fadingIn" | 1 <polymer-element name="viewer-toolbar" attributes="fadingIn" |
| 2 on-mouseover="{{fadeIn}}" on-mousemove="{{fadeIn}}" | 2 on-mouseover="{{fadeIn}}" on-mousemove="{{fadeIn}}" |
| 3 on-mouseout="{{fadeOut}}"> | 3 on-mouseout="{{fadeOut}}"> |
| 4 <template> | 4 <template> |
| 5 <link rel="stylesheet" href="viewer-toolbar.css"> | 5 <link rel="stylesheet" href="viewer-toolbar.css"> |
| 6 <div id="toolbar"> | 6 <div id="toolbar"> |
| 7 <content></content> | 7 <content></content> |
| 8 </div> | 8 </div> |
| 9 </template> | 9 </template> |
| 10 <script> | 10 <script> |
| 11 Polymer('viewer-toolbar', { | 11 Polymer('viewer-toolbar', { |
| 12 fadingIn: false, | 12 fadingIn: false, |
| 13 timerId: undefined, | 13 timerId: undefined, |
| 14 ready: function() { | 14 ready: function() { |
| 15 this.fadingInChanged(); | 15 this.fadingInChanged(); |
| 16 }, | 16 }, |
| 17 fadeIn: function() { | 17 fadeIn: function() { |
| 18 this.fadingIn = true; | 18 this.fadingIn = true; |
| 19 }, | 19 }, |
| 20 fadeOut: function() { | 20 fadeOut: function() { |
| 21 this.fadingIn = false; | 21 this.fadingIn = false; |
| 22 }, | 22 }, |
| 23 fadingInChanged: function() { | 23 fadingInChanged: function() { |
| 24 if (this.fadingIn) { | 24 if (this.fadingIn) { |
| 25 this.style.opacity = 1; | 25 this.style.opacity = 1; |
| 26 if (this.timerId !== undefined) { | 26 if (this.timerId !== undefined) { |
| 27 clearTimeout(this.timerId); | 27 clearTimeout(this.timerId); |
| 28 this.timerId = undefined; | 28 this.timerId = undefined; |
| 29 } | 29 } |
| 30 } else { | 30 } else { |
| 31 if (this.timerId === undefined) { | 31 if (this.timerId === undefined) { |
| 32 this.timerId = setTimeout( | 32 this.timerId = setTimeout( |
| 33 function() { | 33 function() { |
| 34 this.style.opacity = 0; | 34 this.style.opacity = 0; |
| 35 this.timerId = undefined; | 35 this.timerId = undefined; |
| 36 }.bind(this), 3000); | 36 }.bind(this), 3000); |
| 37 } | |
| 38 } | 37 } |
| 39 } | 38 } |
| 40 }); | 39 } |
| 41 </script> | 40 }); |
| 41 </script> |
| 42 </polymer-element> | 42 </polymer-element> |
| OLD | NEW |