Use attr() instead of data()
This commit is contained in:
parent
ae56191b9f
commit
104692007f
@ -58,7 +58,7 @@ function addWhoisItem() {
|
||||
}
|
||||
|
||||
socket.emit("input", {
|
||||
target: $("#chat").data("id"),
|
||||
target: Number($("#chat").attr("data-id")),
|
||||
text: "/whois " + itemData,
|
||||
});
|
||||
}
|
||||
@ -93,7 +93,7 @@ function addQueryItem() {
|
||||
}
|
||||
|
||||
socket.emit("input", {
|
||||
target: $("#chat").data("id"),
|
||||
target: Number($("#chat").attr("data-id")),
|
||||
text: "/query " + itemData,
|
||||
});
|
||||
}
|
||||
@ -139,7 +139,7 @@ function addConnectItem() {
|
||||
check: (target) => target.hasClass("lobby") && target.parent().hasClass("not-connected"),
|
||||
className: "connect",
|
||||
displayName: "Connect",
|
||||
data: (target) => target.data("id"),
|
||||
data: (target) => target.attr("data-id"),
|
||||
callback: connect,
|
||||
});
|
||||
}
|
||||
@ -156,7 +156,7 @@ function addDisconnectItem() {
|
||||
check: (target) => target.hasClass("lobby") && !target.parent().hasClass("not-connected"),
|
||||
className: "disconnect",
|
||||
displayName: "Disconnect",
|
||||
data: (target) => target.data("id"),
|
||||
data: (target) => target.attr("data-id"),
|
||||
callback: disconnect,
|
||||
});
|
||||
}
|
||||
@ -164,13 +164,13 @@ function addDisconnectItem() {
|
||||
function addKickItem() {
|
||||
function kick(itemData) {
|
||||
socket.emit("input", {
|
||||
target: $("#chat").data("id"),
|
||||
target: Number($("#chat").attr("data-id")),
|
||||
text: "/kick " + itemData,
|
||||
});
|
||||
}
|
||||
|
||||
addContextMenuItem({
|
||||
check: (target) => utils.hasRoleInChannel(target.closest(".chan"), ["op"]) && target.closest(".chan").data("type") === "channel",
|
||||
check: (target) => utils.hasRoleInChannel(target.closest(".chan"), ["op"]) && target.closest(".chan").attr("data-type") === "channel",
|
||||
className: "action-kick",
|
||||
displayName: "Kick",
|
||||
data: (target) => target.attr("data-name"),
|
||||
@ -181,7 +181,7 @@ function addKickItem() {
|
||||
function addOpItem() {
|
||||
function op(itemData) {
|
||||
socket.emit("input", {
|
||||
target: $("#chat").data("id"),
|
||||
target: Number($("#chat").attr("data-id")),
|
||||
text: "/op " + itemData,
|
||||
});
|
||||
}
|
||||
@ -200,7 +200,7 @@ function addOpItem() {
|
||||
function addDeopItem() {
|
||||
function deop(itemData) {
|
||||
socket.emit("input", {
|
||||
target: $("#chat").data("id"),
|
||||
target: Number($("#chat").attr("data-id")),
|
||||
text: "/deop " + itemData,
|
||||
});
|
||||
}
|
||||
@ -219,7 +219,7 @@ function addDeopItem() {
|
||||
function addVoiceItem() {
|
||||
function voice(itemData) {
|
||||
socket.emit("input", {
|
||||
target: $("#chat").data("id"),
|
||||
target: Number($("#chat").attr("data-id")),
|
||||
text: "/voice " + itemData,
|
||||
});
|
||||
}
|
||||
@ -238,7 +238,7 @@ function addVoiceItem() {
|
||||
function addDevoiceItem() {
|
||||
function devoice(itemData) {
|
||||
socket.emit("input", {
|
||||
target: $("#chat").data("id"),
|
||||
target: Number($("#chat").attr("data-id")),
|
||||
text: "/devoice " + itemData,
|
||||
});
|
||||
}
|
||||
@ -292,7 +292,7 @@ function addEditNetworkItem() {
|
||||
check: (target) => target.hasClass("lobby"),
|
||||
className: "edit",
|
||||
displayName: "Edit this network…",
|
||||
data: (target) => target.closest(".network").data("uuid"),
|
||||
data: (target) => target.closest(".network").attr("data-uuid"),
|
||||
callback: edit,
|
||||
});
|
||||
}
|
||||
@ -309,7 +309,7 @@ function addChannelListItem() {
|
||||
check: (target) => target.hasClass("lobby"),
|
||||
className: "list",
|
||||
displayName: "List all channels",
|
||||
data: (target) => target.data("id"),
|
||||
data: (target) => target.attr("data-id"),
|
||||
callback: list,
|
||||
});
|
||||
}
|
||||
@ -326,7 +326,7 @@ function addBanListItem() {
|
||||
check: (target) => target.hasClass("channel"),
|
||||
className: "list",
|
||||
displayName: "List banned users",
|
||||
data: (target) => target.data("id"),
|
||||
data: (target) => target.attr("data-id"),
|
||||
callback: banlist,
|
||||
});
|
||||
}
|
||||
@ -340,7 +340,7 @@ function addJoinItem() {
|
||||
check: (target) => target.hasClass("lobby"),
|
||||
className: "join",
|
||||
displayName: "Join a channel…",
|
||||
data: (target) => target.data("id"),
|
||||
data: (target) => target.attr("data-id"),
|
||||
callback: openJoinForm,
|
||||
});
|
||||
}
|
||||
@ -357,7 +357,7 @@ function addIgnoreListItem() {
|
||||
check: (target) => target.hasClass("lobby"),
|
||||
className: "list",
|
||||
displayName: "List ignored users",
|
||||
data: (target) => target.data("id"),
|
||||
data: (target) => target.attr("data-id"),
|
||||
callback: ignorelist,
|
||||
});
|
||||
}
|
||||
|
@ -163,15 +163,13 @@ window.vueMounted = () => {
|
||||
|
||||
utils.updateTitle();
|
||||
|
||||
const type = chan.data("type");
|
||||
|
||||
if (self.hasClass("chan")) {
|
||||
vueApp.$nextTick(() => $("#chat-container").addClass("active"));
|
||||
}
|
||||
|
||||
const chanChat = chan.find(".chat");
|
||||
|
||||
if (chanChat.length > 0 && type !== "special") {
|
||||
if (chanChat.length > 0 && channel.type !== "special") {
|
||||
// On touch devices unfocus (blur) the input to correctly close the virtual keyboard
|
||||
// An explicit blur is required, as the keyboard may open back up if the focus remains
|
||||
// See https://github.com/thelounge/thelounge/issues/2257
|
||||
@ -200,7 +198,7 @@ window.vueMounted = () => {
|
||||
if (self.prop("id")) {
|
||||
state.clickTarget = `#${self.prop("id")}`;
|
||||
} else if (self.hasClass("chan")) {
|
||||
state.clickTarget = `#sidebar .chan[data-id="${self.data("id")}"]`;
|
||||
state.clickTarget = `#sidebar .chan[data-id="${self.attr("data-id")}"]`;
|
||||
} else {
|
||||
state.clickTarget = `#footer button[data-target="${target}"]`;
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ const {vueApp} = require("./vue");
|
||||
require("../js/autocompletion");
|
||||
|
||||
const $windows = $("#windows");
|
||||
const $chat = $("#chat");
|
||||
const $settings = $("#settings");
|
||||
const $theme = $("#theme");
|
||||
const $userStyles = $("#user-specified-css");
|
||||
@ -125,10 +124,6 @@ function applySetting(name, value) {
|
||||
} else {
|
||||
module.exports.highlightsRE = null;
|
||||
}
|
||||
} else if (name === "showSeconds") {
|
||||
$chat.find(".msg > .time").each(function() {
|
||||
$(this).text(tz($(this).parent().data("time")));
|
||||
});
|
||||
} else if (name === "desktopNotifications") {
|
||||
if (("Notification" in window) && value && Notification.permission !== "granted") {
|
||||
Notification.requestPermission(updateDesktopNotificationStatus);
|
||||
|
@ -126,7 +126,7 @@ function closeImageViewer({pushState = true} = {}) {
|
||||
if (pushState) {
|
||||
const clickTarget =
|
||||
"#sidebar " +
|
||||
`.chan[data-id="${$("#sidebar .chan.active").data("id")}"]`;
|
||||
`.chan[data-id="${$("#sidebar .chan.active").attr("data-id")}"]`;
|
||||
history.pushState({clickTarget}, null, null);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
const $ = require("jquery");
|
||||
const socket = require("../socket");
|
||||
const sidebar = $("#sidebar");
|
||||
const {vueApp, initChannel} = require("../vue");
|
||||
|
||||
socket.on("join", function(data) {
|
||||
@ -17,11 +16,6 @@ socket.on("join", function(data) {
|
||||
}
|
||||
|
||||
vueApp.$nextTick(() => {
|
||||
sidebar.find(".chan")
|
||||
.sort(function(a, b) {
|
||||
return $(a).data("id") - $(b).data("id");
|
||||
})
|
||||
.last()
|
||||
.trigger("click");
|
||||
$(`#sidebar .chan[data-id="${data.chan.id}"]`).trigger("click");
|
||||
});
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ socket.on("sync_sort", function(data) {
|
||||
$.each(order, function(index, value) {
|
||||
const position = $(container.children(".network")[index]);
|
||||
|
||||
if (position.data("id") === value) { // Network in correct place
|
||||
if (Number(position.attr("data-id")) === value) { // Network in correct place
|
||||
return true; // No point in continuing
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ socket.on("sync_sort", function(data) {
|
||||
|
||||
const position = $(network.children(".chan")[index]); // Target channel at position
|
||||
|
||||
if (position.data("id") === value) { // Channel in correct place
|
||||
if (Number(position.attr("data-id")) === value) { // Channel in correct place
|
||||
return true; // No point in continuing
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ function hasRoleInChannel(channel, roles, nick) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const channelID = channel.data("id");
|
||||
const channelID = channel.attr("data-id");
|
||||
const network = $("#sidebar .network").has(`.chan[data-id="${channelID}"]`);
|
||||
const target = nick || network.attr("data-nick");
|
||||
const user = channel.find(`.names-original .user[data-name="${escape(target)}"]`).first();
|
||||
@ -142,7 +142,7 @@ function closeChan(chan) {
|
||||
}
|
||||
|
||||
socket.emit("input", {
|
||||
target: chan.data("id"),
|
||||
target: Number(chan.attr("data-id")),
|
||||
text: cmd,
|
||||
});
|
||||
chan.css({
|
||||
|
Loading…
Reference in New Issue
Block a user