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

Side by Side Diff: elements/viewer-button/viewer-button.html

Issue 132333015: Use the assetpath for viewer-button in the PDF viewer toolbar (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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <polymer-element name="viewer-button" attributes="src latchable"> 1 <polymer-element name="viewer-button" attributes="src latchable">
2 <template> 2 <template>
3 <link rel="stylesheet" href="viewer-button.css"> 3 <link rel="stylesheet" href="viewer-button.css">
4 <div id="icon"></div> 4 <div id="icon"></div>
5 </template> 5 </template>
6 <script> 6 <script>
7 (function() { 7 (function() {
8 var dpi = ''; 8 var dpi = '';
9 9
10 Polymer('viewer-button', { 10 Polymer('viewer-button', {
11 src: '', 11 src: '',
12 latchable: false, 12 latchable: false,
13 ready: function() { 13 ready: function() {
14 if (!dpi) { 14 if (!dpi) {
15 var mql = window.matchMedia('(-webkit-min-device-pixel-ratio: 1.3'); 15 var mql = window.matchMedia('(-webkit-min-device-pixel-ratio: 1.3');
16 dpi = mql.matches ? 'hi' : 'low'; 16 dpi = mql.matches ? 'hi' : 'low';
17 } 17 }
18 }, 18 },
19 srcChanged: function() { 19 srcChanged: function() {
20 if (this.src) { 20 if (this.src) {
21 this.$.icon.style.backgroundImage = 21 this.$.icon.style.backgroundImage =
22 'url(elements/viewer-button/img/' + dpi + 'DPI/' + this.src + ')'; 22 'url(' + this.getAttribute('assetpath') + 'img/' + dpi +
23 'DPI/' + this.src + ')';
23 } else { 24 } else {
24 this.$.icon.style.backgroundImage = ''; 25 this.$.icon.style.backgroundImage = '';
25 } 26 }
26 }, 27 },
27 latchableChanged: function() { 28 latchableChanged: function() {
28 if (this.latchable) 29 if (this.latchable)
29 this.classList.add('latchable'); 30 this.classList.add('latchable');
30 else 31 else
31 this.classList.remove('latchable'); 32 this.classList.remove('latchable');
32 }, 33 },
33 }); 34 });
34 })(); 35 })();
35 </script> 36 </script>
36 </polymer-element> 37 </polymer-element>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698