Remove usage of == and !=
This commit is contained in:
parent
205a617c51
commit
b67cd10c64
21 changed files with 79 additions and 78 deletions
|
@ -94,7 +94,7 @@ function splitHostPort(str) {
|
|||
function fillConnectParams(params) {
|
||||
let host = window.location.host || "localhost:8080";
|
||||
let proto = "wss:";
|
||||
if (window.location.protocol != "https:") {
|
||||
if (window.location.protocol !== "https:") {
|
||||
proto = "ws:";
|
||||
}
|
||||
let path = window.location.pathname || "/";
|
||||
|
@ -687,7 +687,7 @@ export default class App extends Component {
|
|||
}
|
||||
|
||||
let msgUnread = Unread.NONE;
|
||||
if ((msg.command == "PRIVMSG" || msg.command == "NOTICE") && !isRead) {
|
||||
if ((msg.command === "PRIVMSG" || msg.command === "NOTICE") && !isRead) {
|
||||
let target = msg.params[0];
|
||||
let text = msg.params[1];
|
||||
|
||||
|
@ -702,7 +702,7 @@ export default class App extends Component {
|
|||
msgUnread = Unread.MESSAGE;
|
||||
}
|
||||
|
||||
if (msgUnread == Unread.HIGHLIGHT && !isDelivered && !irc.parseCTCP(msg)) {
|
||||
if (msgUnread === Unread.HIGHLIGHT && !isDelivered && !irc.parseCTCP(msg)) {
|
||||
let title = "New " + kind + " from " + msg.prefix.name;
|
||||
if (client.isChannel(bufName)) {
|
||||
title += " in " + bufName;
|
||||
|
@ -760,7 +760,7 @@ export default class App extends Component {
|
|||
|
||||
// Open a new buffer if the message doesn't come from me or is a
|
||||
// self-message
|
||||
if ((!client.isMyNick(msg.prefix.name) || client.isMyNick(bufName)) && (msg.command != "PART" && msg.comand != "QUIT" && msg.command != irc.RPL_MONONLINE && msg.command != irc.RPL_MONOFFLINE)) {
|
||||
if ((!client.isMyNick(msg.prefix.name) || client.isMyNick(bufName)) && (msg.command !== "PART" && msg.comand !== "QUIT" && msg.command !== irc.RPL_MONONLINE && msg.command !== irc.RPL_MONOFFLINE)) {
|
||||
this.createBuffer(serverID, bufName);
|
||||
}
|
||||
|
||||
|
@ -978,7 +978,7 @@ export default class App extends Component {
|
|||
affectedBuffers.push(chatHistoryBatch.params[0]);
|
||||
} else {
|
||||
this.state.buffers.forEach((buf) => {
|
||||
if (buf.server != serverID) {
|
||||
if (buf.server !== serverID) {
|
||||
return;
|
||||
}
|
||||
if (!buf.members.has(msg.prefix.name)) {
|
||||
|
@ -996,7 +996,7 @@ export default class App extends Component {
|
|||
affectedBuffers.push(chatHistoryBatch.params[0]);
|
||||
} else {
|
||||
this.state.buffers.forEach((buf) => {
|
||||
if (buf.server != serverID) {
|
||||
if (buf.server !== serverID) {
|
||||
return;
|
||||
}
|
||||
if (!buf.members.has(msg.prefix.name)) {
|
||||
|
@ -1149,7 +1149,7 @@ export default class App extends Component {
|
|||
if (client.isMyNick(msg.prefix.name)) {
|
||||
this.syncBufferUnread(serverID, channel);
|
||||
}
|
||||
if (channel == this.switchToChannel) {
|
||||
if (channel === this.switchToChannel) {
|
||||
this.switchBuffer({ server: serverID, name: channel });
|
||||
this.switchToChannel = null;
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ export default class App extends Component {
|
|||
});
|
||||
break;
|
||||
default:
|
||||
if (irc.isError(msg.command) && msg.command != irc.ERR_NOMOTD) {
|
||||
if (irc.isError(msg.command) && msg.command !== irc.ERR_NOMOTD) {
|
||||
let description = msg.params[msg.params.length - 1];
|
||||
this.showError(description);
|
||||
}
|
||||
|
@ -1527,7 +1527,7 @@ export default class App extends Component {
|
|||
servers.delete(buf.server);
|
||||
|
||||
let connectForm = state.connectForm;
|
||||
if (servers.size == 0) {
|
||||
if (servers.size === 0) {
|
||||
connectForm = true;
|
||||
}
|
||||
|
||||
|
@ -1598,7 +1598,7 @@ export default class App extends Component {
|
|||
}
|
||||
|
||||
privmsg(target, text) {
|
||||
if (target == SERVER_BUFFER) {
|
||||
if (target === SERVER_BUFFER) {
|
||||
this.showError("Cannot send message in server buffer");
|
||||
return;
|
||||
}
|
||||
|
@ -1743,7 +1743,7 @@ export default class App extends Component {
|
|||
|
||||
async handleBufferScrollTop() {
|
||||
let buf = this.state.buffers.get(this.state.activeBuffer);
|
||||
if (!buf || buf.type == BufferType.SERVER) {
|
||||
if (!buf || buf.type === BufferType.SERVER) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1922,7 +1922,7 @@ export default class App extends Component {
|
|||
this.dismissDialog();
|
||||
|
||||
if (this.state.dialogData && this.state.dialogData.id) {
|
||||
if (Object.keys(attrs).length == 0) {
|
||||
if (Object.keys(attrs).length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2062,7 +2062,7 @@ export default class App extends Component {
|
|||
let bufferHeader = null;
|
||||
if (activeBuffer) {
|
||||
let activeUser = null;
|
||||
if (activeBuffer.type == BufferType.NICK) {
|
||||
if (activeBuffer.type === BufferType.NICK) {
|
||||
activeUser = activeServer.users.get(activeBuffer.name);
|
||||
}
|
||||
|
||||
|
@ -2086,7 +2086,7 @@ export default class App extends Component {
|
|||
}
|
||||
|
||||
let memberList = null;
|
||||
if (activeBuffer && activeBuffer.type == BufferType.CHANNEL) {
|
||||
if (activeBuffer && activeBuffer.type === BufferType.CHANNEL) {
|
||||
memberList = html`
|
||||
<section
|
||||
id="member-list"
|
||||
|
|
|
@ -19,7 +19,7 @@ export default class NetworkForm extends Component {
|
|||
|
||||
handleInput(event) {
|
||||
let target = event.target;
|
||||
let value = target.type == "checkbox" ? target.checked : target.value;
|
||||
let value = target.type === "checkbox" ? target.checked : target.value;
|
||||
this.setState({ [target.name]: value });
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ export default function BufferHeader(props) {
|
|||
}
|
||||
|
||||
let name = props.buffer.name;
|
||||
if (props.buffer.type == BufferType.SERVER) {
|
||||
if (props.buffer.type === BufferType.SERVER) {
|
||||
name = getServerName(props.server, props.bouncerNetwork);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ function BufferItem(props) {
|
|||
}
|
||||
|
||||
let name = props.buffer.name;
|
||||
if (props.buffer.type == BufferType.SERVER) {
|
||||
if (props.buffer.type === BufferType.SERVER) {
|
||||
name = getServerName(props.server, props.bouncerNetwork);
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ function BufferItem(props) {
|
|||
if (props.active) {
|
||||
classes.push("active");
|
||||
}
|
||||
if (props.buffer.unread != Unread.NONE) {
|
||||
if (props.buffer.unread !== Unread.NONE) {
|
||||
classes.push("unread-" + props.buffer.unread);
|
||||
}
|
||||
switch (props.buffer.type) {
|
||||
|
@ -75,7 +75,7 @@ export default function BufferList(props) {
|
|||
bouncerNetwork=${bouncerNetwork}
|
||||
onClick=${() => props.onBufferClick(buf)}
|
||||
onClose=${() => props.onBufferClose(buf)}
|
||||
active=${props.activeBuffer == buf.id}
|
||||
active=${props.activeBuffer === buf.id}
|
||||
/>
|
||||
`;
|
||||
});
|
||||
|
|
|
@ -134,7 +134,7 @@ class LogLine extends Component {
|
|||
|
||||
let ctcp = irc.parseCTCP(msg);
|
||||
if (ctcp) {
|
||||
if (ctcp.command == "ACTION") {
|
||||
if (ctcp.command === "ACTION") {
|
||||
lineClass = "me-tell";
|
||||
content = html`* ${createNick(msg.prefix.name)} ${linkify(stripANSI(ctcp.param), onChannelClick)}`;
|
||||
} else {
|
||||
|
@ -145,7 +145,7 @@ class LogLine extends Component {
|
|||
} else {
|
||||
lineClass = "talk";
|
||||
let prefix = "<", suffix = ">";
|
||||
if (msg.command == "NOTICE") {
|
||||
if (msg.command === "NOTICE") {
|
||||
prefix = suffix = "-";
|
||||
}
|
||||
content = html`${prefix}${createNick(msg.prefix.name)}${suffix} ${linkify(stripANSI(text), onChannelClick)}`;
|
||||
|
@ -200,7 +200,7 @@ class LogLine extends Component {
|
|||
let user = html`${createNick(msg.prefix.name)}`;
|
||||
|
||||
// TODO: use irc.forEachChannelModeUpdate()
|
||||
if (buf.type == BufferType.CHANNEL && modeStr.length === 2 && server.cm(buf.name) === server.cm(target)) {
|
||||
if (buf.type === BufferType.CHANNEL && modeStr.length === 2 && server.cm(buf.name) === server.cm(target)) {
|
||||
let plusMinus = modeStr[0];
|
||||
let mode = modeStr[1];
|
||||
let arg = msg.params[2];
|
||||
|
@ -357,7 +357,7 @@ class LogLine extends Component {
|
|||
content = html`${createNick(buf.name)} is offline`;
|
||||
break;
|
||||
default:
|
||||
if (irc.isError(msg.command) && msg.command != irc.ERR_NOMOTD) {
|
||||
if (irc.isError(msg.command) && msg.command !== irc.ERR_NOMOTD) {
|
||||
lineClass = "error";
|
||||
}
|
||||
content = html`${msg.command} ${linkify(msg.params.join(" "))}`;
|
||||
|
@ -676,13 +676,13 @@ export default class Buffer extends Component {
|
|||
let serverName = server.name;
|
||||
|
||||
let children = [];
|
||||
if (buf.type == BufferType.SERVER) {
|
||||
if (buf.type === BufferType.SERVER) {
|
||||
children.push(html`<${NotificationNagger}/>`);
|
||||
}
|
||||
if (buf.type == BufferType.SERVER && server.isBouncer && !server.bouncerNetID) {
|
||||
if (buf.type === BufferType.SERVER && server.isBouncer && !server.bouncerNetID) {
|
||||
children.push(html`<${ProtocolHandlerNagger} bouncerName=${serverName}/>`);
|
||||
}
|
||||
if (buf.type == BufferType.SERVER && server.status == ServerStatus.REGISTERED && server.supportsSASLPlain && !server.account) {
|
||||
if (buf.type === BufferType.SERVER && server.status === ServerStatus.REGISTERED && server.supportsSASLPlain && !server.account) {
|
||||
children.push(html`
|
||||
<${AccountNagger}
|
||||
server=${server}
|
||||
|
@ -752,7 +752,7 @@ export default class Buffer extends Component {
|
|||
keep[partIndexes.get(msg.prefix.name)] = false;
|
||||
partIndexes.delete(msg.prefix.name);
|
||||
keep.push(false);
|
||||
} else if (msg.command === "NICK" && msg.prefix.name == msg.params[0]) {
|
||||
} else if (msg.command === "NICK" && msg.prefix.name === msg.params[0]) {
|
||||
keep.push(false);
|
||||
} else {
|
||||
keep.push(true);
|
||||
|
@ -795,7 +795,7 @@ export default class Buffer extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
if (!hasUnreadSeparator && buf.type != BufferType.SERVER && !isMessageBeforeReceipt(msg, buf.prevReadReceipt)) {
|
||||
if (!hasUnreadSeparator && buf.type !== BufferType.SERVER && !isMessageBeforeReceipt(msg, buf.prevReadReceipt)) {
|
||||
sep.push(html`<${UnreadSeparator} key="unread"/>`);
|
||||
hasUnreadSeparator = true;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ export default class ConnectForm extends Component {
|
|||
|
||||
handleInput(event) {
|
||||
let target = event.target;
|
||||
let value = target.type == "checkbox" ? target.checked : target.value;
|
||||
let value = target.type === "checkbox" ? target.checked : target.value;
|
||||
this.setState({ [target.name]: value });
|
||||
}
|
||||
|
||||
|
|
|
@ -21,13 +21,13 @@ export default class Dialog extends Component {
|
|||
}
|
||||
|
||||
handleBackdropClick(event) {
|
||||
if (event.target.className == "dialog") {
|
||||
if (event.target.className === "dialog") {
|
||||
this.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
handleKeyDown(event) {
|
||||
if (event.key == "Escape") {
|
||||
if (event.key === "Escape") {
|
||||
this.dismiss();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ export default class JoinForm extends Component {
|
|||
|
||||
handleInput(event) {
|
||||
let target = event.target;
|
||||
let value = target.type == "checkbox" ? target.checked : target.value;
|
||||
let value = target.type === "checkbox" ? target.checked : target.value;
|
||||
this.setState({ [target.name]: value });
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ export default class NetworkForm extends Component {
|
|||
|
||||
handleInput(event) {
|
||||
let target = event.target;
|
||||
let value = target.type == "checkbox" ? target.checked : target.value;
|
||||
let value = target.type === "checkbox" ? target.checked : target.value;
|
||||
this.setState({ [target.name]: value });
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,10 @@ export default class NetworkForm extends Component {
|
|||
|
||||
let params = {};
|
||||
Object.keys(defaultParams).forEach((k) => {
|
||||
if (!this.props.isNew && this.prevParams[k] == this.state[k]) {
|
||||
if (!this.props.isNew && this.prevParams[k] === this.state[k]) {
|
||||
return;
|
||||
}
|
||||
if (this.props.isNew && defaultParams[k] == this.state[k]) {
|
||||
if (this.props.isNew && defaultParams[k] === this.state[k]) {
|
||||
return;
|
||||
}
|
||||
params[k] = this.state[k];
|
||||
|
|
|
@ -15,7 +15,7 @@ export default class RegisterForm extends Component {
|
|||
|
||||
handleInput(event) {
|
||||
let target = event.target;
|
||||
let value = target.type == "checkbox" ? target.checked : target.value;
|
||||
let value = target.type === "checkbox" ? target.checked : target.value;
|
||||
this.setState({ [target.name]: value });
|
||||
}
|
||||
|
||||
|
|
|
@ -48,13 +48,13 @@ export default class ScrollManager extends Component {
|
|||
}
|
||||
}
|
||||
|
||||
if (target.scrollTop == 0) {
|
||||
if (target.scrollTop === 0) {
|
||||
this.props.onScrollTop();
|
||||
}
|
||||
}
|
||||
|
||||
handleScroll() {
|
||||
if (this.props.target.current.scrollTop == 0) {
|
||||
if (this.props.target.current.scrollTop === 0) {
|
||||
this.props.onScrollTop();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ export default class SettingsForm extends Component {
|
|||
|
||||
handleInput(event) {
|
||||
let target = event.target;
|
||||
let value = target.type == "checkbox" ? target.checked : target.value;
|
||||
let value = target.type === "checkbox" ? target.checked : target.value;
|
||||
this.setState({ [target.name]: value }, () => {
|
||||
this.props.onChange(this.state);
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ export default class RegisterForm extends Component {
|
|||
|
||||
handleInput(event) {
|
||||
let target = event.target;
|
||||
let value = target.type == "checkbox" ? target.checked : target.value;
|
||||
let value = target.type === "checkbox" ? target.checked : target.value;
|
||||
this.setState({ [target.name]: value });
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue