Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>Virtual Collection demo</title> |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 5 | <meta charset="utf-8" /> |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 6 | <script src="../src/vc.js"></script> |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 7 | <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 8 | <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 Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 16 | </head> |
| 17 | <body> |
| 18 | <div id="vc"></div> |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 19 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 20 | <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 Diewald | 0297ba1 | 2015-01-05 21:56:12 +0000 | [diff] [blame] | 40 | }, |
| 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 Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 58 | } |
| 59 | ] |
| 60 | }, |
| 61 | { |
| 62 | "@type":"korap:doc", |
| 63 | "key":"Untertitel", |
| 64 | "value":"huhu", |
| 65 | "match":"match:eq" |
| 66 | } |
| 67 | ] |
| 68 | }; |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 69 | var vc = KorAP.VirtualCollection.render(json); |
| 70 | document.getElementById('vc').appendChild(vc.element()); |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 71 | |
| 72 | function showJSON() { |
| 73 | document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson()); |
| 74 | }; |
| 75 | |
Nils Diewald | d599d54 | 2015-01-08 20:41:34 +0000 | [diff] [blame^] | 76 | function showQuery() { |
| 77 | document.getElementById("query").innerHTML = vc.root().toQuery(); |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 80 | </script> |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 81 | |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 82 | <hr /> |
| 83 | |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 84 | <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 85 | <div id="json" class="info"></div> |
| 86 | |
| 87 | <hr /> |
| 88 | |
Nils Diewald | d599d54 | 2015-01-08 20:41:34 +0000 | [diff] [blame^] | 89 | <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p> |
| 90 | <div id="query" class="info"></div> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 91 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 92 | </body> |
| 93 | </html> |