설명 없음
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.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <link href='http://fonts.googleapis.com/css?family=Lora:700' rel='stylesheet' type='text/css'>
  2. <template id="card-title">
  3. <style>
  4. :host {
  5. font-family: Lora, 'Calisto MT', 'Bookman Old Style', Bookman, 'Goudy Old Style', Garamond, 'Hoefler Text', 'Bitstream Charter', Georgia, serif;
  6. font-variant: small-caps;
  7. font-weight: bold;
  8. background-color: inherit;
  9. color: white;
  10. display: flex;
  11. justify-content: space-between;
  12. align-items: center;
  13. height: 30px;
  14. }
  15. ::content > h1 {
  16. flex: 1;
  17. font-family: inherit;
  18. display: block;
  19. margin: 0;
  20. padding-left: 6px;
  21. }
  22. ::content > h2 {
  23. font-size: 18pt;
  24. font-family: inherit;
  25. display: block;
  26. margin: 0;
  27. margin-right: 2px;
  28. }
  29. ::content > card-icon {
  30. height: 28px;
  31. }
  32. </style>
  33. <style id="font-size">
  34. ::content > h1 {font-size: 13pt;}
  35. </style>
  36. <content></content>
  37. </template>
  38. <script>
  39. (function(window, document) {
  40. var elemName = 'card-title';
  41. var mainDoc = document;
  42. var importDoc = document.currentScript.ownerDocument;
  43. var proto = Object.create(HTMLDivElement.prototype);
  44. Object.defineProperty(proto, "size", {
  45. get: function () {
  46. return "";
  47. },
  48. set: function (value) {
  49. var root = this.shadowRoot;
  50. var style = root.getElementById("font-size");
  51. style.innerHTML = "::content > h1 {font-size: " + value + "pt;}";
  52. }
  53. });
  54. proto.createdCallback = function () {
  55. var template = importDoc.getElementById(elemName);
  56. var clone = mainDoc.importNode(template.content, true);
  57. var root = this.createShadowRoot();
  58. root.appendChild(clone);
  59. this.size = this.getAttribute('size') || "13";
  60. }
  61. proto.attributeChangedCallback = function (name, oldValue, newValue) {
  62. switch (name) {
  63. case "size": this.size = newValue; break;
  64. }
  65. }
  66. mainDoc.registerElement(elemName, { prototype: proto });
  67. })(window, document);
  68. </script>