OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 (function() { |
| 6 var dpi = ''; |
| 7 |
| 8 Polymer('viewer-button', { |
| 9 img: '', |
| 10 latchable: false, |
| 11 ready: function() { |
| 12 if (!dpi) { |
| 13 var mql = window.matchMedia('(-webkit-min-device-pixel-ratio: 1.3'); |
| 14 dpi = mql.matches ? 'hi' : 'low'; |
| 15 } |
| 16 }, |
| 17 imgChanged: function() { |
| 18 if (this.img) { |
| 19 this.$.icon.style.backgroundImage = |
| 20 'url(' + this.getAttribute('assetpath') + 'img/' + dpi + |
| 21 'DPI/' + this.img + ')'; |
| 22 } else { |
| 23 this.$.icon.style.backgroundImage = ''; |
| 24 } |
| 25 }, |
| 26 latchableChanged: function() { |
| 27 if (this.latchable) |
| 28 this.classList.add('latchable'); |
| 29 else |
| 30 this.classList.remove('latchable'); |
| 31 }, |
| 32 }); |
| 33 })(); |
OLD | NEW |