blob: 9d59af33e1bf7c20126acbb8ac2cd17a69dbda35 [file] [log] [blame]
Akron30ee5142015-06-26 01:50:14 +02001/*
2 author, editor title, subTitle textSigle
3 in corpusAuthor (corpusEditor), corpusTitle, corpusSubTitle, corpusSigle
4 in docAuthor (docEditor), docTitle, docSubTitle, docSigle
5 publisher
6 reference
7 creationDate
8 foundries
9 keywords
10 textClass
11 textColumn
12 textDomain
13 textType
14 textTypeArt
15 textTypeRef
16 language
17 license
18 pages
19 pubDate
20 layerInfo
21 tokenSource
22 biblEditionStatement
23 fileEditionStatement
24*/
25define(function () {
Akron24866cf2018-01-23 20:22:01 +010026 return {
27
28 /**
29 * Create new match object
30 */
31 create : function (match) {
32 return Object.create(this)._init(match);
33 },
34
35 /**
36 * Initialize object
37 */
38 _init : function (match) {
39 this._match = match;
40 this.opened = false;
41 return this;
42 },
43
44 /**
45 * Get match object
46 */
47 match : function () {
48 return this._match;
49 },
50
51 /**
52 * Create match reference view.
53 */
54 element : function (metaInfo) {
55 if (this._element !== undefined)
56 return this._element;
57
58 var metaTable = document.createElement('dl');
59 metaTable.classList.add('metatable');
60
61 this._element = metaTable;
62
63 // TODO: Meta fields should be separated
64 var keys = Object.keys(metaInfo);
65 for (var i in keys.sort()) {
66 var k = keys[i];
67 if (k !== "UID" &&
68 k !== "corpusID" &&
69 k !== "docID" &&
70 k !== "textID" &&
71 k !== "corpusSigle" &&
72 k !== "docSigle" &&
73 k !== "layerInfos") {
74
75 var metaL = document.createElement('div');
76 metaL.appendChild(
77 document.createElement('dt')
78 ).appendChild(
79 document.createTextNode(k)
80 );
81
82 metaL.appendChild(
83 document.createElement('dd')
84 ).appendChild(
85 document.createTextNode(metaInfo[k])
86 );
87
88 metaTable.appendChild(metaL);
89 };
90 };
91
92 return this._element;
93 }
94 };
Akron30ee5142015-06-26 01:50:14 +020095});