Fix some bugs after decaffeinate, fix some imports
This commit is contained in:
parent
567a1fe45e
commit
8f52b8be52
@ -28,7 +28,7 @@ import UI from './UI';
|
|||||||
import Menu from '../Menu/Menu';
|
import Menu from '../Menu/Menu';
|
||||||
|
|
||||||
import NavLinksPage from './Index/NavLinks.html';
|
import NavLinksPage from './Index/NavLinks.html';
|
||||||
import PageListPage from './Index/PageList.html';
|
import PageList from './Index/PageList.html';
|
||||||
import BoardConfig from './BoardConfig';
|
import BoardConfig from './BoardConfig';
|
||||||
import Get from './Get';
|
import Get from './Get';
|
||||||
import { dict, SECOND } from '../platform/helpers';
|
import { dict, SECOND } from '../platform/helpers';
|
||||||
@ -692,14 +692,14 @@ var Index = {
|
|||||||
const pagesRoot = $('.pages', Index.pagelist);
|
const pagesRoot = $('.pages', Index.pagelist);
|
||||||
|
|
||||||
// Previous/Next buttons
|
// Previous/Next buttons
|
||||||
const prev = pagesRoot.previousSibling.firstChild;
|
const prev = pagesRoot.previousElementSibling.firstElementChild;
|
||||||
const next = pagesRoot.nextSibling.firstChild;
|
const next = pagesRoot.nextElementSibling.firstElementChild;
|
||||||
let href = Math.max(pageNum - 1, 1);
|
let href = Math.max(pageNum - 1, 1);
|
||||||
prev.href = href === 1 ? './' : href;
|
prev.href = href === 1 ? './' : href;
|
||||||
prev.firstChild.disabled = href === pageNum;
|
prev.firstElementChild.disabled = href === pageNum;
|
||||||
href = Math.min(pageNum + 1, maxPageNum);
|
href = Math.min(pageNum + 1, maxPageNum);
|
||||||
next.href = href === 1 ? './' : href;
|
next.href = href === 1 ? './' : href;
|
||||||
next.firstChild.disabled = href === pageNum;
|
next.firstElementChild.disabled = href === pageNum;
|
||||||
|
|
||||||
// <strong> current page
|
// <strong> current page
|
||||||
if (strong = $('strong', pagesRoot)) {
|
if (strong = $('strong', pagesRoot)) {
|
||||||
|
|||||||
@ -11,7 +11,9 @@ const Polyfill = {
|
|||||||
$.global(this.toBlob);
|
$.global(this.toBlob);
|
||||||
if (!Element.prototype.matches) { Element.prototype.matches = Element.prototype.mozMatchesSelector || Element.prototype.webkitMatchesSelector; }
|
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; }
|
if (HTMLCanvasElement.prototype.toBlob) { return; }
|
||||||
HTMLCanvasElement.prototype.toBlob = function(cb, type, encoderOptions) {
|
HTMLCanvasElement.prototype.toBlob = function(cb, type, encoderOptions) {
|
||||||
const url = this.toDataURL(type, encoderOptions);
|
const url = this.toDataURL(type, encoderOptions);
|
||||||
|
|||||||
@ -27,7 +27,7 @@ import Unread from '../Monitoring/Unread';
|
|||||||
import $$ from '../platform/$$';
|
import $$ from '../platform/$$';
|
||||||
import $ from '../platform/$';
|
import $ from '../platform/$';
|
||||||
import meta from '../../package.json';
|
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 Header from './Header';
|
||||||
import h, { hFragment } from '../globals/jsx';
|
import h, { hFragment } from '../globals/jsx';
|
||||||
import { dict, platform } from '../platform/helpers';
|
import { dict, platform } from '../platform/helpers';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { g, Conf } from "../globals/globals";
|
import { g, Conf, d } from "../globals/globals";
|
||||||
import $ from "../platform/$";
|
import $ from "../platform/$";
|
||||||
import Menu from "./Menu";
|
import Menu from "./Menu";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import Callbacks from "../classes/Callbacks";
|
import Callbacks from "../classes/Callbacks";
|
||||||
import { g, Conf } from "../globals/globals";
|
import { g, Conf, d } from "../globals/globals";
|
||||||
import $ from "../platform/$";
|
import $ from "../platform/$";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@ -365,8 +365,8 @@ var Main = {
|
|||||||
if (!Main.isThisPageLegit()) { return; }
|
if (!Main.isThisPageLegit()) { return; }
|
||||||
|
|
||||||
// disable the mobile layout
|
// disable the mobile layout
|
||||||
// TODO check if exists
|
const mobileLink = $('link[href*=mobile]', d.head);
|
||||||
$('link[href*=mobile]', d.head).disabled = true;
|
if (mobileLink) mobileLink.disabled = true;
|
||||||
doc.dataset.host = location.host;
|
doc.dataset.host = location.host;
|
||||||
$.addClass(doc, `sw-${g.SITE.software}`);
|
$.addClass(doc, `sw-${g.SITE.software}`);
|
||||||
$.addClass(doc, g.VIEW === 'thread' ? 'thread-view' : g.VIEW);
|
$.addClass(doc, g.VIEW === 'thread' ? 'thread-view' : g.VIEW);
|
||||||
|
|||||||
@ -357,7 +357,7 @@ $.rmClass = function(el, ...classNames) {
|
|||||||
|
|
||||||
$.toggleClass = (el, className) => el.classList.toggle(className);
|
$.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();
|
$.rm = el => el?.remove();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user