blob: 3cce6dec4bf5e7c0437436c86549f8f4b4ede91f [file] [log] [blame]
Akron479994e2018-07-02 13:21:44 +02001<!DOCTYPE html>
2<html>
3 <head>
4 <title>Plugin demo</title>
Akrone8e2c952018-07-04 13:43:12 +02005
Akron479994e2018-07-02 13:21:44 +02006 <link type="text/css" rel="stylesheet" href="/css/kalamar.css" />
7
8 <!-- load client javascript library -->
Akrona6c32b92018-07-02 18:39:42 +02009 <script src="/js/src/plugin/client.js" data-server="http://localhost:3003/"></script>
10 <style>
11 body, html {
Akrone8e2c952018-07-04 13:43:12 +020012 padding: 0;
13 margin: 0;
14 box-sizing: border-box;
15 border-width: 0;
16 height: unset !important;
17 }
18
19 body {
20 min-height: unset !important;
Akrona6c32b92018-07-02 18:39:42 +020021 }
22 </style>
Akron479994e2018-07-02 13:21:44 +020023 </head>
Akrona6c32b92018-07-02 18:39:42 +020024 <body style="background-color: yellow">
Akron479994e2018-07-02 13:21:44 +020025 <h2>Example Widget!</h2>
Akrona99315e2018-07-03 22:56:45 +020026 <script>
27 function flood () {
28 var i = 0;
29 for (; i < 90; i++) {
Akronc3003642020-03-30 10:19:14 +020030 KorAPlugin.sendMsg({
Akrona99315e2018-07-03 22:56:45 +020031 'action' : '-'
32 });
33 };
34 };
Akron22598cd2019-12-09 14:59:03 +010035
36 function pluginit (p) {
37 p.onMessage = function(msg) {
Akron51ee6232019-12-17 21:00:05 +010038 switch (msg.key) {
39 // console.log("State changed to", msg.key, msg.value);
40 case 'glemm':
41 let data = {
42 'action' : 'pipe',
43 'service' : 'http://glemm/'
44 };
45
46 if (!msg.value) {
47 data['job'] = 'del';
48 };
49 KorAPlugin.sendMsg(data);
50 break;
51 }
Akron22598cd2019-12-09 14:59:03 +010052 };
53 };
54 </script>
Akrona6c32b92018-07-02 18:39:42 +020055 <ul>
56 <li><a onclick="KorAPlugin.log(333, 'Huhu!')">Send log!</a></li>
57 <li><a onclick="KorAPlugin.resize()">Resize</a></li>
Akron51ee6232019-12-17 21:00:05 +010058 <li><a onclick="KorAPlugin.sendMsg({'action':'pipe','service':'Glemm'})">Add Glemm</a></li>
Akrona99315e2018-07-03 22:56:45 +020059 <li><a onclick="flood()">Flood!</a></li>
Akronc3003642020-03-30 10:19:14 +020060 <li><a onclick="KorAPlugin.requestMsg({'action':'get', 'key':'KQ'}, function (d) { document.write(JSON.stringify(d.value))})">Get KQ</a></li>
Akrona6c32b92018-07-02 18:39:42 +020061 </ul>
Akron8d646d72018-07-08 13:45:53 +020062 <p style="width: 2000px">------------------------------------------------------------------------------------------------------------------------</p>
Akron479994e2018-07-02 13:21:44 +020063 </body>
64</html>