blob: b6d37b64a0485a791bbdf8ee44bc492d1c0780a6 [file] [log] [blame]
Leo Repp56904d22021-04-26 15:53:22 +02001requirejs.config({
2 baseUrl: '../js/src'
3 });
4 // here alwaysmenu instead of normal menu, then + alwaysEntry
5 require(['alwaysmenu','menu/item', 'menu/prefix', 'menu/lengthField', 'selectMenu', 'hint/item', 'hint/lengthField',
6 //'alwaysmenu/alwaysentry'
7 'alwaysentry'
8 ],
9 function (alwaysMenuClass, itemClass, prefixClass, lengthFieldClass, selectMenuClass, hintItemClass, hintLengthField, alwaysEntryClass) {
10
11 /**
12 * Create own menu item class.
13 */
14 var OwnMenuItemClass = {
15 create : function (params) {
16 return Object.create(itemClass).upgradeTo(this)._init(params);
17 },
18
19 // content function
20 content : function (content) {
21 if (arguments.length === 1) {
22 this._content = content;
23 };
24 return this._content;
25 },
26
27 // enter or click
28 onclick : function () {
29 console.log(this._name);
30 },
31
32 // right arrow
33 further : function () {
34 console.log("Further: " + this._name);
35 },
36
37 // initialize item
38 _init : function (params) {
39 if (params[0] === undefined)
40 throw new Error("Missing parameters");
41
42 this._name = params[0];
43 this._content = document.createTextNode(this._name);
44 this._lcField = ' ' + this.content().textContent.toLowerCase();
45 return this;
46 }
47 };
48
49 /**
50 * Create own prefix class.
51 */
52 var OwnPrefixClass = {
53 create : function () {
54 return Object.create(prefixClass)
55 .upgradeTo(this)
56 ._init();
57 },
58 onclick : function () {
59 console.log('Prefix: ' + this.value());
60 }
61 };
62
63 /**
64 * Create own alwaysEntry class.
65 */
66 var OwnEntryClass = {
67 create : function () {
68 return alwaysEntryClass.create("Save")
69 .upgradeTo(this);
70 //._init();
71 },
72 onclick : function () {
73 console.log('Entry: ' + this.value());
74 }
75 };
76
77 /**
78 * Create own menu class.
79 */
80
81 var OwnMenu = {
82 create : function (list) {
83 const params = {
84 itemClass : OwnMenuItemClass,
85 prefixClass : OwnPrefixClass,
86 lengthFieldClass : lengthFieldClass,
87 alwaysEntryClass : OwnEntryClass
88 };
89 console.log("Am now in OwnMenu create",alwaysMenuClass); // we learn, that it definetly has all the functions defined in alwaysmenu.js
90 var obj = alwaysMenuClass.create(list,params)
91 .upgradeTo(this);
92 //._init(list, params);
93 obj._firstActive = true;
94 return obj;
95 }
96 };
97
98 var menu = OwnMenu.create([
99 ['Titel', 'title', 'string'],
100 ['Untertitel', 'subTitle', 'string'],
101 ['Beschreibung', 'desc', 'string'],
102 ['Veröffentlichungsdatum', 'pubDate', 'date'],
103 ['Länge', 'length', 'integer'],
104 ['Autor', 'author', 'string'],
105 ['Genre', 'genre', 'string'],
106 ['corpusID', 'corpusID', 'string'],
107 ['docID', 'docID', 'string'],
108 ['textID', 'textID', 'string']
109 ]);
110
111 /*
112 var largeMenu = alwaysMenuClass.create([
113 // http://www.ids-mannheim.de/cosmas2/projekt/referenz/stts/morph.html
114 // http://nachhalt.sfb632.uni-potsdam.de/owl-docu/stts.html
115 // "$.", "$(", "$,"
116 ["ADJA","ADJA ", "Attributive Adjective"],
117 ["ADJD","ADJD ", "Predicative Adjective"],
118 ["ADV","ADV ", "Adverb"],
119 ["APPO","APPO ", "Postposition"],
120 ["APPR","APPR ", "Preposition"],
121 ["APPRART","APPRART ", "Preposition with Determiner"],
122 ["APZR","APZR ","Right Circumposition"],
123 ["ART","ART ", "Determiner"],
124 ["CARD","CARD ", "Cardinal Number"],
125 ["FM","FM ", "Foreign Material"],
126 ["ITJ","ITJ ", "Interjection"],
127 ["KOKOM","KOKOM ", "Comparison Particle"],
128 ["KON","KON ", "Coordinating Conjuncion"],
129 ["KOUI","KOUI ", "Subordinating Conjunction with 'zu'"],
130 ["KOUS","KOUS ", "Subordinating Conjunction with Sentence"],
131 ["NE","NE ", "Named Entity"],
132 ["NN","NN ", "Normal Nomina"],
133 ["PAV", "PAV ", "Pronominal Adverb"],
134 ["PDAT","PDAT ","Attributive Demonstrative Pronoun"],
135 ["PDS","PDS ", "Substitutive Demonstrative Pronoun"],
136 ["PIAT","PIAT ", "Attributive Indefinite Pronoun without Determiner"],
137 ["PIDAT","PIDAT ", "Attributive Indefinite Pronoun with Determiner"],
138 ["PIS","PIS ", "Substitutive Indefinite Pronoun"],
139 ["PPER","PPER ", "Personal Pronoun"],
140 ["PPOSAT","PPOSAT ", "Attributive Possessive Pronoun"],
141 ["PPOSS","PPOSS ", "Substitutive Possessive Pronoun"],
142 ["PRELAT","PRELAT ", "Attributive Relative Pronoun"],
143 ["PRELS","PRELS ", "Substitutive Relative Pronoun"],
144 ["PRF","PRF ", "Reflexive Pronoun"],
145 ["PROAV","PROAV ", "Pronominal Adverb"],
146 ["PTKA","PTKA ","Particle with Adjective"],
147 ["PTKANT","PTKANT ", "Answering Particle"],
148 ["PTKNEG","PTKNEG ", "Negation Particle"],
149 ["PTKVZ","PTKVZ ", "Separated Verbal Particle"],
150 ["PTKZU","PTKZU ", "'zu' Particle"],
151 ["PWAT","PWAT ", "Attributive Interrogative Pronoun"],
152 ["PWAV","PWAV ", "Adverbial Interrogative Pronoun"],
153 ["PWS","PWS ", "Substitutive Interrogative Pronoun"],
154 ["TRUNC","TRUNC ","Truncated"],
155 ["VAFIN","VAFIN ", "Auxiliary Finite Verb"],
156 ["VAIMP","VAIMP ", "Auxiliary Finite Imperative Verb"],
157 ["VAINF","VAINF ", "Auxiliary Infinite Verb"],
158 ["VAPP","VAPP ", "Auxiliary Perfect Participle"],
159 ["VMFIN","VMFIN ", "Modal Finite Verb"],
160 ["VMINF","VMINF ", "Modal Infinite Verb"],
161 ["VMPP","VMPP ", "Modal Perfect Participle"],
162 ["VVFIN","VVFIN ","Finite Verb"],
163 ["VVIMP","VVIMP ", "Finite Imperative Verb"],
164 ["VVINF","VVINF ", "Infinite Verb"],
165 ["VVIZU","VVIZU ", "Infinite Verb with 'zu'"],
166 ["VVPP","VVPP ", "Perfect Participle"],
167 ["XY", "XY ", "Non-Word"]
168 ], { 'itemClass' : hintItemClass, 'lengthField' : hintLengthField , 'alwaysEntryClass' : OwnEntryClass});
169 */
170
171 /*var multiMenu = multiMenuClass.create([
172 ["textSigle", "textSigle"],
173 ["author", "author"]
174 ]);
175 */
176
177 document.getElementById('menu').appendChild(menu.element());
178 //document.getElementById('largemenu').appendChild(largeMenu.element());
179 // document.getElementById('multimenu').appendChild(multiMenu.element());
180
181 menu.limit(3).show(3);
182 menu.focus();
183
184 selectMenuClass.create(document.getElementById('choose-ql')).limit(5); // .show();
185 //largeMenu.limit(8).show(3);
186 });
187