diff --git a/src/General/Index.js b/src/General/Index.js index 0f7988bf0..eba9a5b31 100644 --- a/src/General/Index.js +++ b/src/General/Index.js @@ -28,7 +28,7 @@ import UI from './UI'; import Menu from '../Menu/Menu'; import NavLinksPage from './Index/NavLinks.html'; -import PageListPage from './Index/PageList.html'; +import PageList from './Index/PageList.html'; import BoardConfig from './BoardConfig'; import Get from './Get'; import { dict, SECOND } from '../platform/helpers'; @@ -692,14 +692,14 @@ var Index = { const pagesRoot = $('.pages', Index.pagelist); // Previous/Next buttons - const prev = pagesRoot.previousSibling.firstChild; - const next = pagesRoot.nextSibling.firstChild; + const prev = pagesRoot.previousElementSibling.firstElementChild; + const next = pagesRoot.nextElementSibling.firstElementChild; let href = Math.max(pageNum - 1, 1); prev.href = href === 1 ? './' : href; - prev.firstChild.disabled = href === pageNum; + prev.firstElementChild.disabled = href === pageNum; href = Math.min(pageNum + 1, maxPageNum); next.href = href === 1 ? './' : href; - next.firstChild.disabled = href === pageNum; + next.firstElementChild.disabled = href === pageNum; // current page if (strong = $('strong', pagesRoot)) { diff --git a/src/General/Polyfill.js b/src/General/Polyfill.js index 73ce8168a..bde60afe8 100644 --- a/src/General/Polyfill.js +++ b/src/General/Polyfill.js @@ -11,7 +11,9 @@ const Polyfill = { $.global(this.toBlob); if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.mozMatchesSelector || Element.prototype.webkitMatchesSelector; } }, - toBlob() { + // This function is converted to a string and then put in a script tag. + // Do NOT shorten to `toBlob() {`. + toBlob: function() { if (HTMLCanvasElement.prototype.toBlob) { return; } HTMLCanvasElement.prototype.toBlob = function(cb, type, encoderOptions) { const url = this.toDataURL(type, encoderOptions); diff --git a/src/General/Settings.tsx b/src/General/Settings.tsx index 6b3e687f3..424932954 100644 --- a/src/General/Settings.tsx +++ b/src/General/Settings.tsx @@ -27,7 +27,7 @@ import Unread from '../Monitoring/Unread'; import $$ from '../platform/$$'; import $ from '../platform/$'; import meta from '../../package.json'; -import { c, Conf, d, doc, g } from '../globals/globals'; +import { c, Conf, d, doc, E, g } from '../globals/globals'; import Header from './Header'; import h, { hFragment } from '../globals/jsx'; import { dict, platform } from '../platform/helpers'; diff --git a/src/Menu/ReportLink.js b/src/Menu/ReportLink.js index 30c3c8652..972d4ba4c 100644 --- a/src/Menu/ReportLink.js +++ b/src/Menu/ReportLink.js @@ -1,4 +1,4 @@ -import { g, Conf } from "../globals/globals"; +import { g, Conf, d } from "../globals/globals"; import $ from "../platform/$"; import Menu from "./Menu"; diff --git a/src/Monitoring/MarkNewIPs.js b/src/Monitoring/MarkNewIPs.js index b11c3b9e6..fccce6bb8 100644 --- a/src/Monitoring/MarkNewIPs.js +++ b/src/Monitoring/MarkNewIPs.js @@ -1,5 +1,5 @@ import Callbacks from "../classes/Callbacks"; -import { g, Conf } from "../globals/globals"; +import { g, Conf, d } from "../globals/globals"; import $ from "../platform/$"; /* diff --git a/src/main/Main.js b/src/main/Main.js index 2a3e197a8..329052798 100644 --- a/src/main/Main.js +++ b/src/main/Main.js @@ -365,8 +365,8 @@ var Main = { if (!Main.isThisPageLegit()) { return; } // disable the mobile layout - // TODO check if exists - $('link[href*=mobile]', d.head).disabled = true; + const mobileLink = $('link[href*=mobile]', d.head); + if (mobileLink) mobileLink.disabled = true; doc.dataset.host = location.host; $.addClass(doc, `sw-${g.SITE.software}`); $.addClass(doc, g.VIEW === 'thread' ? 'thread-view' : g.VIEW); diff --git a/src/platform/$.js b/src/platform/$.js index b8efcfce8..6f290f811 100644 --- a/src/platform/$.js +++ b/src/platform/$.js @@ -357,7 +357,7 @@ $.rmClass = function(el, ...classNames) { $.toggleClass = (el, className) => el.classList.toggle(className); -$.hasClass = (el, className) => el.classList.includes(className); +$.hasClass = (el, className) => el.classList.contains(className); $.rm = el => el?.remove();