mirror of
https://github.com/LalleSX/4chan-XZ.git
synced 2025-10-07 07:22:37 +02:00
33 lines
730 B
TypeScript
33 lines
730 B
TypeScript
import Callbacks from "../classes/Callbacks";
|
|
import { g, Conf } from "../globals/globals";
|
|
|
|
const ThreadLinks = {
|
|
init(): void {
|
|
if ((g.VIEW !== 'index') || !Conf['Open Threads in New Tab']) { return; }
|
|
|
|
Callbacks.Post.push({
|
|
name: 'Thread Links',
|
|
cb: this.node.bind(this)
|
|
});
|
|
Callbacks.CatalogThread.push({
|
|
name: 'Thread Links',
|
|
cb: this.catalogNode.bind(this)
|
|
});
|
|
},
|
|
|
|
node(): void {
|
|
if (this.isReply || this.isClone) { return; }
|
|
ThreadLinks.process(this.nodes.reply);
|
|
},
|
|
|
|
catalogNode(): void {
|
|
ThreadLinks.process(this.nodes.thumb.parentNode);
|
|
},
|
|
|
|
process(link: HTMLAnchorElement): void {
|
|
link.target = '_blank';
|
|
}
|
|
};
|
|
|
|
export default ThreadLinks;
|