blob: ea4a53c726b105ae17ca6a7adcaa026bff4ac471 [file] [log] [blame]
Nils Diewaldd0770492014-12-19 03:55:00 +00001<!DOCTYPE html>
2<html>
3 <head>
4 <title>Virtual Collection demo</title>
Nils Diewald966abf12014-12-20 02:27:45 +00005 <meta charset="utf-8" />
Nils Diewald2fe12e12015-03-06 16:47:06 +00006 <script src="../src/menu.js"></script>
Nils Diewaldd0770492014-12-19 03:55:00 +00007 <script src="../src/vc.js"></script>
Nils Diewald966abf12014-12-20 02:27:45 +00008 <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
Nils Diewald8f6b6102015-01-08 18:25:33 +00009 <style type="text/css" rel="stylesheet">
10.info {
11 background-color:white;
12 color: black;
13 padding: 1em;
14 font-family: mono;
15}
16 </style>
Nils Diewaldd0770492014-12-19 03:55:00 +000017 </head>
18 <body>
19 <div id="vc"></div>
Nils Diewald2fe12e12015-03-06 16:47:06 +000020 <div id="menu"></div>
Nils Diewald966abf12014-12-20 02:27:45 +000021
Nils Diewaldd0770492014-12-19 03:55:00 +000022 <script>
23 var json = {
Nils Diewald2fe12e12015-03-06 16:47:06 +000024 "@type":"koral:docGroup",
Nils Diewaldd0770492014-12-19 03:55:00 +000025 "operation":"operation:or",
26 "operands":[
27 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000028 "@type":"koral:docGroup",
Nils Diewaldd0770492014-12-19 03:55:00 +000029 "operation":"operation:and",
30 "operands":[
31 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000032 "@type":"koral:doc",
Nils Diewaldd0770492014-12-19 03:55:00 +000033 "key":"Titel",
34 "value":"Baum",
35 "match":"match:eq"
36 },
37 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000038 "@type":"koral:doc",
Nils Diewaldd0770492014-12-19 03:55:00 +000039 "key":"Veröffentlichungsort",
40 "value":"hihi",
41 "match":"match:eq"
Nils Diewald0297ba12015-01-05 21:56:12 +000042 },
43 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000044 "@type":"koral:docGroup",
Nils Diewald0297ba12015-01-05 21:56:12 +000045 "operation":"operation:or",
46 "operands":[
47 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000048 "@type":"koral:doc",
Nils Diewald0297ba12015-01-05 21:56:12 +000049 "key":"Titel",
50 "value":"Baum",
51 "match":"match:eq"
52 },
53 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000054 "@type":"koral:doc",
Nils Diewald0297ba12015-01-05 21:56:12 +000055 "key":"Veröffentlichungsort",
56 "value":"hihi",
Nils Diewald86dad5b2015-01-28 15:09:07 +000057 "match":"match:eq",
58 "rewrites" : [
59 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000060 "@type": "koral:rewrite",
Nils Diewald86dad5b2015-01-28 15:09:07 +000061 "src" : "policy",
62 "operation" : "operation:injection",
63 }
64 ]
Nils Diewald0297ba12015-01-05 21:56:12 +000065 }
66 ]
Nils Diewaldd0770492014-12-19 03:55:00 +000067 }
68 ]
69 },
70 {
Nils Diewald2fe12e12015-03-06 16:47:06 +000071 "@type":"koral:doc",
Nils Diewaldd0770492014-12-19 03:55:00 +000072 "key":"Untertitel",
73 "value":"huhu",
74 "match":"match:eq"
75 }
76 ]
77 };
Nils Diewalde15b7a22015-01-09 21:50:21 +000078 KorAP.Locale.AND = 'und';
79 KorAP.Locale.OR = 'oder';
80
Nils Diewald966abf12014-12-20 02:27:45 +000081 var vc = KorAP.VirtualCollection.render(json);
82 document.getElementById('vc').appendChild(vc.element());
Nils Diewald5c817a42015-01-06 01:08:56 +000083
84 function showJSON() {
85 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
86 };
87
Nils Diewaldd599d542015-01-08 20:41:34 +000088 function showQuery() {
89 document.getElementById("query").innerHTML = vc.root().toQuery();
Nils Diewald8f6b6102015-01-08 18:25:33 +000090 };
91
Nils Diewald2fe12e12015-03-06 16:47:06 +000092 var menu = KorAP.FieldMenu.create([
93 ['Titel', 'title', 'string'],
94 ['Untertitel', 'subTitle', 'string'],
95 ['Veröffentlichungsdatum', 'pubDate', 'date']
96 ]);
97 menu.limit(4);
98 menu.show();
99
100 document.getElementById('menu').appendChild(menu.element());
101
102 menu.focus();
103
104
Nils Diewaldd0770492014-12-19 03:55:00 +0000105 </script>
Nils Diewald5c817a42015-01-06 01:08:56 +0000106
Nils Diewald8f6b6102015-01-08 18:25:33 +0000107 <hr />
108
Nils Diewald5c817a42015-01-06 01:08:56 +0000109 <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
Nils Diewald8f6b6102015-01-08 18:25:33 +0000110 <div id="json" class="info"></div>
111
112 <hr />
113
Nils Diewaldd599d542015-01-08 20:41:34 +0000114 <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p>
115 <div id="query" class="info"></div>
Nils Diewald8f6b6102015-01-08 18:25:33 +0000116
Nils Diewaldd0770492014-12-19 03:55:00 +0000117 </body>
118</html>