blob: 79353478d7a5a34b26f73af0709b4efeda4fdf12 [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
Akron4de759f2021-10-13 10:46:45 +020062 const par = new URLSearchParams(d.value.search);
Akronec4bbfa2021-09-15 15:00:59 +020063 par.set("q",56);
64
65 KorAPlugin.sendMsg({
66 'action':'redirect',
67 'queryParam' : par.toString()
68 })
69 });
Akronec4bbfa2021-09-15 15:00:59 +020070 }
Akron4de759f2021-10-13 10:46:45 +020071
72 function getQueryParam() {
73 KorAPlugin.requestMsg({
74 "action":"get",
75 "key": 'QueryParam'
76 }, function (d) {
77 KorAPlugin.log(0, d.value.search);
78 });
79 }
80
Akronec4bbfa2021-09-15 15:00:59 +020081
Akron22598cd2019-12-09 14:59:03 +010082 </script>
Akrona6c32b92018-07-02 18:39:42 +020083 <ul>
84 <li><a onclick="KorAPlugin.log(333, 'Huhu!')">Send log!</a></li>
85 <li><a onclick="KorAPlugin.resize()">Resize</a></li>
Akron51ee6232019-12-17 21:00:05 +010086 <li><a onclick="KorAPlugin.sendMsg({'action':'pipe','service':'Glemm'})">Add Glemm</a></li>
Akron4de759f2021-10-13 10:46:45 +020087 <li><a onclick="getQueryParam()">GetQueryParam</a></li>
Akronec4bbfa2021-09-15 15:00:59 +020088 <li><a onclick="redirect()">Redirect</a></li>
Akrona99315e2018-07-03 22:56:45 +020089 <li><a onclick="flood()">Flood!</a></li>
Akronc3003642020-03-30 10:19:14 +020090 <li><a onclick="KorAPlugin.requestMsg({'action':'get', 'key':'KQ'}, function (d) { document.write(JSON.stringify(d.value))})">Get KQ</a></li>
Akron338b4d42022-12-20 13:59:22 +010091 <li><a onclick="KorAPlugin.requestMsg({'action':'get', 'key':'textSigle', 'value':'textSigle'}, function (d) { document.write(JSON.stringify(d.value))})">Get textSigle</a></li>
Akrona6c32b92018-07-02 18:39:42 +020092 </ul>
Akron8d646d72018-07-08 13:45:53 +020093 <p style="width: 2000px">------------------------------------------------------------------------------------------------------------------------</p>
Akron479994e2018-07-02 13:21:44 +020094 </body>
95</html>