Skip to content

Commit e4fbd53

Browse files
committed
Update jslib、bugfix
1 parent 951e81b commit e4fbd53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+22614
-29080
lines changed

README.md

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,46 +33,22 @@
3333
[安装 Docker](https://docs.docker.com/engine/installation/)
3434

3535

36-
## 开源捐献日志(感谢各位网友的支持)
37-
38-
2017-11-22
39-
40-
@三斤(qq:1216884991) 捐献:100.00 元(人民币)
41-
42-
43-
2017-10-20
44-
45-
@贫道法号-乱来 捐献:100.00 元(人民币)
46-
47-
2017.04.05
48-
49-
@木乃伊(qq:357573995) 捐献:100.00 元(人民币)
50-
51-
2017.04.05
52-
53-
@朱小四(weichat:juechengke) 捐献:200.00 元(人民币)
54-
55-
2017.02.25
56-
57-
@jerry2049 捐献:100.00 元(人民币)
58-
59-
2016.03.13
60-
61-
@非非不在家(qq:762810120) 捐献:8.88 元(人民币)
36+
## 更新日志
6237

63-
2016.05.16
38+
2018.12.28
6439

65-
@玩蝴蝶的法师(qq:43588476) 捐献:50.00 元(人民币)
40+
更新:
6641

67-
## 更新日志
42+
1、更新核心js库
43+
2、合并 pczchen 提交的分支,支持 Docker 容器访问
44+
3、常规修复
6845

6946
2017.07.31
7047

7148
更新:
7249

7350
1、更新 xTerm.js
7451

75-
7652
2017.07.20
7753

7854
修证:

static/images/favicon.ico

59.5 KB
Binary file not shown.

static/images/favicon.ico.bak

-66.1 KB
Binary file not shown.

static/scripts/console.js

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
* QQ:155122504
66
*
77
*/
8-
(function(factory) {
9-
"use strict";
10-
if (typeof define === "function" && (define.amd || define.cmd)) {
11-
define(["jquery"], factory);
12-
} else {
13-
factory((typeof(jQuery) != "undefined") ? jQuery : window.Zepto);
14-
}
8+
(function (factory) {
9+
"use strict";
10+
if (typeof define === "function" && (define.amd || define.cmd)) {
11+
define(["jquery"], factory);
12+
} else {
13+
factory((typeof (jQuery) != "undefined") ? jQuery : window.Zepto);
1514
}
16-
(function($) {
15+
}
16+
(function ($) {
1717
"use strict";
1818
$.extend({
19-
LogOut: function() {
19+
LogOut: function () {
2020
location.href = "/console/logout" + "?rnd=" + Math.random();
2121
}
2222
});
2323

24-
$.fn.ConsoleLogin = function(options) {
24+
$.fn.ConsoleLogin = function (options) {
2525
if (options === undefined) {
2626
options = {};
2727
}
@@ -35,23 +35,23 @@
3535

3636
username.focus();
3737

38-
var boxMsg = function(t) {
38+
var boxMsg = function (t) {
3939
loginBoxMsg.html(t);
4040
loginBoxMsg.show();
4141
};
4242
var p = null;
43-
$loginForm.bind("form-pre-serialize", function(event, form, options, veto) {
43+
$loginForm.bind("form-pre-serialize", function (event, form, options, veto) {
4444
p = userpwd.val();
4545
});
4646

4747
if (standalone === true) {
48-
var keyEvt = function(obj) {
48+
var keyEvt = function (obj) {
4949
$.post("/console/chksshdaddr?rnd=" + Math.random(), {
5050
"vm_addr": obj.val()
51-
}, function(data) {
51+
}, function (data) {
5252
console.log("data:", data);
5353
var json = data;
54-
if (typeof(data) != "object") {
54+
if (typeof (data) != "object") {
5555
json = $.parseJSON(data);
5656
}
5757
if (json.ok) {
@@ -60,20 +60,20 @@
6060
}
6161
});
6262
};
63-
src_vmaddr.unbind("keyup").keyup(function(evt) {
63+
src_vmaddr.unbind("keyup").keyup(function (evt) {
6464
keyEvt($(this));
6565
});
66-
src_vmaddr.unbind("paste").bind("paste", function(evt) {
66+
src_vmaddr.unbind("paste").bind("paste", function (evt) {
6767
keyEvt($(this));
6868
});
69-
src_vmaddr.unbind("blur").blur(function(evt) {
69+
src_vmaddr.unbind("blur").blur(function (evt) {
7070
keyEvt($(this));
7171
});
7272
}
7373

7474
$loginForm.ajaxForm({
7575
dataType: "json",
76-
beforeSubmit: function(a, f, o) {
76+
beforeSubmit: function (a, f, o) {
7777
loginBoxMsg.hide();
7878
if (standalone === true) {
7979
if (src_vmaddr.val().length === 0) {
@@ -102,9 +102,9 @@
102102
return false;
103103
}
104104
},
105-
success: function(data) {
105+
success: function (data) {
106106
var json = data;
107-
if (typeof(data) != "object") {
107+
if (typeof (data) != "object") {
108108
json = $.parseJSON(data);
109109
}
110110
if (json.ok) {
@@ -118,14 +118,14 @@
118118
});
119119
};
120120

121-
$.fn.OpenTerminal = function(options) {
121+
$.fn.OpenTerminal = function (options) {
122122
if (options === undefined) {
123123
options = {};
124124
}
125125
var wsaddr, $console = this;
126126
wsaddr = options.wsaddr === undefined ? "ws://127.0.0.1:8080/console" : options.wsaddr;
127127

128-
var resizeTerminal = function(t, c, r) {
128+
var resizeTerminal = function (t, c, r) {
129129
var appbar_height = $("#c-appbar").height();
130130
var body_height = $(window).height();
131131
var body_width = $(window).width();
@@ -134,7 +134,7 @@
134134
t.resize(c, r);
135135
};
136136

137-
var getSize = function() {
137+
var getSize = function () {
138138
function getCharSize() {
139139
var span = $("<span>", { text: "qwertyuiopasdfghjklzxcvbnm" });
140140
$console.append(span);
@@ -173,7 +173,10 @@
173173
var term = null;
174174
var socket = new WebSocket(wsaddr + "?cols=" + cols + "&rows=" + rows);
175175

176-
socket.onopen = function() {
176+
Terminal.applyAddon(fit);
177+
Terminal.applyAddon(attach);
178+
179+
socket.onopen = function () {
177180
term = new Terminal({
178181
termName: "xterm",
179182
cols: cols,
@@ -186,6 +189,8 @@
186189
colors: Terminal.xtermColors
187190
});
188191

192+
console.log(term);
193+
189194
term.attach(socket);
190195
term._initialized = true;
191196

@@ -194,22 +199,18 @@
194199

195200
resizeTerminal(term, cols, rows);
196201

197-
$(window).resize(function() {
202+
$(window).resize(function () {
198203
resizeTerminal(term, cols, rows);
199204
});
200205

201-
term.on("title", function(title) {
206+
term.on("title", function (title) {
202207
$(document).prop("title", title);
203208
});
204209

205-
term.on('paste', function(data, ev) {
206-
term.write(data);
207-
});
208-
209210
window.term = term;
210211
window.socket = socket;
211212
};
212-
socket.onclose = function(e) {
213+
socket.onclose = function (e) {
213214
term.destroy();
214215
var span = $("<span></span>");
215216
span.text("网络中断(与服务器端连接已断开,请重新连接或联系管理员)。");
@@ -224,12 +225,12 @@
224225
});
225226
span.appendTo($console);
226227
};
227-
socket.onerror = function(e) {
228+
socket.onerror = function (e) {
228229
console.log("Socket error:", e);
229230
};
230231
};
231232

232-
$.fn.loading = function(options) {
233+
$.fn.loading = function (options) {
233234
if (options === undefined) {
234235
options = {};
235236
}

static/scripts/console.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)