blob: 79f7d0e64a04ba19c45648052c30b08fd407301b [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 Diewaldd0770492014-12-19 03:55:00 +00006 <script src="../src/vc.js"></script>
Nils Diewald966abf12014-12-20 02:27:45 +00007 <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link>
Nils Diewald8f6b6102015-01-08 18:25:33 +00008 <style type="text/css" rel="stylesheet">
9.info {
10 background-color:white;
11 color: black;
12 padding: 1em;
13 font-family: mono;
14}
15 </style>
Nils Diewaldd0770492014-12-19 03:55:00 +000016 </head>
17 <body>
18 <div id="vc"></div>
Nils Diewald966abf12014-12-20 02:27:45 +000019
Nils Diewaldd0770492014-12-19 03:55:00 +000020 <script>
21 var json = {
22 "@type":"korap:docGroup",
23 "operation":"operation:or",
24 "operands":[
25 {
26 "@type":"korap:docGroup",
27 "operation":"operation:and",
28 "operands":[
29 {
30 "@type":"korap:doc",
31 "key":"Titel",
32 "value":"Baum",
33 "match":"match:eq"
34 },
35 {
36 "@type":"korap:doc",
37 "key":"Veröffentlichungsort",
38 "value":"hihi",
39 "match":"match:eq"
Nils Diewald0297ba12015-01-05 21:56:12 +000040 },
41 {
42 "@type":"korap:docGroup",
43 "operation":"operation:or",
44 "operands":[
45 {
46 "@type":"korap:doc",
47 "key":"Titel",
48 "value":"Baum",
49 "match":"match:eq"
50 },
51 {
52 "@type":"korap:doc",
53 "key":"Veröffentlichungsort",
54 "value":"hihi",
55 "match":"match:eq"
56 }
57 ]
Nils Diewaldd0770492014-12-19 03:55:00 +000058 }
59 ]
60 },
61 {
62 "@type":"korap:doc",
63 "key":"Untertitel",
64 "value":"huhu",
65 "match":"match:eq"
66 }
67 ]
68 };
Nils Diewalde15b7a22015-01-09 21:50:21 +000069 KorAP.Locale.AND = 'und';
70 KorAP.Locale.OR = 'oder';
71
Nils Diewald966abf12014-12-20 02:27:45 +000072 var vc = KorAP.VirtualCollection.render(json);
73 document.getElementById('vc').appendChild(vc.element());
Nils Diewald5c817a42015-01-06 01:08:56 +000074
75 function showJSON() {
76 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
77 };
78
Nils Diewaldd599d542015-01-08 20:41:34 +000079 function showQuery() {
80 document.getElementById("query").innerHTML = vc.root().toQuery();
Nils Diewald8f6b6102015-01-08 18:25:33 +000081 };
82
Nils Diewaldd0770492014-12-19 03:55:00 +000083 </script>
Nils Diewald5c817a42015-01-06 01:08:56 +000084
Nils Diewald8f6b6102015-01-08 18:25:33 +000085 <hr />
86
Nils Diewald5c817a42015-01-06 01:08:56 +000087 <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
Nils Diewald8f6b6102015-01-08 18:25:33 +000088 <div id="json" class="info"></div>
89
90 <hr />
91
Nils Diewaldd599d542015-01-08 20:41:34 +000092 <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p>
93 <div id="query" class="info"></div>
Nils Diewald8f6b6102015-01-08 18:25:33 +000094
Nils Diewaldd0770492014-12-19 03:55:00 +000095 </body>
96</html>