blob: 413625c7120b19712b1970d60bbd8b68da71876c [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' : {
Akrondbf7bae2020-10-07 10:44:24 +020052 "action":"toggle",
53 "template" : "http://localhost:3003/demo/plugin-client.html"
54 }
55 }]
56 });
57
58 // Register match plugin
59 KorAP.Plugin.register({
60 'name' : 'Glimpse',
61 'desc' : 'Shorten all queries',
62 'embed' : [{
63 'panel' : 'query',
64 'title' : 'Glimpse',
65 'classes' : ['glimpse'],
66 'onClick' : {
67 "action" : "toggle",
Akron2d0d96d2019-11-18 19:49:50 +010068 "template" : "http://localhost:3003/demo/plugin-client.html"
69 }
70 }]
71 });
Nils Diewald0e6992a2015-04-14 20:13:52 +000072 });
73});
Akron308db382016-05-30 22:34:07 +020074
75function demoAlert (pos, msg) {
Akron72f73572017-12-05 12:31:09 +010076 if (KorAP.hint !== undefined)
77 KorAP.Hint.alert(pos, msg);
Akron308db382016-05-30 22:34:07 +020078}