blob: d85f9fae164e3897ef322b642ed15f963242f8bb [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001requirejs.config({
2 baseUrl: '../js/src',
3 paths : {
4 'lib': '../lib'
5 }
6});
7
8var json = {
9 "@type":"koral:docGroup",
10 "operation":"operation:or",
11 "operands":[
12 {
13 "@type":"koral:docGroup",
14 "operation":"operation:and",
15 "operands":[
16 {
17 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000018 "key":"title",
Nils Diewald0e6992a2015-04-14 20:13:52 +000019 "value":"Der Birnbaum",
20 "match":"match:eq"
21 },
22 {
23 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000024 "key":"pubPlace",
Nils Diewald0e6992a2015-04-14 20:13:52 +000025 "value":"Mannheim",
26 "match":"match:eq"
27 },
28 {
29 "@type":"koral:docGroup",
30 "operation":"operation:or",
31 "operands":[
32 {
33 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000034 "key":"subTitle",
Nils Diewald0e6992a2015-04-14 20:13:52 +000035 "value":"Aufzucht und Pflege",
36 "match":"match:eq"
37 },
38 {
39 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000040 "key":"subTitle",
Nils Diewald0e6992a2015-04-14 20:13:52 +000041 "value":"Gedichte",
42 "match":"match:eq",
Nils Diewald652e5f42015-05-10 18:11:45 +000043/*
Nils Diewald0e6992a2015-04-14 20:13:52 +000044 "rewrites" : [
45 {
46 "@type": "koral:rewrite",
47 "src" : "policy",
48 "operation" : "operation:injection",
49 }
50 ]
Nils Diewald652e5f42015-05-10 18:11:45 +000051*/
Nils Diewald0e6992a2015-04-14 20:13:52 +000052 }
53 ]
54 }
55 ]
56 },
57 {
58 "@type":"koral:doc",
Nils Diewald4c221252015-04-21 20:19:25 +000059 "key":"pubDate",
Nils Diewald0e6992a2015-04-14 20:13:52 +000060 "type":"type:date",
61 "value":"2015-03-05",
62 "match":"match:geq"
63 }
64 ]
65};
66
Nils Diewald652e5f42015-05-10 18:11:45 +000067require(['vc','lib/domReady', 'lib/highlight/highlight.pack'], function (vcClass, domReady) {
Nils Diewald4c221252015-04-21 20:19:25 +000068
69 var loc = KorAP.Locale;
70
Nils Diewald652e5f42015-05-10 18:11:45 +000071/*
Nils Diewald4c221252015-04-21 20:19:25 +000072 loc.AND = 'und';
73 loc.OR = 'oder';
74 loc.VC_subTitle = 'Untertitel';
75 loc.VC_title = 'Titel';
76 loc.VC_pubDate = 'Veröffentlichungsdatum';
77 loc.VC_pubPlace = 'Veröffentlichungsort';
Nils Diewald652e5f42015-05-10 18:11:45 +000078*/
Nils Diewald0e6992a2015-04-14 20:13:52 +000079
80 domReady(function() {
Nils Diewald4c221252015-04-21 20:19:25 +000081
82 // Create a new virtual collection by passing a based json object and
83 // field menu information
Nils Diewald6283d692015-04-23 20:32:53 +000084 var vc = vcClass.create([
Nils Diewald4c221252015-04-21 20:19:25 +000085 ['title', 'string'],
86 ['subTitle', 'string'],
87 ['pubDate', 'date'],
88 ['author', 'string']
Nils Diewald6283d692015-04-23 20:32:53 +000089 ]).fromJson(json);
Nils Diewald87507832015-05-01 23:36:41 +000090
Nils Diewald0e6992a2015-04-14 20:13:52 +000091 document.getElementById('vc').appendChild(vc.element());
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000092
Nils Diewald4c221252015-04-21 20:19:25 +000093 // show the current JSON serialization
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000094 KorAP.showJSON = function () {
Nils Diewald652e5f42015-05-10 18:11:45 +000095 var json = document.getElementById("json");
96 json.innerHTML = JSON.stringify(vc.root().toJson(), null, ' ');
97 hljs.highlightBlock(json);
Nils Diewald1fcb2ad2015-04-20 19:19:18 +000098 };
99
Nils Diewald4c221252015-04-21 20:19:25 +0000100 // show the current query serialization
Nils Diewald1fcb2ad2015-04-20 19:19:18 +0000101 KorAP.showQuery = function () {
102 document.getElementById("query").innerHTML = vc.root().toQuery();
103 };
Nils Diewald0e6992a2015-04-14 20:13:52 +0000104 });
105});