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dncoCHnBVliu0CQGBWlPY/5Kwo"+
"m2L/kruPM6Q7oz4tvDQy+bZ3HzOi+gNHA4DZEgA="+"");lib.resource.add("hterm/concat/date","text/plain","Sat, 10 Sep 2016 08:51:57 +0000"+"");lib.resource.add("hterm/changelog/version","text/plain","1.58"+"");lib.resource.add("hterm/changelog/date","text/plain","2016-07-12"+"");lib.resource.add("hterm/git/HEAD","text/plain","49f8641dd055afaad9eadcd8553804eff0dd2637"+"");</script>
- <script src="auth_token.js"></script>
- <script type="text/javascript">
- (function() {
- var httpsEnabled = window.location.protocol == "https:";
- var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';
- var protocols = ["tty"];
- var autoReconnect = -1;
-
- var openWs = function() {
- var ws = new WebSocket(url, protocols);
- var term, pingTimer;
+</head>
+<body>
+<div id="terminal"></div>
+<script src="auth_token.js"></script>
+<script type="text/javascript">
+ (function() {
+ var httpsEnabled = window.location.protocol == "https:";
+ var url = (httpsEnabled ? 'wss://' : 'ws://') + window.location.host + window.location.pathname + 'ws';
+ var protocols = ["tty"];
+ var autoReconnect = -1;
- ws.onopen = function(event) {
- if (typeof tty_auth_token !== 'undefined') {
- ws.send(JSON.stringify({AuthToken: tty_auth_token}));
- }
- pingTimer = setInterval(sendPing, 30 * 1000, ws);
+ var openWs = function() {
+ var termContainer = document.getElementById('terminal');
+ var ws = new WebSocket(url, protocols);
+ var term, pingTimer;
- hterm.defaultStorage = new lib.Storage.Local();
- hterm.defaultStorage.clear();
+ ws.onopen = function(event) {
+ if (typeof tty_auth_token !== 'undefined') {
+ ws.send(JSON.stringify({AuthToken: tty_auth_token}));
+ }
+ pingTimer = setInterval(sendPing, 30 * 1000, ws);
- term = new hterm.Terminal();
+ hterm.defaultStorage = new lib.Storage.Local();
+ hterm.defaultStorage.clear();
- term.getPrefs().set("send-encoding", "raw");
+ term = new hterm.Terminal();
- term.onTerminalReady = function() {
- var io = term.io.push();
+ term.getPrefs().set("send-encoding", "raw");
- io.onVTKeystroke = function(str) {
- if (ws.readyState === WebSocket.OPEN) {
- ws.send("0" + str);
- }
- };
+ term.onTerminalReady = function() {
+ var io = term.io.push();
- io.sendString = io.onVTKeystroke;
+ io.onVTKeystroke = function(str) {
+ if (ws.readyState === WebSocket.OPEN) {
+ ws.send("0" + str);
+ }
+ };
- io.onTerminalResize = function(columns, rows) {
- if (ws.readyState === WebSocket.OPEN) {
- ws.send("2" + JSON.stringify({columns: columns, rows: rows}));
- }
- };
+ io.sendString = io.onVTKeystroke;
- term.installKeyboard();
+ io.onTerminalResize = function(columns, rows) {
+ if (ws.readyState === WebSocket.OPEN) {
+ ws.send("2" + JSON.stringify({columns: columns, rows: rows}));
+ }
};
- var termContainer = document.getElementById('terminal');
- while (termContainer.firstChild) {
- termContainer.removeChild(termContainer.firstChild);
- }
- term.decorate(termContainer);
+ term.installKeyboard();
};
- ws.onmessage = function(event) {
- var data = event.data.slice(1);
- switch(event.data[0]) {
- case '0':
- term.io.writeUTF8(window.atob(data));
- break;
- case '1':
- // pong
- break;
- case '2':
- term.setWindowTitle(data);
- break;
- case '3':
- var preferences = JSON.parse(data);
- Object.keys(preferences).forEach(function(key) {
- console.log("Setting " + key + ": " + preferences[key]);
- term.getPrefs().set(key, preferences[key]);
- });
- break;
- case '4':
- autoReconnect = JSON.parse(data);
- console.log("Enabling reconnect: " + autoReconnect + " seconds")
- break;
- }
- };
+ while (termContainer.firstChild) {
+ termContainer.removeChild(termContainer.firstChild);
+ }
+ term.decorate(termContainer);
+ };
- ws.onclose = function(event) {
- if (term) {
- term.uninstallKeyboard();
- setTimeout(function(){
- term.io.showOverlay("Connection Closed", null);
- }, 300);
- }
- clearInterval(pingTimer);
- if (autoReconnect > 0) {
- setTimeout(openWs, autoReconnect * 1000);
- }
- };
+ ws.onmessage = function(event) {
+ var data = event.data.slice(1);
+ switch(event.data[0]) {
+ case '0':
+ term.io.writeUTF8(window.atob(data));
+ break;
+ case '1':
+ // pong
+ break;
+ case '2':
+ term.setWindowTitle(data);
+ break;
+ case '3':
+ var preferences = JSON.parse(data);
+ Object.keys(preferences).forEach(function(key) {
+ console.log("Setting " + key + ": " + preferences[key]);
+ term.getPrefs().set(key, preferences[key]);
+ });
+ break;
+ case '4':
+ autoReconnect = JSON.parse(data);
+ console.log("Enabling reconnect: " + autoReconnect + " seconds")
+ break;
+ }
+ };
- ws.onerror = function(event) {
- var errorNode = document.createElement('div');
- errorNode.style.cssText = [
- "color: red",
- "background-color: white",
- "font-size: x-large",
- "opacity: 0.75",
- "text-align: center",
- "margin: 1em",
- "padding: 0.2em",
- "border: 0.1em dotted #ccc"
- ].join(";");
- errorNode.textContent = "Websocket handshake failed!";
- document.getElementById('terminal').appendChild(errorNode);
- };
+ ws.onclose = function(event) {
+ if (term) {
+ term.uninstallKeyboard();
+ setTimeout(function(){
+ term.io.showOverlay("Connection Closed", null);
+ }, 300);
+ }
+ clearInterval(pingTimer);
+ if (autoReconnect > 0) {
+ setTimeout(openWs, autoReconnect * 1000);
+ }
};
- var sendPing = function(ws) {
- ws.send("1");
+ ws.onerror = function(event) {
+ var errorNode = document.createElement('div');
+ errorNode.style.cssText = [
+ "color: red",
+ "background-color: white",
+ "font-size: x-large",
+ "opacity: 0.75",
+ "text-align: center",
+ "margin: 1em",
+ "padding: 0.2em",
+ "border: 0.1em dotted #ccc"
+ ].join(";");
+ errorNode.textContent = "Websocket handshake failed!";
+ termContainer.appendChild(errorNode);
};
+ };
- openWs();
- })()
- </script>
-</head>
-<body>
-<div id="terminal"></div>
+ var sendPing = function(ws) {
+ ws.send("1");
+ };
+
+ openWs();
+ })()
+</script>
</body>
</html>
\ No newline at end of file