1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-03 23: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, op: -1,
page: 0 page: 0
}; };
if(arr == null) return info; if(arr === null) return info;
if(arr.length > 1) info.op = arr[1]; if(arr.length > 1) info.op = arr[1];
if(arr.length > 3) info.page = arr[3]; if(arr.length > 3) info.page = arr[3];
if(arr.board != "") info.boardID = $("form#postform input[name=boardid]").val() -1; 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) { function previewMoveHandler(e) {
if($hoverPreview == null) return; if($hoverPreview === null) return;
$hoverPreview.css({position: "absolute"}).offset({ $hoverPreview.css({position: "absolute"}).offset({
top: e.pageY + 8, top: e.pageY + 8,
left: e.pageX + 8 left: e.pageX + 8
@ -294,7 +294,7 @@ function previewMoveHandler(e) {
function expandPost(e) { function expandPost(e) {
e.preventDefault(); e.preventDefault();
if($hoverPreview != null) $hoverPreview.remove(); if($hoverPreview !== null) $hoverPreview.remove();
let $next = $(e.target).next(); let $next = $(e.target).next();
if($next.prop("class") == "inlinepostprev" && e.type == "click") { if($next.prop("class") == "inlinepostprev" && e.type == "click") {
// inline preview is already opened, close it // inline preview is already opened, close it
@ -303,7 +303,7 @@ function expandPost(e) {
} }
let href = e.target.href; let href = e.target.href;
let hrefArr = postrefRE.exec(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 postID = hrefArr[4]?hrefArr[4]:hrefArr[2];
let $post = $(`div#op${postID}, div#reply${postID}`).first(); let $post = $(`div#op${postID}, div#reply${postID}`).first();
@ -328,11 +328,11 @@ function expandPost(e) {
} }
export function initPostPreviews($post = null) { export function initPostPreviews($post = null) {
if(getPageThread().board == "" && $post == null) return; if(getPageThread().board == "" && $post === null) return;
doClickPreview = getBooleanStorageVal("enablepostclick", true); doClickPreview = getBooleanStorageVal("enablepostclick", true);
doHoverPreview = getBooleanStorageVal("enableposthover", false); doHoverPreview = getBooleanStorageVal("enableposthover", false);
let $refs = null; let $refs = null;
$refs = $post == null ? $("a.postref") : $post.find("a.postref"); $refs = $post === null ? $("a.postref") : $post.find("a.postref");
if(doClickPreview) { if(doClickPreview) {
$refs.on("click", expandPost); $refs.on("click", expandPost);
@ -342,7 +342,7 @@ export function initPostPreviews($post = null) {
if(doHoverPreview) { if(doHoverPreview) {
$refs.on("mouseenter", expandPost).on("mouseleave", () => { $refs.on("mouseenter", expandPost).on("mouseleave", () => {
if($hoverPreview != null) $hoverPreview.remove(); if($hoverPreview !== null) $hoverPreview.remove();
$hoverPreview = null; $hoverPreview = null;
$(document.body).off("mousemove", previewMoveHandler); $(document.body).off("mousemove", previewMoveHandler);
}); });
@ -465,7 +465,7 @@ export function editPost(id, board) {
export function reportPost(id, board) { export function reportPost(id, board) {
promptLightbox("", false, ($lb, reason) => { promptLightbox("", false, ($lb, reason) => {
if(reason == "" || reason == null) return; if(reason == "" || reason === null) return;
let xhrFields = { let xhrFields = {
board: board, board: board,
report_btn: "Report", 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>`; `<a href="javascript:toTop();">${upArrow}</a><a href="javascript:closeQR();">X</a></span></div>`;
export function initQR(pageThread) { export function initQR(pageThread) {
if($qr != null) { if($qr !== null) {
// QR box already initialized // QR box already initialized
return; return;
} }

View file

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

View file

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

View file

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