From f2481111dfe28f4a42f188edbc138422052dc732 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Thu, 21 Sep 2017 21:35:06 -0500 Subject: [PATCH] Fix indents --- public/assets/js/glass-websockets.js | 76 ++++++++++++++-------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/public/assets/js/glass-websockets.js b/public/assets/js/glass-websockets.js index c000a2c..fc72b38 100644 --- a/public/assets/js/glass-websockets.js +++ b/public/assets/js/glass-websockets.js @@ -6,30 +6,30 @@ function check_websocket_connection () { } function connect_websocket() { - killed_connection = 0; + killed_connection = 0; - delete socket; - socket = new WebSocket("ws://" + window.location.hostname + ":8080"); + delete socket; + socket = new WebSocket("ws://" + window.location.hostname + ":8080"); - socket.onopen = function (event) { - console.log("[Websocket] socket is opened - readystate is " + socket.readyState); - }; + socket.onopen = function (event) { + console.log("[Websocket] socket is opened - readystate is " + socket.readyState); + }; - socket.onmessage = function (event) { - if(killed_connection) - return false; + socket.onmessage = function (event) { + if (killed_connection) + return false; - if(!document.getElementById("dhcp_log")){ - console.log("[Websocket] DHCP Log unsubscribed"); - socket.send(JSON.stringify({"event_unsubscribe": "dhcp_log_subscription"})); - killed_connection = 1; - return false; - } + if (!document.getElementById("dhcp_log")) { + console.log("[Websocket] DHCP Log unsubscribed"); + socket.send(JSON.stringify({"event_unsubscribe": "dhcp_log_subscription"})); + killed_connection = 1; + return false; + } console_data = event.data; - if(typeof mac_oui_data !== "undefined") { + if (typeof mac_oui_data !== "undefined") { if (console_data.split(":").length - 1 >= 8) { var line_data = console_data.split(" "); for (i = 0; i < line_data.length; i++) { @@ -42,35 +42,35 @@ function connect_websocket() { } /* - Note: the only thing I stream currently is dhcp log - so later incoming messages will need to be - keyed by their "type" via json + Note: the only thing I stream currently is dhcp log - so later incoming messages will need to be + keyed by their "type" via json */ - var grep_value = document.getElementById("grep_fitler").value; + var grep_value = document.getElementById("grep_fitler").value; - if(grep_value){ - var matcher = new RegExp(grep_value, "i"); - var found = matcher.test(console_data); - if(!found && !console_data.includes(grep_value)){ - return false; - } - } + if (grep_value) { + var matcher = new RegExp(grep_value, "i"); + var found = matcher.test(console_data); + if (!found && !console_data.includes(grep_value)) { + return false; + } + } - var session = editor.session; - session.insert({ - row: session.getLength(), - column: 0 - }, "\n" + console_data); + var session = editor.session; + session.insert({ + row: session.getLength(), + column: 0 + }, "\n" + console_data); - if(session.getLength() >= 50000){ + if (session.getLength() >= 50000) { /* If we get over 500,000 lines lets clear the editor */ - editor.setValue(""); - } + editor.setValue(""); + } - var row = editor.session.getLength() - 1; - var column = editor.session.getLine(row).length; // or simply Infinity - editor.gotoLine(row + 1, column); - }; + var row = editor.session.getLength() - 1; + var column = editor.session.getLine(row).length; // or simply Infinity + editor.gotoLine(row + 1, column); + }; } connect_websocket();