bugsfixes and add types

This commit is contained in:
Lalle 2023-05-06 01:36:05 +02:00
parent 4494192787
commit f869225c41
No known key found for this signature in database
GPG Key ID: A6583D207A8F6B0D
13 changed files with 26 additions and 17 deletions

View File

@ -12,6 +12,8 @@ import archives from './archives.json'
const Redirect = {
archives,
selectedArchives: dict(),
data: dict(),
init() {
this.selectArchives()
@ -122,7 +124,7 @@ const Redirect = {
}
}
const items = { archives, lastarchivecheck: Date.now() }
$.set(items)
$.set(Conf, items, true)
$.extend(Conf, items)
Redirect.selectArchives()
return cb

View File

@ -1,4 +1,5 @@
import Post from "../classes/Post"
import Thread from "../classes/Thread"
import { Conf, g } from "../globals/globals"
import $ from "../platform/$"

View File

@ -6,6 +6,7 @@ import $ from "../platform/$"
const Menu = {
menu: null,
init() {
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Menu']) { return }

View File

@ -18,7 +18,7 @@ const AntiAutoplay = {
name: 'Disable Autoplaying Sounds',
cb: this.node
})
return $.ready(() => this.process(d.body))
return $.ready(() => this.process(document.body))
},
stop(audio) {

View File

@ -67,7 +67,7 @@ const FileInfo = {
L() { return <a href={this.file.url} target="_blank">{FileInfo.formatters.N.call(this)}</a> },
n() {
const fullname = this.file.name
const shortname = SW.yotsuba.Build.shortFilename(this.file.name, this.isReply)
const shortname = SW.yotsuba.Build.shortFilename(this.file.name)
if (fullname === shortname) {
return { innerHTML: E(fullname), [isEscaped]: true }
} else {

View File

@ -19,7 +19,7 @@ const IDColor = {
cb: this.node
})
},
ids: dict(),
node() {
let span, uid
if (this.isClone || !((uid = this.info.uniqueID) && (span = this.nodes.uniqueID))) { return }

View File

@ -1,5 +1,5 @@
import Notice from "../classes/Notice"
import { Conf, doc,g } from "../globals/globals"
import { Conf, doc, g } from "../globals/globals"
import Main from "../main/Main"
import $ from "../platform/$"
@ -8,17 +8,18 @@ const PSA = {
init() {
let el
if ((g.SITE.software === 'yotsuba') && (g.BOARD.ID === 'qa')) {
const announcement = {innerHTML: "Stay in touch with your <a href=\"https://www.4chan-x.net/qa_friends.html\" target=\"_blank\" rel=\"noopener\">/qa/ friends</a>!"}
el = $.el('div', {className: 'fcx-announcement'}, announcement)
const announcement = { innerHTML: "Stay in touch with your <a href=\"https://www.4chan-x.net/qa_friends.html\" target=\"_blank\" rel=\"noopener\">/qa/ friends</a>!" }
el = $.el('div', { className: 'fcx-announcement' }, announcement)
$.onExists(doc, '.boardBanner', banner => $.after(banner, el))
}
if ('samachan.org' in Conf['siteProperties'] && !Conf['PSAseen'].includes('samachan')) {
el = $.el('span',
{innerHTML: "<a href=\"https://sushigirl.us/yakuza/res/776.html\" target=\"_blank\" rel=\"noopener\">Looking for a new home?<br>Some former Samachan users are regrouping on SushiChan.</a><br>(a message from 4chan X)"})
return Main.ready(function() {
{ innerHTML: "<a href=\"https://sushigirl.us/yakuza/res/776.html\" target=\"_blank\" rel=\"noopener\">Looking for a new home?<br>Some former Samachan users are regrouping on SushiChan.</a><br>(a message from 4chan X)" })
return Main.ready(function () {
new Notice('info', el)
Conf['PSAseen'].push('samachan')
return $.set('PSAseen', Conf['PSAseen'])})
return $.set('PSAseen', Conf['PSAseen'], true)
})
}
}
}

View File

@ -7,17 +7,17 @@ const PassMessage = {
init() {
if (Conf['passMessageClosed']) { return }
const msg = $.el('div',
{className: 'box-outer top-box'}
,
{ className: 'box-outer top-box' }
,
PassMessagePage)
msg.style.cssText = 'padding-bottom: 0;'
const close = $('a', msg)
$.on(close, 'click', function() {
$.on(close, 'click', function () {
$.rm(msg)
return $.set('passMessageClosed', true)
return $.set('passMessageClosed', Conf, true)
})
return $.ready(function() {
let hd
return $.ready(function () {
let hd: HTMLElement
if (hd = $.id('hd')) {
return $.after(hd, msg)
} else {

View File

@ -6,6 +6,7 @@ import $ from "../platform/$"
const QuoteCT = {
mark: null,
init() {
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Mark Cross-thread Quotes']) { return }

View File

@ -10,6 +10,7 @@ import $ from "../platform/$"
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
*/
const QuoteOP = {
mark: null,
init() {
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Mark OP Quotes']) { return }

View File

@ -193,6 +193,7 @@ const SWTinyboard = {
},
xpath: {
post: 'div[starts-with(@id,"reply_")]',
thread: 'div[starts-with(@id,"thread_")]',
postContainer: 'div[starts-with(@id,"reply_") or starts-with(@id,"thread_")]',
replyContainer: 'div[starts-with(@id,"reply_")]'

View File

@ -41,7 +41,7 @@ const Site = {
}
}
if (changed) {
$.set('siteProperties', Conf['siteProperties'])
$.set('siteProperties', Conf['siteProperties'], true)
}
if (!g.SITE) {
this.set(hostname)

View File

@ -1,5 +1,6 @@
declare const XPCNativeWrapper: any
export interface File {
name: string
isImage: boolean
isVideo: boolean
thumb: HTMLElement