Skip to content

Commit

Permalink
Codacy 3
Browse files Browse the repository at this point in the history
  • Loading branch information
omersiar committed Apr 2, 2018
1 parent 210fc83 commit dad52e2
Showing 1 changed file with 26 additions and 27 deletions.
53 changes: 26 additions & 27 deletions src/websrc/js/esprfid.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,15 @@ function listnetwork() {
if (config.network.wmode === "1") {
document.getElementById("wmodeap").checked = true;
if (config.network.hide === "1") {
var value = "1";
$("input[name=\"hideapenable\"][value=" + value + "]").prop("checked", true);
$("input[name=\"hideapenable\"][value=\"1\"]").prop("checked", true);
//$("input[name=hideapenable][value=\"1\"]").attr("checked", "checked");
}
handleAP();
} else {
document.getElementById("wmodesta").checked = true;
document.getElementById("wifibssid").value = config.network.bssid;
if (config.network.dhcp === "0") {
var value = "0";
$("input[name=\"dhcpenabled\"][value=" + value + "]").prop("checked", true);
$("input[name=\"dhcpenabled\"][value=\"0\"]").prop("checked", true);
//$("input[name=dhcpenabled][value=\"0\"]").attr("checked", "checked");
handleDHCP();
}
Expand All @@ -386,8 +384,7 @@ function listgeneral() {

function listmqtt() {
if (config.mqtt.enabled === "1") {
var value = "1";
$("input[name=\"mqttenabled\"][value=" + value + "]").prop("checked", true);
$("input[name=\"mqttenabled\"][value=\"1\"]").prop("checked", true);
//$("input[name=mqttenabled][value=\"1\"]").attr("checked", "checked");
}
document.getElementById("mqtthost").value = config.mqtt.host;
Expand Down Expand Up @@ -1140,7 +1137,7 @@ $(".noimp").on("click", function() {



window.FooTable.MyFiltering = FooTable.Filtering.extend({
window.FooTable.MyFiltering = window.FooTable.Filtering.extend({
construct: function(instance) {
this._super(instance);
this.acctypes = ["1", "99", "0"];
Expand Down Expand Up @@ -1203,7 +1200,7 @@ var yDown = null;
function handleTouchStart(evt) {
xDown = evt.touches[0].clientX;
yDown = evt.touches[0].clientY;
};
}

function handleTouchMove(evt) {
if (!xDown || !yDown) {
Expand Down Expand Up @@ -1254,13 +1251,24 @@ function logout() {
return false;
}

$("#update").on("shown.bs.modal", function(e) {
GetLatestReleaseInfo();
})




function connectWS() {
if (window.location.protocol === "https:") {
wsUri = "wss://" + window.location.hostname + "/ws";
} else if (window.location.protocol === "file:") {
wsUri = "ws://" + "localhost" + "/ws";
}
websock = new WebSocket(wsUri);
websock.addEventListener("message", socketMessageListener);

websock.onopen = function(evt) {
websock.send("{\"command\":\"getconf\"}");
websock.send("{\"command\":\"status\"}");
};
}


function upload() {
Expand All @@ -1273,7 +1281,7 @@ function login() {
$("#signin").modal("hide");
connectWS();
} else {
var username = "admin"
var username = "admin";
var password = document.getElementById("password").value;
var url = "/login";
var xhr = new XMLHttpRequest();
Expand All @@ -1293,11 +1301,10 @@ function login() {
}


function GetLatestReleaseInfo() {
function getLatestReleaseInfo() {

$.getJSON("https://api.github.com/repos/omersiar/esp-rfid/releases/latest").done(function(release) {
var asset = release.assets[0];
onlinebin = asset.browser_download_url;
var downloadCount = 0;
for (var i = 0; i < release.assets.length; i++) {
downloadCount += release.assets[i].download_count;
Expand All @@ -1321,24 +1328,16 @@ function GetLatestReleaseInfo() {
}).error(function() { $("#onlineupdate").html("<h5>Couldn't get release info. Are you connected to the Internet?</h5>"); });
}


$("#update").on("shown.bs.modal", function(e) {
getLatestReleaseInfo();
});

function allowUpload() {
$("#upbtn").prop("disabled", false);
}

function connectWS() {
if (window.location.protocol === "https:") {
wsUri = "wss://" + window.location.hostname + "/ws";
} else if (window.location.protocol === "file:") {
wsUri = "ws://" + "localhost" + "/ws";
}
websock = new WebSocket(wsUri);
websock.addEventListener("message", socketMessageListener);

websock.onopen = function(evt) {
websock.send("{\"command\":\"getconf\"}");
websock.send("{\"command\":\"status\"}");
};
}

function start() {
esprfidcontent = document.createElement("div");
Expand Down

0 comments on commit dad52e2

Please sign in to comment.