Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 1 | requirejs.config({ |
| 2 | baseUrl: '../js/src', |
| 3 | paths : { |
| 4 | 'lib': '../lib' |
| 5 | } |
| 6 | }); |
| 7 | |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 8 | var hint = undefined; |
| 9 | |
Akron | 2d0d96d | 2019-11-18 19:49:50 +0100 | [diff] [blame] | 10 | require(['plugin/server','panel/query', 'hint','hint/foundries/cnx','lib/domReady'], function (pluginClass, queryPanelClass, hintClass, hintArray, domReady) { |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 11 | KorAP.hintArray = hintArray; |
Akron | 72f7357 | 2017-12-05 12:31:09 +0100 | [diff] [blame] | 12 | KorAP.Hint = null; |
Akron | 2d0d96d | 2019-11-18 19:49:50 +0100 | [diff] [blame] | 13 | |
Nils Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 14 | domReady(function() { |
Akron | 2d0d96d | 2019-11-18 19:49:50 +0100 | [diff] [blame] | 15 | |
Akron | 72f7357 | 2017-12-05 12:31:09 +0100 | [diff] [blame] | 16 | KorAP.Hint = hintClass.create(); |
Akron | 2d0d96d | 2019-11-18 19:49:50 +0100 | [diff] [blame] | 17 | |
| 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 Diewald | 0e6992a | 2015-04-14 20:13:52 +0000 | [diff] [blame] | 56 | }); |
| 57 | }); |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 58 | |
| 59 | function demoAlert (pos, msg) { |
Akron | 72f7357 | 2017-12-05 12:31:09 +0100 | [diff] [blame] | 60 | if (KorAP.hint !== undefined) |
| 61 | KorAP.Hint.alert(pos, msg); |
Akron | 308db38 | 2016-05-30 22:34:07 +0200 | [diff] [blame] | 62 | } |