mirror of
https://github.com/LalleSX/4chan-XZ.git
synced 2026-03-20 01:37:47 +01:00
types and bugfixes
This commit is contained in:
parent
5a34fa1435
commit
4494192787
@ -1,9 +1,10 @@
|
|||||||
|
import Post from "../classes/Post"
|
||||||
import { Conf, g } from "../globals/globals"
|
import { Conf, g } from "../globals/globals"
|
||||||
import $ from "../platform/$"
|
import $ from "../platform/$"
|
||||||
|
|
||||||
|
|
||||||
const Get = {
|
const Get = {
|
||||||
url(type, IDs, ...args) {
|
url(type: string, IDs: any, ...args: any[]) {
|
||||||
let f, site
|
let f, site
|
||||||
if ((site = g.sites[IDs.siteID]) && (f = $.getOwn(site.urls, type))) {
|
if ((site = g.sites[IDs.siteID]) && (f = $.getOwn(site.urls, type))) {
|
||||||
return f(IDs, ...Array.from(args))
|
return f(IDs, ...Array.from(args))
|
||||||
|
|||||||
@ -1,3 +1,6 @@
|
|||||||
|
import { event } from "jquery"
|
||||||
|
|
||||||
|
import Callbacks from "../classes/Callbacks"
|
||||||
import { Conf, d, doc } from "../globals/globals"
|
import { Conf, d, doc } from "../globals/globals"
|
||||||
import Main from "../main/Main"
|
import Main from "../main/Main"
|
||||||
import $ from "../platform/$"
|
import $ from "../platform/$"
|
||||||
@ -390,9 +393,20 @@ export const dragend = function () {
|
|||||||
return $.set(`${this.id}.position`, this.style.cssText)
|
return $.set(`${this.id}.position`, this.style.cssText)
|
||||||
}
|
}
|
||||||
|
|
||||||
const hoverstart = function ({ root, el, latestEvent, endEvents, height, width, cb, noRemove }) {
|
const hoverstart = function ({ root, el, latestEvent, endEvents, height, width, cb, noRemove }: {
|
||||||
|
root: HTMLElement,
|
||||||
|
el: HTMLElement,
|
||||||
|
latestEvent: Event,
|
||||||
|
endEvents: string[],
|
||||||
|
height: number,
|
||||||
|
width: number,
|
||||||
|
cb: Callbacks,
|
||||||
|
noRemove: boolean
|
||||||
|
}) {
|
||||||
const rect = root.getBoundingClientRect()
|
const rect = root.getBoundingClientRect()
|
||||||
const o = {
|
const o = {
|
||||||
|
hover,
|
||||||
|
hoverend,
|
||||||
root,
|
root,
|
||||||
el,
|
el,
|
||||||
style: el.style,
|
style: el.style,
|
||||||
@ -403,6 +417,7 @@ const hoverstart = function ({ root, el, latestEvent, endEvents, height, width,
|
|||||||
clientHeight: doc.clientHeight,
|
clientHeight: doc.clientHeight,
|
||||||
clientWidth: doc.clientWidth,
|
clientWidth: doc.clientWidth,
|
||||||
height,
|
height,
|
||||||
|
workaround: function (e) { if (!root.contains(e.target)) { return o.hoverend(e) } },
|
||||||
width,
|
width,
|
||||||
noRemove,
|
noRemove,
|
||||||
clientX: (rect.left + rect.right) / 2,
|
clientX: (rect.left + rect.right) / 2,
|
||||||
@ -423,7 +438,6 @@ const hoverstart = function ({ root, el, latestEvent, endEvents, height, width,
|
|||||||
$.on(root, 'mousemove', o.hover)
|
$.on(root, 'mousemove', o.hover)
|
||||||
|
|
||||||
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=674955
|
// Workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=674955
|
||||||
o.workaround = function (e) { if (!root.contains(e.target)) { return o.hoverend(e) } }
|
|
||||||
return $.on(doc, 'mousemove', o.workaround)
|
return $.on(doc, 'mousemove', o.workaround)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,9 +480,10 @@ export const hoverend = function (e) {
|
|||||||
|
|
||||||
export const checkbox = function (name, text, checked) {
|
export const checkbox = function (name, text, checked) {
|
||||||
if (checked == null) { checked = Conf[name] }
|
if (checked == null) { checked = Conf[name] }
|
||||||
const label = $.el('label')
|
const label = $.el('label', { className: 'checkbox' })
|
||||||
const input = $.el('input', { type: 'checkbox', name, checked })
|
const input = $.el('input', { type: 'checkbox', name, checked })
|
||||||
$.add(label, [input, $.tn(` ${text}`)])
|
$.add(label, [input, $.tn(` ${text}`)])
|
||||||
|
|
||||||
return label
|
return label
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
import Callbacks from "../classes/Callbacks"
|
import Callbacks from "../classes/Callbacks"
|
||||||
|
import Post from "../classes/Post"
|
||||||
import UI from "../General/UI"
|
import UI from "../General/UI"
|
||||||
import { Conf, g } from "../globals/globals"
|
import { Conf, g } from "../globals/globals"
|
||||||
import $ from "../platform/$"
|
import $ from "../platform/$"
|
||||||
|
|
||||||
/*
|
|
||||||
* decaffeinate suggestions:
|
|
||||||
* DS102: Remove unnecessary code created because of implicit returns
|
|
||||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/main/docs/suggestions.md
|
|
||||||
*/
|
|
||||||
const Menu = {
|
const Menu = {
|
||||||
init() {
|
init() {
|
||||||
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Menu']) { return }
|
if (!['index', 'thread'].includes(g.VIEW) || !Conf['Menu']) { return }
|
||||||
@ -49,7 +46,7 @@ const Menu = {
|
|||||||
|
|
||||||
makeButton(post, button) {
|
makeButton(post, button) {
|
||||||
if (!button) { button = Menu.button.cloneNode(true) }
|
if (!button) { button = Menu.button.cloneNode(true) }
|
||||||
$.on(button, 'click', function (e) {
|
$.on(button, 'click', function (e: MouseEvent) {
|
||||||
return Menu.menu.toggle(e, this, post)
|
return Menu.menu.toggle(e, this, post)
|
||||||
})
|
})
|
||||||
return button
|
return button
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import Callbacks from "../classes/Callbacks"
|
import Callbacks from "../classes/Callbacks"
|
||||||
import DataBoard from "../classes/DataBoard"
|
import DataBoard from "../classes/DataBoard"
|
||||||
|
import Post from "../classes/Post"
|
||||||
import RandomAccessList from "../classes/RandomAccessList"
|
import RandomAccessList from "../classes/RandomAccessList"
|
||||||
import Get from "../General/Get"
|
import Get from "../General/Get"
|
||||||
import Header from "../General/Header"
|
import Header from "../General/Header"
|
||||||
@ -10,12 +11,7 @@ import QuoteYou from "../Quotelinks/QuoteYou"
|
|||||||
import Favicon from "./Favicon"
|
import Favicon from "./Favicon"
|
||||||
import ThreadWatcher from "./ThreadWatcher"
|
import ThreadWatcher from "./ThreadWatcher"
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 Unread = {
|
const Unread = {
|
||||||
init() {
|
init() {
|
||||||
if ((g.VIEW !== 'thread') || (
|
if ((g.VIEW !== 'thread') || (
|
||||||
@ -52,6 +48,17 @@ const Unread = {
|
|||||||
cb: this.addPost
|
cb: this.addPost
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
lastReadPost: null,
|
||||||
|
title: '',
|
||||||
|
readCount: 0,
|
||||||
|
posts: null,
|
||||||
|
thread: null,
|
||||||
|
postsQuotingYou: null,
|
||||||
|
hr: null,
|
||||||
|
order: null,
|
||||||
|
position: null,
|
||||||
|
db: null,
|
||||||
|
linePosition: null,
|
||||||
|
|
||||||
node() {
|
node() {
|
||||||
Unread.thread = this
|
Unread.thread = this
|
||||||
|
|||||||
@ -28,7 +28,7 @@ export default class DataBoard {
|
|||||||
this.changes = []
|
this.changes = []
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(key: string, sync: boolean, dontClean: boolean) {
|
constructor(key: string, sync: boolean, dontClean?: boolean) {
|
||||||
this.onSync = this.onSync.bind(this)
|
this.onSync = this.onSync.bind(this)
|
||||||
this.key = key
|
this.key = key
|
||||||
this.initData(Conf[this.key])
|
this.initData(Conf[this.key])
|
||||||
|
|||||||
@ -7,7 +7,7 @@ export default class RandomAccessList {
|
|||||||
length: number
|
length: number
|
||||||
last: any
|
last: any
|
||||||
first: any
|
first: any
|
||||||
constructor(items) {
|
constructor(items?) {
|
||||||
this.length = 0
|
this.length = 0
|
||||||
if (items) { for (const item of items) { this.push(item) } }
|
if (items) { for (const item of items) { this.push(item) } }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,7 @@ export interface BoardConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Board {
|
export interface Board {
|
||||||
|
length?: number,
|
||||||
cooldowns(): object
|
cooldowns(): object
|
||||||
forced_anon: 1 | 0,
|
forced_anon: 1 | 0,
|
||||||
ID: string,
|
ID: string,
|
||||||
|
|||||||
@ -700,7 +700,12 @@ if (platform === 'crx') {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
$.sync = (key: string, cb) => $.syncing[key] = cb
|
$.sync = (key: string, cb) => $.syncing[key] = cb
|
||||||
$.forceSync = function () {/* emptey */ }
|
$.forceSync = function (key: string) {
|
||||||
|
chrome.storage.local.get(key, function (data) {
|
||||||
|
const cb = $.syncing[key]
|
||||||
|
if (cb) { cb(data[key], key) }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
$.crxWorking = function () {
|
$.crxWorking = function () {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@ -20,6 +20,7 @@ const SWTinyboard = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
name: 'Tinyboard',
|
name: 'Tinyboard',
|
||||||
|
software: 'Tinyboard',
|
||||||
isOPContainerThread: true,
|
isOPContainerThread: true,
|
||||||
mayLackJSON: true,
|
mayLackJSON: true,
|
||||||
threadModTimeIgnoresSage: true,
|
threadModTimeIgnoresSage: true,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user