blob: 372571cdf6883b0063ef1f440942557a057d593b [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 Diewald966abf12014-12-20 02:27:45 +000069 var vc = KorAP.VirtualCollection.render(json);
70 document.getElementById('vc').appendChild(vc.element());
Nils Diewald5c817a42015-01-06 01:08:56 +000071
72 function showJSON() {
73 document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson());
74 };
75
Nils Diewaldd599d542015-01-08 20:41:34 +000076 function showQuery() {
77 document.getElementById("query").innerHTML = vc.root().toQuery();
Nils Diewald8f6b6102015-01-08 18:25:33 +000078 };
79
Nils Diewaldd0770492014-12-19 03:55:00 +000080 </script>
Nils Diewald5c817a42015-01-06 01:08:56 +000081
Nils Diewald8f6b6102015-01-08 18:25:33 +000082 <hr />
83
Nils Diewald5c817a42015-01-06 01:08:56 +000084 <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p>
Nils Diewald8f6b6102015-01-08 18:25:33 +000085 <div id="json" class="info"></div>
86
87 <hr />
88
Nils Diewaldd599d542015-01-08 20:41:34 +000089 <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p>
90 <div id="query" class="info"></div>
Nils Diewald8f6b6102015-01-08 18:25:33 +000091
Nils Diewaldd0770492014-12-19 03:55:00 +000092 </body>
93</html>