| requirejs.config({ | |
| baseUrl: '../js/src' | |
| }); | |
| // here alwaysmenu instead of normal menu, then + alwaysEntry | |
| require(['alwaysmenu','menu/item', 'menu/prefix', 'menu/lengthField', 'selectMenu', 'hint/item', 'hint/lengthField', | |
| //'alwaysmenu/alwaysentry' | |
| 'alwaysentry' | |
| ], | |
| function (alwaysMenuClass, itemClass, prefixClass, lengthFieldClass, selectMenuClass, hintItemClass, hintLengthField, alwaysEntryClass) { | |
| /** | |
| * Create own menu item class. | |
| */ | |
| var OwnMenuItemClass = { | |
| create : function (params) { | |
| return Object.create(itemClass).upgradeTo(this)._init(params); | |
| }, | |
| // content function | |
| content : function (content) { | |
| if (arguments.length === 1) { | |
| this._content = content; | |
| }; | |
| return this._content; | |
| }, | |
| // enter or click | |
| onclick : function () { | |
| console.log(this._name); | |
| }, | |
| // right arrow | |
| further : function () { | |
| console.log("Further: " + this._name); | |
| }, | |
| // initialize item | |
| _init : function (params) { | |
| if (params[0] === undefined) | |
| throw new Error("Missing parameters"); | |
| this._name = params[0]; | |
| this._content = document.createTextNode(this._name); | |
| this._lcField = ' ' + this.content().textContent.toLowerCase(); | |
| return this; | |
| } | |
| }; | |
| /** | |
| * Create own prefix class. | |
| */ | |
| var OwnPrefixClass = { | |
| create : function () { | |
| return Object.create(prefixClass) | |
| .upgradeTo(this) | |
| ._init(); | |
| }, | |
| onclick : function () { | |
| console.log('Prefix: ' + this.value()); | |
| } | |
| }; | |
| /** | |
| * Create own alwaysEntry class. | |
| */ | |
| var OwnEntryClass = { | |
| create : function () { | |
| return alwaysEntryClass.create("Save") | |
| .upgradeTo(this); | |
| //._init(); | |
| }, | |
| onclick : function () { | |
| console.log('Entry: ' + this.value()); | |
| } | |
| }; | |
| /** | |
| * Create own menu class. | |
| */ | |
| var OwnMenu = { | |
| create : function (list) { | |
| const params = { | |
| itemClass : OwnMenuItemClass, | |
| prefixClass : OwnPrefixClass, | |
| lengthFieldClass : lengthFieldClass, | |
| alwaysEntryClass : OwnEntryClass | |
| }; | |
| console.log("Am now in OwnMenu create",alwaysMenuClass); // we learn, that it definetly has all the functions defined in alwaysmenu.js | |
| var obj = alwaysMenuClass.create(list,params) | |
| .upgradeTo(this); | |
| //._init(list, params); | |
| obj._firstActive = true; | |
| return obj; | |
| } | |
| }; | |
| var menu = OwnMenu.create([ | |
| ['Titel', 'title', 'string'], | |
| ['Untertitel', 'subTitle', 'string'], | |
| ['Beschreibung', 'desc', 'string'], | |
| ['Veröffentlichungsdatum', 'pubDate', 'date'], | |
| ['Länge', 'length', 'integer'], | |
| ['Autor', 'author', 'string'], | |
| ['Genre', 'genre', 'string'], | |
| ['corpusID', 'corpusID', 'string'], | |
| ['docID', 'docID', 'string'], | |
| ['textID', 'textID', 'string'] | |
| ]); | |
| /* | |
| var largeMenu = alwaysMenuClass.create([ | |
| // http://www.ids-mannheim.de/cosmas2/projekt/referenz/stts/morph.html | |
| // http://nachhalt.sfb632.uni-potsdam.de/owl-docu/stts.html | |
| // "$.", "$(", "$," | |
| ["ADJA","ADJA ", "Attributive Adjective"], | |
| ["ADJD","ADJD ", "Predicative Adjective"], | |
| ["ADV","ADV ", "Adverb"], | |
| ["APPO","APPO ", "Postposition"], | |
| ["APPR","APPR ", "Preposition"], | |
| ["APPRART","APPRART ", "Preposition with Determiner"], | |
| ["APZR","APZR ","Right Circumposition"], | |
| ["ART","ART ", "Determiner"], | |
| ["CARD","CARD ", "Cardinal Number"], | |
| ["FM","FM ", "Foreign Material"], | |
| ["ITJ","ITJ ", "Interjection"], | |
| ["KOKOM","KOKOM ", "Comparison Particle"], | |
| ["KON","KON ", "Coordinating Conjuncion"], | |
| ["KOUI","KOUI ", "Subordinating Conjunction with 'zu'"], | |
| ["KOUS","KOUS ", "Subordinating Conjunction with Sentence"], | |
| ["NE","NE ", "Named Entity"], | |
| ["NN","NN ", "Normal Nomina"], | |
| ["PAV", "PAV ", "Pronominal Adverb"], | |
| ["PDAT","PDAT ","Attributive Demonstrative Pronoun"], | |
| ["PDS","PDS ", "Substitutive Demonstrative Pronoun"], | |
| ["PIAT","PIAT ", "Attributive Indefinite Pronoun without Determiner"], | |
| ["PIDAT","PIDAT ", "Attributive Indefinite Pronoun with Determiner"], | |
| ["PIS","PIS ", "Substitutive Indefinite Pronoun"], | |
| ["PPER","PPER ", "Personal Pronoun"], | |
| ["PPOSAT","PPOSAT ", "Attributive Possessive Pronoun"], | |
| ["PPOSS","PPOSS ", "Substitutive Possessive Pronoun"], | |
| ["PRELAT","PRELAT ", "Attributive Relative Pronoun"], | |
| ["PRELS","PRELS ", "Substitutive Relative Pronoun"], | |
| ["PRF","PRF ", "Reflexive Pronoun"], | |
| ["PROAV","PROAV ", "Pronominal Adverb"], | |
| ["PTKA","PTKA ","Particle with Adjective"], | |
| ["PTKANT","PTKANT ", "Answering Particle"], | |
| ["PTKNEG","PTKNEG ", "Negation Particle"], | |
| ["PTKVZ","PTKVZ ", "Separated Verbal Particle"], | |
| ["PTKZU","PTKZU ", "'zu' Particle"], | |
| ["PWAT","PWAT ", "Attributive Interrogative Pronoun"], | |
| ["PWAV","PWAV ", "Adverbial Interrogative Pronoun"], | |
| ["PWS","PWS ", "Substitutive Interrogative Pronoun"], | |
| ["TRUNC","TRUNC ","Truncated"], | |
| ["VAFIN","VAFIN ", "Auxiliary Finite Verb"], | |
| ["VAIMP","VAIMP ", "Auxiliary Finite Imperative Verb"], | |
| ["VAINF","VAINF ", "Auxiliary Infinite Verb"], | |
| ["VAPP","VAPP ", "Auxiliary Perfect Participle"], | |
| ["VMFIN","VMFIN ", "Modal Finite Verb"], | |
| ["VMINF","VMINF ", "Modal Infinite Verb"], | |
| ["VMPP","VMPP ", "Modal Perfect Participle"], | |
| ["VVFIN","VVFIN ","Finite Verb"], | |
| ["VVIMP","VVIMP ", "Finite Imperative Verb"], | |
| ["VVINF","VVINF ", "Infinite Verb"], | |
| ["VVIZU","VVIZU ", "Infinite Verb with 'zu'"], | |
| ["VVPP","VVPP ", "Perfect Participle"], | |
| ["XY", "XY ", "Non-Word"] | |
| ], { 'itemClass' : hintItemClass, 'lengthField' : hintLengthField , 'alwaysEntryClass' : OwnEntryClass}); | |
| */ | |
| /*var multiMenu = multiMenuClass.create([ | |
| ["textSigle", "textSigle"], | |
| ["author", "author"] | |
| ]); | |
| */ | |
| document.getElementById('menu').appendChild(menu.element()); | |
| //document.getElementById('largemenu').appendChild(largeMenu.element()); | |
| // document.getElementById('multimenu').appendChild(multiMenu.element()); | |
| menu.limit(3).show(3); | |
| menu.focus(); | |
| selectMenuClass.create(document.getElementById('choose-ql')).limit(5); // .show(); | |
| //largeMenu.limit(8).show(3); | |
| }); | |