123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- <link href='http://fonts.googleapis.com/css?family=Lora:700' rel='stylesheet' type='text/css'>
-
- <template id="card-title">
- <style>
- :host {
- font-family: Lora, 'Calisto MT', 'Bookman Old Style', Bookman, 'Goudy Old Style', Garamond, 'Hoefler Text', 'Bitstream Charter', Georgia, serif;
- font-variant: small-caps;
- font-weight: bold;
- background-color: inherit;
- color: white;
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 30px;
- }
-
- ::content > h1 {
- flex: 1;
- font-family: inherit;
- display: block;
- margin: 0;
- padding-left: 6px;
- }
-
- ::content > h2 {
- font-size: 18pt;
- font-family: inherit;
- display: block;
- margin: 0;
- margin-right: 2px;
- }
-
- ::content > card-icon {
- height: 28px;
- }
-
- </style>
-
- <style id="font-size">
- ::content > h1 {font-size: 13pt;}
- </style>
-
- <content></content>
-
- </template>
-
- <script>
- (function(window, document) {
- var elemName = 'card-title';
- var mainDoc = document;
- var importDoc = document.currentScript.ownerDocument;
-
- var proto = Object.create(HTMLElement.prototype);
- Object.defineProperty(proto, "size", {
- get: function () {
- return "";
- },
- set: function (value) {
- var root = this.shadowRoot;
- var style = root.getElementById("font-size");
- style.innerHTML = "::content > h1 {font-size: " + value + "pt;}";
- }
- });
- proto.createdCallback = function () {
- var template = importDoc.getElementById(elemName);
- var clone = mainDoc.importNode(template.content, true);
- var root = this.createShadowRoot();
- root.appendChild(clone);
-
- this.size = this.getAttribute('size') || "13";
- }
- proto.attributeChangedCallback = function (name, oldValue, newValue) {
- switch (name) {
- case "size": this.size = newValue; break;
- }
- }
-
- mainDoc.registerElement(elemName, { prototype: proto });
-
- })(window, document);
- </script>
|