mod.html 826 Bytes
Newer Older
Kannan V M's avatar
Kannan V M committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<!doctype html>
<html lang="en">
    <head>
        <meta charset="UTF-8"/>
        <title>Document</title>
    </head>
    <body>
        <ul id="listid">
        </ul>
        <script src="socket.io.js"></script>
        <script>
         
         const mod = io.connect('/mod');

         mod.on('leaves data', (leavesdata) => {
             var text = {};
             var x;
             document.getElementById("listid").innerHTML = '';
             for (x in leavesdata) {
                 document.getElementById("listid").innerHTML += '<li>'+leavesdata[x]["leaftext"]+'<button onclick="contentRemove('+"'"+x+"'"+')">Remove</button></li>';
             }; 
         });

         function contentRemove(socketid){
             mod.emit('message delete', socketid);
         };


        </script>
    </body>
</html>