mirror of
https://github.com/LalleSX/4chan-XZ.git
synced 2026-01-30 09:48:12 +01:00
update diagnostic and add types
This commit is contained in:
parent
159b3cc760
commit
7cb3ec8b6e
File diff suppressed because it is too large
Load Diff
43
src/General/index.txt
Normal file
43
src/General/index.txt
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
selectRev: 0,
|
||||||
|
selectAll: false,
|
||||||
|
selectMode: false,
|
||||||
|
showHiddenThreads: false,
|
||||||
|
changed: false,
|
||||||
|
currentPage: 0,
|
||||||
|
currentSort: '',
|
||||||
|
navLinks: null,
|
||||||
|
selectSort: null,
|
||||||
|
selectSize: null,
|
||||||
|
lastLongOptions: null,
|
||||||
|
root: null,
|
||||||
|
button: null,
|
||||||
|
inputs: null,
|
||||||
|
pagelist: null,
|
||||||
|
search: '',
|
||||||
|
pageNum: 0,
|
||||||
|
req: null,
|
||||||
|
isReply: false,
|
||||||
|
isThread: false,
|
||||||
|
isClone: false,
|
||||||
|
enabled: false,
|
||||||
|
searchInput: null,
|
||||||
|
hideLabel: null,
|
||||||
|
lastLongInputs: null,
|
||||||
|
lastLongThresholds: null,
|
||||||
|
loaded: false,
|
||||||
|
liveThreadData: null,
|
||||||
|
pagesNum: 0,
|
||||||
|
ID: 0,
|
||||||
|
thread: null,
|
||||||
|
threadPosition: 0,
|
||||||
|
threadsNumPerPage: 0,
|
||||||
|
notice: null,
|
||||||
|
nodes: null,
|
||||||
|
nTimeout: 0,
|
||||||
|
replyData: null,
|
||||||
|
replyNodes: null,
|
||||||
|
sortedThreadIDs: null,
|
||||||
|
liveThreadDict: null,
|
||||||
|
parsedThreads: null,
|
||||||
|
liveThreadIDs: null,
|
||||||
|
initFinishedFired: false,
|
||||||
@ -4,12 +4,7 @@ import $ from "../platform/$"
|
|||||||
import { dict } from "../platform/helpers"
|
import { dict } from "../platform/helpers"
|
||||||
import QR from "../Posting/QR"
|
import QR from "../Posting/QR"
|
||||||
import Menu from "./Menu"
|
import Menu from "./Menu"
|
||||||
/*
|
|
||||||
* decaffeinate suggestions:
|
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
|
||||||
* DS207: Consider shorter variations of null checks
|
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
|
||||||
*/
|
|
||||||
const DeleteLink = {
|
const DeleteLink = {
|
||||||
auto: [dict(), dict()],
|
auto: [dict(), dict()],
|
||||||
|
|
||||||
@ -119,8 +114,7 @@ const DeleteLink = {
|
|||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
onloadend() { return DeleteLink.load(link, post, fileOnly, this.response) },
|
onloadend() { return DeleteLink.load(link, post, fileOnly, this.response) },
|
||||||
form: $.formData(form)
|
form: $.formData(form)
|
||||||
}
|
})
|
||||||
)
|
|
||||||
},
|
},
|
||||||
|
|
||||||
load(link, post, fileOnly, resDoc) {
|
load(link, post, fileOnly, resDoc) {
|
||||||
|
|||||||
@ -1,13 +1,8 @@
|
|||||||
import { Conf,g } from "../globals/globals"
|
import { Conf, g } from "../globals/globals"
|
||||||
import ImageCommon from "../Images/ImageCommon"
|
import ImageCommon from "../Images/ImageCommon"
|
||||||
import $ from "../platform/$"
|
import $ from "../platform/$"
|
||||||
import Menu from "./Menu"
|
import Menu from "./Menu"
|
||||||
|
|
||||||
/*
|
|
||||||
* decaffeinate suggestions:
|
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
|
||||||
*/
|
|
||||||
const DownloadLink = {
|
const DownloadLink = {
|
||||||
init() {
|
init() {
|
||||||
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Menu'] || !Conf['Download Link']) { return }
|
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Menu'] || !Conf['Download Link']) { return }
|
||||||
@ -24,9 +19,9 @@ const DownloadLink = {
|
|||||||
return Menu.menu.addEntry({
|
return Menu.menu.addEntry({
|
||||||
el: a,
|
el: a,
|
||||||
order: 100,
|
order: 100,
|
||||||
open({file}) {
|
open({ file }) {
|
||||||
if (!file) { return false }
|
if (!file) { return false }
|
||||||
a.href = file.url
|
a.href = file.url
|
||||||
a.download = file.name
|
a.download = file.name
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,7 @@ const FileInfo = {
|
|||||||
|
|
||||||
const oldInfo = $.el('span', {className: 'fileText-original'})
|
const oldInfo = $.el('span', {className: 'fileText-original'})
|
||||||
$.prepend(this.file.link.parentNode, oldInfo)
|
$.prepend(this.file.link.parentNode, oldInfo)
|
||||||
$.add(oldInfo, [this.file.link.previousSibling, this.file.link, this.file.link.nextSibling])
|
$.add(oldInfo, this.file.link)
|
||||||
|
|
||||||
const info = $.el('span', {className: 'file-info'})
|
const info = $.el('span', {className: 'file-info'})
|
||||||
FileInfo.format(Conf['fileInfo'], this, info)
|
FileInfo.format(Conf['fileInfo'], this, info)
|
||||||
|
|||||||
@ -15,12 +15,12 @@ const Flash = {
|
|||||||
|
|
||||||
initReady() {
|
initReady() {
|
||||||
if ($.hasStorage) {
|
if ($.hasStorage) {
|
||||||
return $.global(function () { if (JSON.parse(localStorage['4chan-settings'] || '{}').disableAll) { return window.SWFEmbed.init() } })
|
return $.global(function () { if (JSON.parse(localStorage['4chan-settings'] || '{}').disableAll) { return window.SWFEmbed.init() } }, 'SWFEmbed')
|
||||||
} else {
|
} else {
|
||||||
if (g.VIEW === 'thread') {
|
if (g.VIEW === 'thread') {
|
||||||
$.global(() => window.Main.tid = location.pathname.split(/\/+/)[3])
|
$.global(() => window.Main.tid = location.pathname.split(/\/+/)[3], 'Main')
|
||||||
}
|
}
|
||||||
return $.global(() => window.SWFEmbed.init())
|
return $.global(() => window.SWFEmbed.init(), 'SWFEmbed')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,11 +6,7 @@ import $ from "../platform/$"
|
|||||||
import $$ from "../platform/$$"
|
import $$ from "../platform/$$"
|
||||||
import ExpandComment from "./ExpandComment"
|
import ExpandComment from "./ExpandComment"
|
||||||
|
|
||||||
/*
|
|
||||||
* decaffeinate suggestions:
|
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
|
||||||
*/
|
|
||||||
const Fourchan = {
|
const Fourchan = {
|
||||||
init() {
|
init() {
|
||||||
if ((g.SITE.software !== 'yotsuba') || !['index', 'thread', 'archive'].includes(g.VIEW)) { return }
|
if ((g.SITE.software !== 'yotsuba') || !['index', 'thread', 'archive'].includes(g.VIEW)) { return }
|
||||||
@ -65,7 +61,7 @@ const Fourchan = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
, false))
|
, false), 'MathJax')
|
||||||
Callbacks.Post.push({
|
Callbacks.Post.push({
|
||||||
name: 'Parse [math] tags',
|
name: 'Parse [math] tags',
|
||||||
cb: Fourchan.math
|
cb: Fourchan.math
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
import Callbacks from "../classes/Callbacks"
|
import Callbacks from "../classes/Callbacks"
|
||||||
|
import Post from "../classes/Post"
|
||||||
import { g } from "../globals/globals"
|
import { g } from "../globals/globals"
|
||||||
import $ from "../platform/$"
|
import $ from "../platform/$"
|
||||||
|
|
||||||
@ -25,12 +26,12 @@ const IDHighlight = {
|
|||||||
if (!this.isClone) { return IDHighlight.set(this) }
|
if (!this.isClone) { return IDHighlight.set(this) }
|
||||||
},
|
},
|
||||||
|
|
||||||
set(post) {
|
set(post: Post) {
|
||||||
const match = (post.info.uniqueID || post.info.capcode) === IDHighlight.uniqueID
|
const match = (post.info.uniqueID || post.info.capcode) === IDHighlight.uniqueID
|
||||||
return $[match ? 'addClass' : 'rmClass'](post.nodes.post, 'highlight')
|
return $[match ? 'addClass' : 'rmClass'](post.nodes.post, 'highlight')
|
||||||
},
|
},
|
||||||
|
|
||||||
click(post) {
|
click(post: Post) {
|
||||||
return function () {
|
return function () {
|
||||||
const uniqueID = post.info.uniqueID || post.info.capcode
|
const uniqueID = post.info.uniqueID || post.info.capcode
|
||||||
IDHighlight.uniqueID = IDHighlight.uniqueID === uniqueID ? null : uniqueID
|
IDHighlight.uniqueID = IDHighlight.uniqueID === uniqueID ? null : uniqueID
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import { Conf, g } from "../globals/globals"
|
|||||||
import $ from "../platform/$"
|
import $ from "../platform/$"
|
||||||
|
|
||||||
const IDPostCount = {
|
const IDPostCount = {
|
||||||
|
thread: null as Thread,
|
||||||
init() {
|
init() {
|
||||||
if ((g.VIEW !== 'thread') || !Conf['Count Posts by ID']) { return }
|
if ((g.VIEW !== 'thread') || !Conf['Count Posts by ID']) { return }
|
||||||
Callbacks.Thread.push({
|
Callbacks.Thread.push({
|
||||||
|
|||||||
@ -58,6 +58,7 @@ export default class Post {
|
|||||||
})()
|
})()
|
||||||
normalizedOriginal: any
|
normalizedOriginal: any
|
||||||
indexRefreshSeen: any
|
indexRefreshSeen: any
|
||||||
|
callbacksExecuted: boolean
|
||||||
|
|
||||||
toString() { return this.ID }
|
toString() { return this.ID }
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
class ShimSet {
|
|
||||||
elements: Element
|
|
||||||
size: number
|
|
||||||
constructor() {
|
|
||||||
this.elements
|
|
||||||
this.size = 0
|
|
||||||
}
|
|
||||||
has(value) {
|
|
||||||
return value in this.elements
|
|
||||||
}
|
|
||||||
add(value) {
|
|
||||||
if (this.elements[value]) { return }
|
|
||||||
this.elements[value] = true
|
|
||||||
return this.size++
|
|
||||||
}
|
|
||||||
delete(value) {
|
|
||||||
if (!this.elements[value]) { return }
|
|
||||||
delete this.elements[value]
|
|
||||||
return this.size--
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!('Set' in window)) { window.Set = ShimSet }
|
|
||||||
@ -14,6 +14,7 @@ declare global {
|
|||||||
}
|
}
|
||||||
// interfaces might be incomplete
|
// interfaces might be incomplete
|
||||||
export interface BoardConfig {
|
export interface BoardConfig {
|
||||||
|
code_tags: 1 | 0,
|
||||||
sjis_tags: string,
|
sjis_tags: string,
|
||||||
math_tags: string,
|
math_tags: string,
|
||||||
forced_anon: boolean,
|
forced_anon: boolean,
|
||||||
|
|||||||
@ -239,7 +239,7 @@ $.ajax = (function () {
|
|||||||
pageXHR = XMLHttpRequest
|
pageXHR = XMLHttpRequest
|
||||||
}
|
}
|
||||||
|
|
||||||
const r = (function (url: string, options = dict(), cb: Callbacks) {
|
const r = (function (url: string, options = dict(), cb?: (this: XMLHttpRequest, e: ProgressEvent) => void) {
|
||||||
if (options.responseType == null) { options.responseType = 'json' }
|
if (options.responseType == null) { options.responseType = 'json' }
|
||||||
if (!options.type) { options.type = (options.form && 'post') || 'get' }
|
if (!options.type) { options.type = (options.form && 'post') || 'get' }
|
||||||
url = url.replace(/^((?:https?:)?\/\/(?:\w+\.)?(?:4chan|4channel|4cdn)\.org)\/adv\//, '$1//adv/')
|
url = url.replace(/^((?:https?:)?\/\/(?:\w+\.)?(?:4chan|4channel|4cdn)\.org)\/adv\//, '$1//adv/')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user