mirror of
https://github.com/LalleSX/4chan-XZ.git
synced 2025-10-07 07:22:37 +02:00
bugsfixes and add types
This commit is contained in:
parent
4494192787
commit
f869225c41
@ -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
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import Post from "../classes/Post"
|
||||
import Thread from "../classes/Thread"
|
||||
import { Conf, g } from "../globals/globals"
|
||||
import $ from "../platform/$"
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@ import $ from "../platform/$"
|
||||
|
||||
|
||||
const Menu = {
|
||||
menu: null,
|
||||
init() {
|
||||
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Menu']) { return }
|
||||
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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 }
|
||||
|
||||
@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -6,6 +6,7 @@ import $ from "../platform/$"
|
||||
|
||||
|
||||
const QuoteCT = {
|
||||
mark: null,
|
||||
init() {
|
||||
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Mark Cross-thread Quotes']) { return }
|
||||
|
||||
|
||||
@ -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 }
|
||||
|
||||
|
||||
@ -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_")]'
|
||||
|
||||
@ -41,7 +41,7 @@ const Site = {
|
||||
}
|
||||
}
|
||||
if (changed) {
|
||||
$.set('siteProperties', Conf['siteProperties'])
|
||||
$.set('siteProperties', Conf['siteProperties'], true)
|
||||
}
|
||||
if (!g.SITE) {
|
||||
this.set(hostname)
|
||||
|
||||
1
src/types/globals.d.ts
vendored
1
src/types/globals.d.ts
vendored
@ -1,5 +1,6 @@
|
||||
declare const XPCNativeWrapper: any
|
||||
export interface File {
|
||||
name: string
|
||||
isImage: boolean
|
||||
isVideo: boolean
|
||||
thumb: HTMLElement
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user