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 | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 6 | <script src="../src/menu.js"></script> |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 7 | <script src="../src/vc.js"></script> |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 8 | <link href="../../css/vc.css" rel="stylesheet" type="text/css"></link> |
Nils Diewald | d2b5737 | 2015-03-10 20:09:48 +0000 | [diff] [blame] | 9 | <link href="../../css/menu.css" rel="stylesheet" type="text/css"></link> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 10 | <style type="text/css" rel="stylesheet"> |
| 11 | .info { |
| 12 | background-color:white; |
| 13 | color: black; |
| 14 | padding: 1em; |
| 15 | font-family: mono; |
| 16 | } |
| 17 | </style> |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 18 | </head> |
| 19 | <body> |
| 20 | <div id="vc"></div> |
Nils Diewald | 59c02fc | 2015-03-07 01:29:09 +0000 | [diff] [blame] | 21 | <div id="menu" class="vc"></div> |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 22 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 23 | <script> |
| 24 | var json = { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 25 | "@type":"koral:docGroup", |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 26 | "operation":"operation:or", |
| 27 | "operands":[ |
| 28 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 29 | "@type":"koral:docGroup", |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 30 | "operation":"operation:and", |
| 31 | "operands":[ |
| 32 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 33 | "@type":"koral:doc", |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 34 | "key":"Titel", |
| 35 | "value":"Baum", |
| 36 | "match":"match:eq" |
| 37 | }, |
| 38 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 39 | "@type":"koral:doc", |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 40 | "key":"Veröffentlichungsort", |
| 41 | "value":"hihi", |
| 42 | "match":"match:eq" |
Nils Diewald | 0297ba1 | 2015-01-05 21:56:12 +0000 | [diff] [blame] | 43 | }, |
| 44 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 45 | "@type":"koral:docGroup", |
Nils Diewald | 0297ba1 | 2015-01-05 21:56:12 +0000 | [diff] [blame] | 46 | "operation":"operation:or", |
| 47 | "operands":[ |
| 48 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 49 | "@type":"koral:doc", |
Nils Diewald | 0297ba1 | 2015-01-05 21:56:12 +0000 | [diff] [blame] | 50 | "key":"Titel", |
| 51 | "value":"Baum", |
| 52 | "match":"match:eq" |
| 53 | }, |
| 54 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 55 | "@type":"koral:doc", |
Nils Diewald | 0297ba1 | 2015-01-05 21:56:12 +0000 | [diff] [blame] | 56 | "key":"Veröffentlichungsort", |
| 57 | "value":"hihi", |
Nils Diewald | 86dad5b | 2015-01-28 15:09:07 +0000 | [diff] [blame] | 58 | "match":"match:eq", |
| 59 | "rewrites" : [ |
| 60 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 61 | "@type": "koral:rewrite", |
Nils Diewald | 86dad5b | 2015-01-28 15:09:07 +0000 | [diff] [blame] | 62 | "src" : "policy", |
| 63 | "operation" : "operation:injection", |
| 64 | } |
| 65 | ] |
Nils Diewald | 0297ba1 | 2015-01-05 21:56:12 +0000 | [diff] [blame] | 66 | } |
| 67 | ] |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 68 | } |
| 69 | ] |
| 70 | }, |
| 71 | { |
Nils Diewald | 2fe12e1 | 2015-03-06 16:47:06 +0000 | [diff] [blame] | 72 | "@type":"koral:doc", |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 73 | "key":"Untertitel", |
| 74 | "value":"huhu", |
| 75 | "match":"match:eq" |
| 76 | } |
| 77 | ] |
| 78 | }; |
Nils Diewald | e15b7a2 | 2015-01-09 21:50:21 +0000 | [diff] [blame] | 79 | KorAP.Locale.AND = 'und'; |
| 80 | KorAP.Locale.OR = 'oder'; |
| 81 | |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 82 | var vc = KorAP.VirtualCollection.render(json); |
| 83 | document.getElementById('vc').appendChild(vc.element()); |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 84 | |
| 85 | function showJSON() { |
| 86 | document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson()); |
| 87 | }; |
| 88 | |
Nils Diewald | d599d54 | 2015-01-08 20:41:34 +0000 | [diff] [blame] | 89 | function showQuery() { |
| 90 | document.getElementById("query").innerHTML = vc.root().toQuery(); |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 91 | }; |
| 92 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 93 | </script> |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 94 | |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 95 | <hr /> |
| 96 | |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 97 | <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 98 | <div id="json" class="info"></div> |
| 99 | |
| 100 | <hr /> |
| 101 | |
Nils Diewald | d599d54 | 2015-01-08 20:41:34 +0000 | [diff] [blame] | 102 | <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p> |
| 103 | <div id="query" class="info"></div> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 104 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 105 | </body> |
| 106 | </html> |