blob: 08e6034eab5800ed1115ab1b493288cb52b42138 [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
Akron7f1e07e2020-08-24 20:12:14 +02006 <link type="text/css" rel="stylesheet" href="/css/kalamar-plugin.css" />
Akron479994e2018-07-02 13:21:44 +02007
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>
Akron7f1e07e2020-08-24 20:12:14 +020024 <body class="result-view">
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 };
Akronec4bbfa2021-09-15 15:00:59 +020054
55 function redirect() {
56
57 KorAPlugin.requestMsg({
58 "action":"get",
59 "key": 'QueryParam'
60 }, function (d) {
61
62 const par = d.value.param;
63 par.set("q",56);
64
65 KorAPlugin.sendMsg({
66 'action':'redirect',
67 'queryParam' : par.toString()
68 })
69 });
70
71 }
72
Akron22598cd2019-12-09 14:59:03 +010073 </script>
Akrona6c32b92018-07-02 18:39:42 +020074 <ul>
75 <li><a onclick="KorAPlugin.log(333, 'Huhu!')">Send log!</a></li>
76 <li><a onclick="KorAPlugin.resize()">Resize</a></li>
Akron51ee6232019-12-17 21:00:05 +010077 <li><a onclick="KorAPlugin.sendMsg({'action':'pipe','service':'Glemm'})">Add Glemm</a></li>
Akronec4bbfa2021-09-15 15:00:59 +020078 <li><a onclick="redirect()">Redirect</a></li>
Akrona99315e2018-07-03 22:56:45 +020079 <li><a onclick="flood()">Flood!</a></li>
Akronc3003642020-03-30 10:19:14 +020080 <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 +020081 </ul>
Akron8d646d72018-07-08 13:45:53 +020082 <p style="width: 2000px">------------------------------------------------------------------------------------------------------------------------</p>
Akron479994e2018-07-02 13:21:44 +020083 </body>
84</html>