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", |
Nils Diewald | 86dad5b | 2015-01-28 15:09:07 +0000 | [diff] [blame^] | 55 | "match":"match:eq", |
| 56 | "rewrites" : [ |
| 57 | { |
| 58 | "@type": "korap:rewrite", |
| 59 | "src" : "policy", |
| 60 | "operation" : "operation:injection", |
| 61 | } |
| 62 | ] |
Nils Diewald | 0297ba1 | 2015-01-05 21:56:12 +0000 | [diff] [blame] | 63 | } |
| 64 | ] |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 65 | } |
| 66 | ] |
| 67 | }, |
| 68 | { |
| 69 | "@type":"korap:doc", |
| 70 | "key":"Untertitel", |
| 71 | "value":"huhu", |
| 72 | "match":"match:eq" |
| 73 | } |
| 74 | ] |
| 75 | }; |
Nils Diewald | e15b7a2 | 2015-01-09 21:50:21 +0000 | [diff] [blame] | 76 | KorAP.Locale.AND = 'und'; |
| 77 | KorAP.Locale.OR = 'oder'; |
| 78 | |
Nils Diewald | 966abf1 | 2014-12-20 02:27:45 +0000 | [diff] [blame] | 79 | var vc = KorAP.VirtualCollection.render(json); |
| 80 | document.getElementById('vc').appendChild(vc.element()); |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 81 | |
| 82 | function showJSON() { |
| 83 | document.getElementById("json").innerHTML = JSON.stringify(vc.root().toJson()); |
| 84 | }; |
| 85 | |
Nils Diewald | d599d54 | 2015-01-08 20:41:34 +0000 | [diff] [blame] | 86 | function showQuery() { |
| 87 | document.getElementById("query").innerHTML = vc.root().toQuery(); |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 88 | }; |
| 89 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 90 | </script> |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 91 | |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 92 | <hr /> |
| 93 | |
Nils Diewald | 5c817a4 | 2015-01-06 01:08:56 +0000 | [diff] [blame] | 94 | <p><a onclick="showJSON()" style="cursor:pointer">show JSON!</a></p> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 95 | <div id="json" class="info"></div> |
| 96 | |
| 97 | <hr /> |
| 98 | |
Nils Diewald | d599d54 | 2015-01-08 20:41:34 +0000 | [diff] [blame] | 99 | <p><a onclick="showQuery()" style="cursor:pointer">show Query!</a></p> |
| 100 | <div id="query" class="info"></div> |
Nils Diewald | 8f6b610 | 2015-01-08 18:25:33 +0000 | [diff] [blame] | 101 | |
Nils Diewald | d077049 | 2014-12-19 03:55:00 +0000 | [diff] [blame] | 102 | </body> |
| 103 | </html> |