Use requirejs for clientside scripting
diff --git a/dev/demo/menu.html b/dev/demo/menu.html
index 13f7ae9..f6d18ea 100644
--- a/dev/demo/menu.html
+++ b/dev/demo/menu.html
@@ -3,7 +3,7 @@
<head>
<title>Menu demo</title>
<meta charset="utf-8" />
- <script src="../js/src/menu.js"></script>
+ <script data-main="menudemo.js" src="../js/lib/require.js" async="async"></script>
<link type="text/css" rel="stylesheet" href="../css/kalamar.css" />
<style type="text/css" rel="stylesheet">
.info {
@@ -28,77 +28,5 @@
<div id="pagination"><a rel="prev"><span><i class="fa fa-caret-left"></i></span></a><a rel="self"><span>1</span></a><a href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=2"><span>2</span></a><a href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=3"><span>3</span></a><span><i class="fa fa-ellipsis-h"></i></span><a href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=52230"><span>52230</span></a><a rel="next" href="/kalamar?q=der+%5Bmate/m%3Dnumber:sg%5D&ql=poliqarp&p=2"><span><i class="fa fa-caret-right"></i></span></a></div>
</div>
</main>
-
- <script>
-KorAP.OwnMenuItem = {
- create : function (params) {
- return Object.create(KorAP.MenuItem).upgradeTo(KorAP.OwnMenuItem)._init(params);
- },
- 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);
- },
- _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;
- }
-};
-
-KorAP.OwnPrefix = {
- create : function () {
- return Object.create(KorAP.MenuPrefix)
- .upgradeTo(KorAP.OwnPrefix)
- ._init();
- },
- onclick : function () {
- console.log('Prefix: ' + this.value());
- }
-}
-
-KorAP.OwnMenu = {
- create : function (params) {
- return Object.create(KorAP.Menu)
- .upgradeTo(KorAP.OwnMenu)
- ._init(KorAP.OwnMenuItem, KorAP.OwnPrefix, params);
- }
-};
-
-var menu = KorAP.OwnMenu.create([
- ['Titel', 'title', 'string'],
- ['Untertitel', 'subTitle', 'string'],
- ['Veröffentlichungsdatum', 'pubDate', 'date'],
- ['Länge', 'length', 'integer'],
- ['Autor', 'author', 'string'],
- ['Genre', 'genre', 'string'],
- ['corpusID', 'corpusID', 'string'],
- ['docID', 'docID', 'string'],
- ['textID', 'textID', 'string']
-]);
-
- document.getElementById('menu').appendChild(menu.element());
-
- menu.limit(3);
- menu.show('');
- menu.focus();
-
- </script>
</body>
</html>