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

View File

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

View File

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

View File

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