mirror of
https://github.com/paradoxxxzero/butterfly.git
synced 2026-05-29 16:39:41 +00:00
Package app (get rid of useless stuff)
This commit is contained in:
9
app/static/javascripts/bootstrap.min.js
vendored
9
app/static/javascripts/bootstrap.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,66 +1,68 @@
|
||||
// Generated by CoffeeScript 1.6.3
|
||||
var cols, rows, term, ws;
|
||||
var $, cols, resize, rows, term, ws, ws_url;
|
||||
|
||||
term = ws = null;
|
||||
|
||||
cols = rows = null;
|
||||
|
||||
$(function() {
|
||||
var ws_url;
|
||||
ws_url = 'ws://' + document.location.host + '/ws';
|
||||
if (location.pathname.indexOf('/wd') === 0) {
|
||||
ws_url += location.pathname.slice(3);
|
||||
}
|
||||
ws = new WebSocket(ws_url);
|
||||
ws.onopen = function() {
|
||||
console.log("WebSocket open", arguments);
|
||||
term = new Terminal({
|
||||
visualBell: 100,
|
||||
screenKeys: true,
|
||||
scrollback: -1
|
||||
});
|
||||
term.on("data", function(data) {
|
||||
return ws.send('SH|' + data);
|
||||
});
|
||||
term.on("title", function(title) {
|
||||
return document.title = title;
|
||||
});
|
||||
term.open($('main').get(0));
|
||||
$('.terminal').attr('style', '');
|
||||
return $(window).trigger('resize');
|
||||
};
|
||||
ws.onclose = function() {
|
||||
if (term) {
|
||||
term.destroy();
|
||||
}
|
||||
console.log("WebSocket closed", arguments);
|
||||
return open('', '_self').close();
|
||||
};
|
||||
ws.onerror = function() {
|
||||
return console.log("WebSocket error", arguments);
|
||||
};
|
||||
ws.onmessage = function(event) {
|
||||
return term.write(event.data);
|
||||
};
|
||||
return $(window).resize(function() {
|
||||
var $main, $termtest, $test, eh, ew, h, w;
|
||||
$main = $('main');
|
||||
$termtest = $('<div>').addClass('terminal');
|
||||
$test = $('<div>').text('0123456789');
|
||||
$termtest.append($test);
|
||||
$main.append($termtest);
|
||||
eh = $test.outerHeight();
|
||||
$test.css({
|
||||
display: 'inline'
|
||||
});
|
||||
ew = $test.outerWidth() / 10;
|
||||
$termtest.remove();
|
||||
w = $main.outerWidth();
|
||||
h = $main.outerHeight();
|
||||
cols = Math.floor(w / ew) - 1;
|
||||
rows = Math.floor(h / eh);
|
||||
console.log("Computed " + cols + " cols and " + rows + " rows from main size " + w + ", " + h + " and div " + ew + ", " + eh);
|
||||
term.resize(cols, rows);
|
||||
return ws.send("RS|" + cols + "," + rows);
|
||||
$ = document.querySelectorAll.bind(document);
|
||||
|
||||
ws_url = 'ws://' + document.location.host + '/ws' + location.pathname;
|
||||
|
||||
ws = new WebSocket(ws_url);
|
||||
|
||||
ws.onopen = function() {
|
||||
console.log("WebSocket open", arguments);
|
||||
term = new Terminal({
|
||||
visualBell: 100,
|
||||
screenKeys: true,
|
||||
scrollback: -1
|
||||
});
|
||||
term.on("data", function(data) {
|
||||
return ws.send('SH|' + data);
|
||||
});
|
||||
term.on("title", function(title) {
|
||||
return document.title = title;
|
||||
});
|
||||
term.open($('main')[0]);
|
||||
$('.terminal')[0].style = '';
|
||||
return resize();
|
||||
};
|
||||
|
||||
ws.onclose = function() {
|
||||
if (term) {
|
||||
term.destroy();
|
||||
}
|
||||
console.log("WebSocket closed", arguments);
|
||||
return open('', '_self').close();
|
||||
};
|
||||
|
||||
ws.onerror = function() {
|
||||
return console.log("WebSocket error", arguments);
|
||||
};
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
return term.write(event.data);
|
||||
};
|
||||
|
||||
addEventListener('resize', resize = function() {
|
||||
var eh, ew, fake_term, fake_term_div, fake_term_line, main, main_bb;
|
||||
main = $('main')[0];
|
||||
fake_term = document.createElement('div');
|
||||
fake_term.className = 'terminal test';
|
||||
fake_term_div = document.createElement('div');
|
||||
fake_term_line = document.createElement('span');
|
||||
fake_term_line.textContent = '0123456789';
|
||||
fake_term_div.appendChild(fake_term_line);
|
||||
fake_term.appendChild(fake_term_div);
|
||||
main.appendChild(fake_term);
|
||||
ew = fake_term_line.getBoundingClientRect().width;
|
||||
eh = fake_term_div.getBoundingClientRect().height;
|
||||
main.removeChild(fake_term);
|
||||
main_bb = main.getBoundingClientRect();
|
||||
cols = Math.floor(10 * main_bb.width / ew) - 1;
|
||||
rows = Math.floor(main_bb.height / eh);
|
||||
console.log("Computed " + cols + " cols and " + rows + " rows from ", main_bb, ew, eh);
|
||||
term.resize(cols, rows);
|
||||
return ws.send("RS|" + cols + "," + rows);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user