Fix some bugs after decaffeinate, fix some imports

This commit is contained in:
Tuxedo Takodachi 2023-03-17 19:50:17 +01:00
parent 567a1fe45e
commit 8f52b8be52
7 changed files with 14 additions and 12 deletions

View File

@ -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;
// <strong> current page
if (strong = $('strong', pagesRoot)) {

View File

@ -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);

View File

@ -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';

View File

@ -1,4 +1,4 @@
import { g, Conf } from "../globals/globals";
import { g, Conf, d } from "../globals/globals";
import $ from "../platform/$";
import Menu from "./Menu";

View File

@ -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/$";
/*

View File

@ -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);

View File

@ -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();