UNPKG

yrexpert-js

Version:

L'interface Web pour votre système expert...

85 lines (73 loc) 1.98 kB
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> <title id="titreYRexpert-term">yrexpert-term : Terminal mode navigateur pour yrexpert-js...</title> <link rel="shortcut icon" href="images/yrexpert_terminal.png" /> <!-- yrexpert-term is based on term.js Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) https://github.com/chjj/term.js/ --> <style> html { background: #fff; } .terminal { //float: left; margin-left: auto; margin-right: auto; border: #000 solid 5px; font-family: "DejaVu Sans Mono", "Liberation Mono", monospace; font-size: 13px; color: #f0f0f0; background: #000; width: 670px; height: 390px; } .terminal-cursor { color: #000; background: #f0f0f0; } </style> </head> <body> <script src="/socket.io/socket.io.js"></script> <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script src="index.js"></script> <script> ;(function() { $(document).ready(function() { var socket = io.connect(); socket.on('connect', function() { console.log("connected"); var term = new Terminal({ cols: 80, rows: 24, useStyle: true, screenKeys: true }); term.on('data', function(data) { if (data === '�') data = '#'; console.log("sending " + JSON.stringify(data)); socket.emit('data', data); }); term.on('title', function(title) { document.title = title; }); term.open(document.body); term.write('\x1b[31mBienvenue sur le terminal YRexpert !\x1b[m\r\n'); socket.on('data', function(data) { console.log("received " + JSON.stringify(data)); term.write(data); }); socket.on('disconnect', function() { console.log("socket disconnected"); term.destroy(); }); }); }); }).call(this); </script> </body> </html>