Plugin Demo: result plugin added
Change-Id: Iad77e5457cf1e72df55f1ce3059448d8a6635607
diff --git a/dev/demo/plugin-server.html b/dev/demo/plugin-server.html
index 491708d..146d2eb 100644
--- a/dev/demo/plugin-server.html
+++ b/dev/demo/plugin-server.html
@@ -6,12 +6,92 @@
<!--
see https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; img-src https://*; child-src 'none';">
--->
- <script data-main="/demo/plugin-serverdemo.js" src="/js/lib/require.js" async="async"></script>
+ -->
+ <script>//<![CDATA[
+
+ window.KorAP = window.KorAP || {};
+
+ //]]></script>
+ <script data-main="plugin-serverdemo.js" src="../js/lib/require.js" async="async"></script>
</head>
<body>
<p>Start the demo server with <code>morbo -l 'http://*:3003' t/server/plugin.pl</code> and open <a href="http://localhost:3003/demo/plugin-server.html"><code>this website</code></a>.</p>
- <main>
+ <main>
+ <script>
+ KorAP.koralQuery = {
+ "matches" : [ "..." ],
+ "corpus" : {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:or",
+ "operands" : [ {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:and",
+ "operands" : [ {
+ "@type" : "koral:doc",
+ "key" : "title",
+ "match" : "match:eq",
+ "value" : "Der Birnbaum",
+ "type" : "type:string"
+ }, {
+ "@type" : "koral:doc",
+ "key" : "pubPlace",
+ "match" : "match:eq",
+ "value" : "Mannheim",
+ "type" : "type:string"
+ }, {
+ "@type" : "koral:docGroup",
+ "operation" : "operation:or",
+ "operands" : [ {
+ "@type" : "koral:doc",
+ "key" : "subTitle",
+ "match" : "match:eq",
+ "value" : "Aufzucht und Pflege",
+ "type" : "type:string"
+ }, {
+ "@type" : "koral:doc",
+ "key" : "subTitle",
+ "match" : "match:eq",
+ "value" : "Gedichte",
+ "type" : "type:string"
+ } ]
+ } ]
+ }, {
+ "@type" : "koral:doc",
+ "key" : "pubDate",
+ "match" : "match:geq",
+ "value" : "2015-03-05",
+ "type" : "type:date",
+ "rewrites" : [ {
+ "@type" : "koral:rewrite",
+ "operation" : "operation:modification",
+ "src" : "querySerializer",
+ "scope" : "tree"
+ } ]
+ } ]
+ },
+ "query" : {
+ "wrap" : {
+ "layer" : "orth",
+ "match" : "match:eq",
+ "foundry" : "opennlp",
+ "key" : "Goethe",
+ "@type" : "koral:term"
+ },
+ "@type" : "koral:token"
+ },
+ "meta" : {
+ "serialQuery" : "tokens:s:Goethe",
+ "startIndex" : 0,
+ "version" : "unknown",
+ "itemsPerPage" : 25,
+ "context" : "p",
+ "benchmark" : "0.103553092 s",
+ "totalResults" : -1
+ }
+ };
+ </script>
+
+ <div id="resultinfo" class="found"></div>
<div id="search">
<ol>
<li data-corpus-id="WPD"
diff --git a/dev/demo/plugin-serverdemo.js b/dev/demo/plugin-serverdemo.js
index e66dfd5..b0b2e2a 100644
--- a/dev/demo/plugin-serverdemo.js
+++ b/dev/demo/plugin-serverdemo.js
@@ -5,16 +5,30 @@
}
});
-define(['app/en','match', 'panel/match', 'plugin/server','lib/domReady','init'], function (lang, matchClass, matchPanelClass, pluginClass, domReady) {
+
+
+
+define(['app/en','match', 'panel/match', 'panel/result', 'plugin/server','lib/domReady','init'], function (lang, matchClass, matchPanelClass, resultPanelClass, pluginClass, domReady) {
domReady(function () {
-
- // Initialize match
- matchClass.create(
- document.getElementById('WPD-FFF.01460-p119-120')
- );
-
- // Load plugin server
+
+ //Load Plugin Server first
KorAP.Plugin = pluginClass.create();
+
+ //Register result plugin
+ KorAP.Plugin.register({
+ 'name' : 'Export',
+ 'desc' : 'Exports Kalamar results',
+ // 'about' : 'https://localhost:5678/',
+ 'embed' : [{
+ 'panel' : 'result',
+ 'title' : 'Export',
+ 'classes' : ['export'],
+ 'onClick' : {
+ 'action' : 'addWidget',
+ 'template' : 'http://localhost:3003/demo/plugin-client.html',
+ }
+ }]
+ });
// Register match plugin
KorAP.Plugin.register({
@@ -31,6 +45,5 @@
}
}]
});
-
});
});