Browse Source

Merge branch 'master' of github.com:butlerx/wetty

pull/126/head
butlerx 8 years ago
parent
commit
fd7f868fa8
  1. 3
      app.js
  2. 21
      public/index.html
  3. 16
      public/wetty/hterm_all.js
  4. 16
      public/wetty/index.html
  5. 5
      public/wetty/wetty.js

3
app.js

@ -127,7 +127,8 @@ io.on('connection', function(socket){
socket.emit('output', data);
});
term.on('exit', function(code) {
console.log((new Date()) + " PID=" + term.pid + " ENDED")
console.log((new Date()) + " PID=" + term.pid + " ENDED");
socket.emit('logout');
});
socket.on('resize', function(data) {
term.resize(data.col, data.row);

21
public/index.html

@ -14,6 +14,20 @@
width: 100%;
margin: 0px;
}
#overlay {
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.75);;
display: none;
}
#overlay input {
display: block;
margin: auto;
position: relative;
top: 50%;
transform: translateY(-50%);
}
#terminal {
display: block;
position: relative;
@ -24,7 +38,14 @@
</head>
<body>
<div id="overlay"><input type="button" onclick="javascript:location.reload();" value="reconnect" /></div>
<div id="terminal"></div>
<script type="application/javascript">
window.addEventListener('beforeunload', function(e) {
e.returnValue = "Are you sure?";
return e.returnValue;
});
</script>
</body>
</html>

16
public/wetty/hterm_all.js

@ -8375,6 +8375,10 @@ hterm.ScrollPort.prototype.decorate = function(div) {
// from screen.js. I need to pick a better name for one of them to avoid
// the collision.
this.screen_ = doc.createElement('x-screen');
this.screen_.setAttribute('contenteditable', 'true');
this.screen_.setAttribute('spellcheck', 'false');
this.screen_.setAttribute('autocorrect', 'false');
this.screen_.setAttribute('autocomplete', 'false');
this.screen_.setAttribute('role', 'textbox');
this.screen_.setAttribute('tabindex', '-1');
this.screen_.style.cssText = (
@ -8525,7 +8529,7 @@ hterm.ScrollPort.prototype.getForegroundColor = function() {
};
hterm.ScrollPort.prototype.setForegroundColor = function(color) {
this.screen_.style.color = color;
//this.screen_.style.color = color;
};
hterm.ScrollPort.prototype.getBackgroundColor = function() {
@ -12825,14 +12829,17 @@ hterm.TextAttributes.prototype.isDefault = function() {
* attributes.
*/
hterm.TextAttributes.prototype.createContainer = function(opt_textContent) {
if (this.isDefault())
return this.document_.createTextNode(opt_textContent);
//if (this.isDefault())
// return this.document_.createTextNode(opt_textContent);
var span = this.document_.createElement('span');
var style = span.style;
if (this.foreground != this.DEFAULT_COLOR)
if (this.foreground != this.DEFAULT_COLOR) {
style.color = this.foreground;
} else {
style.color = this.defaultForeground;
}
if (this.background != this.DEFAULT_COLOR)
style.backgroundColor = this.background;
@ -12893,6 +12900,7 @@ hterm.TextAttributes.prototype.createContainer = function(opt_textContent) {
* this attributes instance.
*/
hterm.TextAttributes.prototype.matchesContainer = function(obj) {
return false;
if (typeof obj == 'string' || obj.nodeType == 3)
return this.isDefault();

16
public/wetty/index.html

@ -14,6 +14,21 @@
width: 100%;
margin: 0px;
}
#overlay {
position: absolute;
height: 100%;
width: 100%;
background-color: rgba(0,0,0,0.75);;
display: none;
z-index: 100;
}
#overlay input {
display: block;
margin: auto;
position: relative;
top: 50%;
transform: translateY(-50%);
}
#terminal {
display: block;
position: relative;
@ -24,6 +39,7 @@
</head>
<body>
<div id="overlay"><input type="button" onclick="javascript:location.reload();" value="reconnect" /></div>
<div id="terminal"></div>
</body>

5
public/wetty/wetty.js

@ -59,6 +59,11 @@ socket.on('output', function(data) {
term.io.writeUTF16(data);
});
socket.on('logout', function(data) {
console.log("user logout");
document.getElementById("overlay").style.display = "block";
});
socket.on('disconnect', function() {
console.log("Socket.io connection closed");
});

Loading…
Cancel
Save