No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

card-title.html 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <link href='http://fonts.googleapis.com/css?family=Lora:700' rel='stylesheet' type='text/css'>
  2. <template id="card-title">
  3. <style>
  4. #title {
  5. height: 8mm;
  6. padding-left: 2mm;
  7. font-family: Lora, 'Calisto MT', 'Bookman Old Style', Bookman, 'Goudy Old Style', Garamond, 'Hoefler Text', 'Bitstream Charter', Georgia, serif;
  8. font-variant: small-caps;
  9. font-weight: bold;
  10. background-color: inherit;
  11. color: white;
  12. }
  13. .title-16 {
  14. font-size: 16pt;
  15. line-height: 6.5mm;
  16. }
  17. .title-15 {
  18. font-size: 15pt;
  19. line-height: 6.5mm;
  20. }
  21. .title-14 {
  22. font-size: 14pt;
  23. line-height: 6.5mm;
  24. }
  25. .title-13 {
  26. font-size: 13pt;
  27. line-height: 7mm;
  28. }
  29. .title-12 {
  30. font-size: 12pt;
  31. line-height: 7mm;
  32. }
  33. .title-11 {
  34. font-size: 11pt;
  35. line-height: 7.5mm;
  36. }
  37. .title-10 {
  38. font-size: 10pt;
  39. line-height: 7.5mm;
  40. }
  41. </style>
  42. <div id="title">
  43. <content></content>
  44. </div>
  45. </template>
  46. <script>
  47. (function(window, document) {
  48. var elemName = 'card-title';
  49. var mainDoc = document;
  50. var importDoc = document.currentScript.ownerDocument;
  51. var proto = Object.create(HTMLElement.prototype);
  52. Object.defineProperty(proto, "size", {
  53. get: function() {
  54. return "";
  55. },
  56. set: function (value) {
  57. if (value > 16) value = 16;
  58. if (value < 10) value = 10;
  59. var root = this.shadowRoot;
  60. root.querySelector("#title").className = "title-" + value;
  61. }
  62. });
  63. proto.createdCallback = function () {
  64. var template = importDoc.getElementById(elemName);
  65. var clone = mainDoc.importNode(template.content, true);
  66. var root = this.createShadowRoot();
  67. root.appendChild(clone);
  68. this.size = this.getAttribute('size') || 13;
  69. }
  70. proto.attributeChangedCallback = function (name, value) {
  71. switch (name) {
  72. case "size": this.size = value;
  73. }
  74. }
  75. mainDoc.registerElement(elemName, { prototype: proto });
  76. })(window, document);
  77. </script>