Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 4 | <title>Panel and ButtonGroup demo</title> |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 5 | <meta charset="utf-8" /> |
| 6 | <script src="../js/lib/require.js" async="async"></script> |
| 7 | <link type="text/css" rel="stylesheet" href="../css/kalamar.css" /> |
| 8 | </head> |
| 9 | <body> |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 10 | <nav id="mainButton" style="position: absolute; width: 100%; top: 150px"></nav> |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 11 | </body> |
| 12 | <script> |
| 13 | requirejs.config({ |
| 14 | baseUrl: '../js/src', |
| 15 | paths : { |
| 16 | 'lib': '../lib' |
| 17 | } |
| 18 | }); |
| 19 | |
| 20 | |
Akron | 2d0d96d | 2019-11-18 19:49:50 +0100 | [diff] [blame] | 21 | require(['buttongroup', 'panel', 'view/result/koralquery'], function (btnClass, panelClass, kqClass) { |
Akron | 4d926f1 | 2018-07-16 15:30:25 +0200 | [diff] [blame] | 22 | KorAP.koralQuery = { |
| 23 | '@type' : "https://beispiel", |
| 24 | 'key' : 'Cool' |
| 25 | }; |
| 26 | |
| 27 | var panel = panelClass.create(); |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 28 | var actions = panel.actions; |
Akron | 4d926f1 | 2018-07-16 15:30:25 +0200 | [diff] [blame] | 29 | |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 30 | actions.add('Meta',['meta'], function () { |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 31 | console.log(this.button.classList.contains('meta')); |
Akron | 4d926f1 | 2018-07-16 15:30:25 +0200 | [diff] [blame] | 32 | view = kqClass.create(); |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 33 | panel.add(view); |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 34 | }); |
Akron | 4d926f1 | 2018-07-16 15:30:25 +0200 | [diff] [blame] | 35 | |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 36 | var list = actions.addList('More', ['list']); |
Akron | 4d926f1 | 2018-07-16 15:30:25 +0200 | [diff] [blame] | 37 | |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 38 | list.readItems([ |
| 39 | ['cool', 'cool', function (e, action) { console.log('really' + this.action()) }], |
| 40 | ['very cool', 'veryCool', function (e, action) { console.log('very cool') }] |
| 41 | ]); |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 42 | |
| 43 | document.getElementById('mainButton').appendChild(panel.element()); |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 44 | }); |
| 45 | |
| 46 | |
| 47 | </script> |
| 48 | </html> |