blob: ee676ef71e33ac922bcaada79634a8ac3c63dbed [file] [log] [blame]
Nils Diewald0e6992a2015-04-14 20:13:52 +00001requirejs.config({
2 baseUrl: '../js/src',
3 paths : {
4 'lib': '../lib'
5 }
6});
7
Akron308db382016-05-30 22:34:07 +02008var hint = undefined;
9
Akron2d0d96d2019-11-18 19:49:50 +010010require(['plugin/server','panel/query', 'hint','hint/foundries/cnx','lib/domReady'], function (pluginClass, queryPanelClass, hintClass, hintArray, domReady) {
Nils Diewald0e6992a2015-04-14 20:13:52 +000011 KorAP.hintArray = hintArray;
Akron72f73572017-12-05 12:31:09 +010012 KorAP.Hint = null;
Akron2d0d96d2019-11-18 19:49:50 +010013
Nils Diewald0e6992a2015-04-14 20:13:52 +000014 domReady(function() {
Akron2d0d96d2019-11-18 19:49:50 +010015
Akron72f73572017-12-05 12:31:09 +010016 KorAP.Hint = hintClass.create();
Akron2d0d96d2019-11-18 19:49:50 +010017
18 /**
19 * Add query panel
20 */
21 var queryPanel = queryPanelClass.create();
22
23 // Get input field
24 var sform = document.getElementById("searchform");
25 var vcView = document.getElementById('vc-view')
26 if (sform && vcView) {
27 // The views are below the query bar
28 sform.insertBefore(queryPanel.element(),vcView);
29 KorAP.Panel = KorAP.Panel || {};
30 KorAP.Panel['query'] = queryPanel;
31 }
32
33 // Load plugin server
34 KorAP.Plugin = pluginClass.create();
35
36 // Register match plugin
37 KorAP.Plugin.register({
38 'name' : 'Example New',
39 'desc' : 'Some content about cats',
40 'embed' : [{
41 'panel' : 'query',
42 'title' : 'Translate',
43 'classes' : ['translate'],
44 'onClick' : {
45 "template" : "http://localhost:3003/demo/plugin-client.html"
46 }
47 },{
48 'panel' : 'query',
49 'title' : 'Glemm',
50 'classes' : ['glemm'],
51 'onClick' : {
52 "template" : "http://localhost:3003/demo/plugin-client.html"
53 }
54 }]
55 });
Nils Diewald0e6992a2015-04-14 20:13:52 +000056 });
57});
Akron308db382016-05-30 22:34:07 +020058
59function demoAlert (pos, msg) {
Akron72f73572017-12-05 12:31:09 +010060 if (KorAP.hint !== undefined)
61 KorAP.Hint.alert(pos, msg);
Akron308db382016-05-30 22:34:07 +020062}