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