1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-03 19:56:22 -07:00

Replace ==/!= with ===/!==

This commit is contained in:
deepsource-autofix[bot] 2022-08-05 23:38:42 +00:00 committed by GitHub
parent e7777dca74
commit bfe50d9f20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 14 deletions

View file

@ -39,7 +39,7 @@ export function getPageThread() {
op: -1,
page: 0
};
if(arr == null) return info;
if(arr === null) return info;
if(arr.length > 1) info.op = arr[1];
if(arr.length > 3) info.page = arr[3];
if(arr.board != "") info.boardID = $("form#postform input[name=boardid]").val() -1;
@ -285,7 +285,7 @@ function createPostPreview(e, $post, inline = true) {
}
function previewMoveHandler(e) {
if($hoverPreview == null) return;
if($hoverPreview === null) return;
$hoverPreview.css({position: "absolute"}).offset({
top: e.pageY + 8,
left: e.pageX + 8
@ -294,7 +294,7 @@ function previewMoveHandler(e) {
function expandPost(e) {
e.preventDefault();
if($hoverPreview != null) $hoverPreview.remove();
if($hoverPreview !== null) $hoverPreview.remove();
let $next = $(e.target).next();
if($next.prop("class") == "inlinepostprev" && e.type == "click") {
// inline preview is already opened, close it
@ -303,7 +303,7 @@ function expandPost(e) {
}
let href = e.target.href;
let hrefArr = postrefRE.exec(href);
if(hrefArr == null) return; // not actually a link to a post, abort
if(hrefArr === null) return; // not actually a link to a post, abort
let postID = hrefArr[4]?hrefArr[4]:hrefArr[2];
let $post = $(`div#op${postID}, div#reply${postID}`).first();
@ -328,11 +328,11 @@ function expandPost(e) {
}
export function initPostPreviews($post = null) {
if(getPageThread().board == "" && $post == null) return;
if(getPageThread().board == "" && $post === null) return;
doClickPreview = getBooleanStorageVal("enablepostclick", true);
doHoverPreview = getBooleanStorageVal("enableposthover", false);
let $refs = null;
$refs = $post == null ? $("a.postref") : $post.find("a.postref");
$refs = $post === null ? $("a.postref") : $post.find("a.postref");
if(doClickPreview) {
$refs.on("click", expandPost);
@ -342,7 +342,7 @@ export function initPostPreviews($post = null) {
if(doHoverPreview) {
$refs.on("mouseenter", expandPost).on("mouseleave", () => {
if($hoverPreview != null) $hoverPreview.remove();
if($hoverPreview !== null) $hoverPreview.remove();
$hoverPreview = null;
$(document.body).off("mousemove", previewMoveHandler);
});
@ -465,7 +465,7 @@ export function editPost(id, board) {
export function reportPost(id, board) {
promptLightbox("", false, ($lb, reason) => {
if(reason == "" || reason == null) return;
if(reason == "" || reason === null) return;
let xhrFields = {
board: board,
report_btn: "Report",

View file

@ -31,7 +31,7 @@ const qrTitleBar =
`<a href="javascript:toTop();">${upArrow}</a><a href="javascript:closeQR();">X</a></span></div>`;
export function initQR(pageThread) {
if($qr != null) {
if($qr !== null) {
// QR box already initialized
return;
}

View file

@ -24,7 +24,7 @@ export function getCatalog(board = "") {
}).then((/** @type {CatalogBoard[]} */ data) => {
if(data.length == 0)
return [];
if(data[0] == null)
if(data[0] === null)
data.shift();
return data;
});

View file

@ -34,11 +34,11 @@ class Setting {
this.element = null;
}
getElementValue() {
if(this.element == null) return "";
if(this.element === null) return "";
return this.element.val();
}
setElementValue(newVal) {
if(this.element == null) return;
if(this.element === null) return;
this.element.val(newVal);
}
getStorageValue() {
@ -141,6 +141,6 @@ export function initSettings() {
min: 2
}, initWatcher))
if($settingsButton == null)
if($settingsButton === null)
$settingsButton = new TopBarButton("Settings", createLightbox);
}

View file

@ -85,7 +85,7 @@ export function initWatcher() {
clearInterval(watcherInterval);
}
let board = currentBoard();
watching = watched != null && watched[board] instanceof Array;
watching = watched !== null && watched[board] instanceof Array;
if(watching) {
getWatchedThreads();
watcherInterval = setInterval(getWatchedThreads, getNumberStorageVal("watcherseconds", 10) * 1000);