| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2014 The Polymer Project Authors. All rights reserved. | 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://polym
er.github.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS
.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CO
NTRIBUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 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/P
ATENTS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 <polymer-element name="sample-content" attributes="size"> | 10 <dom-module id="sample-content"> |
| 11 <template> |
| 12 <div id="content"></div> |
| 13 </template> |
| 14 </dom-module> |
| 15 |
| 11 <script> | 16 <script> |
| 12 | 17 |
| 13 (function() { | 18 (function() { |
| 14 | 19 |
| 15 var strings = [ | 20 var strings = [ |
| 16 'Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit o
portere ea.', | 21 'Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit o
portere ea.', |
| 17 'Ut labores minimum atomorum pro. Laudem tibique ut has.', | 22 'Ut labores minimum atomorum pro. Laudem tibique ut has.', |
| 18 'Fugit adolescens vis et, ei graeci forensibus sed.', | 23 'Fugit adolescens vis et, ei graeci forensibus sed.', |
| 19 'Convenire definiebas scriptorem eu cum. Sit dolor dicunt consectetuer no.
', | 24 'Convenire definiebas scriptorem eu cum. Sit dolor dicunt consectetuer no.
', |
| 20 'Ea duis bonorum nec, falli paulo aliquid ei eum.', | 25 'Ea duis bonorum nec, falli paulo aliquid ei eum.', |
| 21 'Usu eu novum principes, vel quodsi aliquip ea.', | 26 'Usu eu novum principes, vel quodsi aliquip ea.', |
| 22 'Has at minim mucius aliquam, est id tempor laoreet.', | 27 'Has at minim mucius aliquam, est id tempor laoreet.', |
| 23 'Pro saepe pertinax ei, ad pri animal labores suscipiantur.', | 28 'Pro saepe pertinax ei, ad pri animal labores suscipiantur.', |
| 24 'Detracto suavitate repudiandae no eum. Id adhuc minim soluta nam.', | 29 'Detracto suavitate repudiandae no eum. Id adhuc minim soluta nam.', |
| 25 'Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique s
plendide instructior.', | 30 'Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique s
plendide instructior.', |
| 26 'Id nam odio natum malorum, tibique copiosae expetenda mel ea.', | 31 'Id nam odio natum malorum, tibique copiosae expetenda mel ea.', |
| 27 'Cu mei vide viris gloriatur, at populo eripuit sit.', | 32 'Cu mei vide viris gloriatur, at populo eripuit sit.', |
| 28 'Modus commodo minimum eum te, vero utinam assueverit per eu.', | 33 'Modus commodo minimum eum te, vero utinam assueverit per eu.', |
| 29 'No nam ipsum lorem aliquip, accumsan quaerendum ei usu.' | 34 'No nam ipsum lorem aliquip, accumsan quaerendum ei usu.' |
| 30 ]; | 35 ]; |
| 31 | 36 |
| 32 function randomString() { | 37 function randomString() { |
| 33 return strings[Math.floor(Math.random() * strings.length)]; | 38 return strings[Math.floor(Math.random() * strings.length)]; |
| 34 } | 39 } |
| 35 | 40 |
| 36 function randomLetter() { | 41 function randomLetter() { |
| 37 return String.fromCharCode(65 + Math.floor(Math.random() * 26)); | 42 return String.fromCharCode(65 + Math.floor(Math.random() * 26)); |
| 38 } | 43 } |
| 39 | 44 |
| 40 Polymer('sample-content', { | 45 Polymer({ |
| 46 is: 'sample-content', |
| 41 | 47 |
| 42 size: 0, | 48 properties: { |
| 49 size: { |
| 50 type: Number, |
| 51 value: 0, |
| 52 observer: 'sizeChanged' |
| 53 } |
| 54 }, |
| 43 | 55 |
| 44 sizeChanged: function() { | 56 sizeChanged: function() { |
| 45 this.innerHTML = ''; | 57 var html = ''; |
| 46 for (var i = 0; i < this.size; i++) { | 58 for (var i = 0; i < this.size; i++) { |
| 47 this.innerHTML += | 59 html += |
| 48 '<div style="border: 1px solid #bebebe; padding: 16px; margin: 16px;
border-radius: 5px; background-color: #fff; color: #555;">' + | 60 '<div style="border: 1px solid #bebebe; padding: 16px; margin: 16px;
border-radius: 5px; background-color: #fff; color: #555;">' + |
| 49 '<div style="display: inline-block; height: 64px; width: 64px; borde
r-radius: 50%; background: #ddd; line-height: 64px; font-size: 30px; color: #666
; text-align: center;">'+ randomLetter() + '</div>' + | 61 '<div style="display: inline-block; height: 64px; width: 64px; borde
r-radius: 50%; background: #ddd; line-height: 64px; font-size: 30px; color: #666
; text-align: center;">'+ randomLetter() + '</div>' + |
| 50 '<div style="font-size: 22px; padding: 8px 0 16px; color: #888;">' +
randomString() + '</div>' + | 62 '<div style="font-size: 22px; padding: 8px 0 16px; color: #888;">' +
randomString() + '</div>' + |
| 51 '<div style="font-size: 16px; padding-bottom: 8px;">' + randomString
() + '</div>' + | 63 '<div style="font-size: 16px; padding-bottom: 8px;">' + randomString
() + '</div>' + |
| 52 '<div style="font-size: 12px;">' + randomString() + '</div>' + | 64 '<div style="font-size: 12px;">' + randomString() + '</div>' + |
| 53 '<div style="font-size: 12px;">' + randomString() + '</div>' + | 65 '<div style="font-size: 12px;">' + randomString() + '</div>' + |
| 54 '</div>'; | 66 '</div>'; |
| 67 this.$.content.innerHTML = html; |
| 55 } | 68 } |
| 56 } | 69 } |
| 57 | |
| 58 }); | 70 }); |
| 59 })(); | 71 })(); |
| 60 | |
| 61 </script> | 72 </script> |
| 62 </polymer-element> | |
| OLD | NEW |