Added proxy support
diff --git a/public/js/demo/vc.html b/public/js/demo/vc.html
index 4d561e1..048c168 100644
--- a/public/js/demo/vc.html
+++ b/public/js/demo/vc.html
@@ -6,6 +6,7 @@
<script src="../src/menu.js"></script>
<script src="../src/vc.js"></script>
<link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
+ <link href="../../css/menu.css" rel="stylesheet" type="text/css"></link>
<style type="text/css" rel="stylesheet">
.info {
background-color:white;
@@ -89,20 +90,6 @@
document.getElementById("query").innerHTML = vc.root().toQuery();
};
- var menu = KorAP.FieldMenu.create([
- ['Titel', 'title', 'string'],
- ['Untertitel', 'subTitle', 'string'],
- ['Veröffentlichungsdatum', 'pubDate', 'date'],
- ['Autor', 'author', 'string']
- ]);
- menu.limit(3);
- menu.show();
-
- document.getElementById('menu').appendChild(menu.element());
-
- menu.focus();
-
-
</script>
<hr />
diff --git a/public/js/src/menu.js b/public/js/src/menu.js
index 5e7537b..3d0017d 100644
--- a/public/js/src/menu.js
+++ b/public/js/src/menu.js
@@ -10,9 +10,12 @@
"use strict";
// Don't let events bubble up
- Event.prototype.halt = function () {
- this.stopPropagation();
- this.preventDefault();
+ if (Event.halt === undefined) {
+ // Don't let events bubble up
+ Event.prototype.halt = function () {
+ this.stopPropagation();
+ this.preventDefault();
+ };
};
// Default maximum number of menu items
diff --git a/public/js/src/vc.js b/public/js/src/vc.js
index 00528aa..fa63457 100644
--- a/public/js/src/vc.js
+++ b/public/js/src/vc.js
@@ -1329,17 +1329,19 @@
*/
KorAP._changeKey = function () {
var doc = this.parentNode.refTo;
- console.log(doc.type());
+ var key = doc.element().firstChild;
+ key.appendChild(KorAP.FieldChooser.element());
+ KorAP.FieldChooser.show();
+ KorAP.FieldChooser.focus();
// key, matchop, type, value
};
-
// Field menu
KorAP.FieldMenu = {
create : function (params) {
return Object.create(KorAP.Menu)
.upgradeTo(KorAP.FieldMenu)
- ._init(KorAP.FieldMenuItem, params)
+ ._init(KorAP.FieldMenuItem, undefined, params)
}
};
@@ -1382,5 +1384,13 @@
return this._element = li;
}
};
+
+ KorAP.FieldChooser = KorAP.FieldMenu.create([
+ ['Titel', 'title', 'string'],
+ ['Untertitel', 'subTitle', 'string'],
+ ['Veröffentlichungsdatum', 'pubDate', 'date'],
+ ['Autor', 'author', 'string']
+ ]);
+ KorAP.FieldChooser.limit(5);
}(this.KorAP));