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 | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 21 | require(['buttongroup', 'panel','view'], function (btnClass, panelClass, viewClass) { |
Akron | 3967d34 | 2018-07-14 08:35:12 +0200 | [diff] [blame^] | 22 | var panel = panelClass.create('up'); |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 23 | var actions = panel.actions; |
| 24 | actions.add('Meta',['meta'], function () { |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 25 | console.log(this.button.classList.contains('meta')); |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 26 | view = viewClass.create(); |
| 27 | panel.add(view); |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 28 | }); |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 29 | var list = actions.addList('More', ['list']); |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 30 | list.readItems([ |
| 31 | ['cool', 'cool', function (e, action) { console.log('really' + this.action()) }], |
| 32 | ['very cool', 'veryCool', function (e, action) { console.log('very cool') }] |
| 33 | ]); |
Akron | 537bc52 | 2018-07-13 19:06:27 +0200 | [diff] [blame] | 34 | |
| 35 | document.getElementById('mainButton').appendChild(panel.element()); |
Akron | 52ed22d | 2018-07-11 17:05:19 +0200 | [diff] [blame] | 36 | }); |
| 37 | |
| 38 | |
| 39 | </script> |
| 40 | </html> |