Merge pull request #1518 from thelounge/xpaw/cleanup-jquery

Remove unnecessary end() calls
This commit is contained in:
Al McKinlay 2017-09-14 07:25:55 +01:00 committed by GitHub
commit 676cc01203
4 changed files with 12 additions and 15 deletions

View File

@ -515,23 +515,25 @@ $(function() {
e.preventDefault();
var event = "auth";
var form = $(this);
form.find(".btn")
.attr("disabled", true)
.end();
form.find(".btn").attr("disabled", true);
if (form.closest(".window").attr("id") === "connect") {
event = "conn";
} else if (form.closest("div").attr("id") === "change-password") {
event = "change-password";
}
var values = {};
$.each(form.serializeArray(), function(i, obj) {
if (obj.value !== "") {
values[obj.name] = obj.value;
}
});
if (values.user) {
storage.set("user", values.user);
}
socket.emit(
event, values
);

View File

@ -34,13 +34,9 @@ socket.on("auth", function(data) {
return;
}
$("#footer").find(".sign-in")
$("#footer")
.find(".sign-in")
.trigger("click", {
pushState: false,
})
.end()
.find(".networks")
.html("")
.next()
.show();
});
});

View File

@ -14,8 +14,7 @@ socket.on("network", function(data) {
$("#connect")
.find(".btn")
.prop("disabled", false)
.end();
.prop("disabled", false);
});
socket.on("network_changed", function(data) {

View File

@ -6,12 +6,12 @@ const sidebar = $("#sidebar");
socket.on("quit", function(data) {
const id = data.network;
sidebar.find("#network-" + id)
.remove()
.end();
sidebar.find("#network-" + id).remove();
const chan = sidebar.find(".chan")
.eq(0)
.trigger("click");
if (chan.length === 0) {
sidebar.find(".empty").show();
}