설명 없음
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-front.html 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <link href='http://fonts.googleapis.com/css?family=Noto+Sans:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
  2. <link href='http://fonts.googleapis.com/css?family=Lora:700' rel='stylesheet' type='text/css'>
  3. <template id="card-front">
  4. <style>
  5. #card {
  6. /* Fill the whole area of the shadow root */
  7. width: 100%;
  8. height: 100%;
  9. /* Border */
  10. border: 2mm solid;
  11. border-radius: 4px;
  12. box-sizing: border-box;
  13. /* Flex display of children */
  14. position: relative;
  15. display: flex;
  16. flex-direction: column;
  17. /* Font */
  18. font-family: 'Noto Sans', 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif;
  19. font-size: 8pt;
  20. }
  21. #content-container {
  22. padding:2mm;
  23. padding-top:1mm;
  24. border-radius: 2mm;
  25. margin-top:0px;
  26. background-color: white;
  27. border-color: inherit;
  28. display: flex;
  29. flex-direction: column;
  30. flex: 1;
  31. font-size: inherit;
  32. }
  33. #icon {
  34. width: 7mm;
  35. height: 7mm;
  36. background-repeat: no-repeat;
  37. background-size: contain;
  38. background-color: inherit;
  39. border-color: inherit;
  40. }
  41. #icon-container {
  42. position: absolute;
  43. right: -1mm;
  44. top: -1mm;
  45. border: 1mm solid;
  46. border-radius: 1mm;
  47. background-color: inherit;
  48. border-color: inherit;
  49. }
  50. </style>
  51. <div id="card">
  52. <div id="icon-container">
  53. <div id="icon"></div>
  54. </div>
  55. <content select="card-title"></content>
  56. <div id="content-container">
  57. <content select="card-contents"></content>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. (function(window, document) {
  63. var elemName = 'card-front';
  64. var thatDoc = document;
  65. var thisDoc = (thatDoc.currentScript || thatDoc._currentScript).ownerDocument;
  66. var proto = Object.create(HTMLElement.prototype, {
  67. createdCallback: {
  68. value: function() {
  69. var template = thisDoc.getElementById(elemName);
  70. var clone = thatDoc.importNode(template.content, true);
  71. this.createShadowRoot().appendChild(clone);
  72. }
  73. },
  74. attachedCallback: {
  75. value: function () {
  76. var root = this.shadowRoot;
  77. var color = "black";
  78. for (var i = 0; i < this.attributes.length; i++) {
  79. var attribute = this.attributes[i];
  80. switch (attribute.name) {
  81. case "color": color = attribute.value;
  82. }
  83. }
  84. var cardStyle = root.getElementById("card").style;
  85. cardStyle.color = color;
  86. cardStyle.backgroundColor = color;
  87. cardStyle.borderColor = color;
  88. }
  89. }
  90. });
  91. thatDoc.registerElement(elemName, {prototype: proto});
  92. })(window, document);
  93. </script>