-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/staging'
- Loading branch information
Showing
47 changed files
with
1,710 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* The meta element is placed in the ts:token element and provides metadata details for the tokenscript file. | ||
* Currently, description & aboutUrl are used. | ||
* It supports multi-language | ||
*/ | ||
export class Meta { | ||
|
||
private static META_TAGS = ["description", "aboutUrl"]; | ||
|
||
private readonly meta: {[metaTag: string]: string} = {}; | ||
|
||
constructor(private parentElem: Element) { | ||
|
||
const meta = parentElem.getElementsByTagName("ts:meta"); | ||
|
||
if (meta.length && meta[0].children.length){ | ||
|
||
for (const tag of Meta.META_TAGS) { | ||
|
||
const elements: Element[] = [].slice.call(meta[0].getElementsByTagName("ts:" + tag)); | ||
|
||
if (!elements.length) | ||
continue; | ||
|
||
// TODO: get meta based on locale | ||
const langLabels = elements.filter((elem) => elem.getAttribute("xml:lang") === "en") | ||
|
||
this.meta[tag] = langLabels.length ? langLabels[0].textContent : elements[0].textContent; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* The applicable value of the meta, based on the pluralQty provided | ||
* @param name | ||
*/ | ||
public getValue(name: string){ | ||
|
||
if (!this.meta[name]) | ||
return null; | ||
|
||
return this.meta[name]; | ||
} | ||
|
||
get description(){ | ||
return this.getValue("description") | ||
} | ||
|
||
get aboutUrl(){ | ||
return this.getValue("aboutUrl") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+320 Bytes
javascript/tokenscript-viewer/src/assets/icon/joyid/arrow-square-down.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
javascript/tokenscript-viewer/src/assets/icon/question.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+528 KB
javascript/tokenscript-viewer/src/assets/tokenscript-icons/smart-cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
165 changes: 109 additions & 56 deletions
165
javascript/tokenscript-viewer/src/assets/tokenscripts/smart-cat-prod.tsml
Large diffs are not rendered by default.
Oops, something went wrong.
171 changes: 114 additions & 57 deletions
171
javascript/tokenscript-viewer/src/assets/tokenscripts/smart-cat.tsml
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.