js/lcn/classes.js: init LCNSite.INSTANCE after dom ready

This commit is contained in:
Jon 2024-02-20 20:26:55 +00:00
parent 6e73f0140d
commit 7f1ef7a019
No known key found for this signature in database
GPG Key ID: 0175F5C9B8E9F984
1 changed files with 3 additions and 1 deletions

View File

@ -4,7 +4,7 @@
*/
globalThis.LCNSite = class LCNSite {
static INSTANCE = new this();
static INSTANCE = null;
#isModerator = document.body.classList.contains("is-moderator");
#isThreadPage = document.body.classList.contains("active-thread");
@ -264,6 +264,8 @@ globalThis.LCNPostContainer.all = () => Array.prototype.map.apply(document.query
globalThis.LCNPostWrapper.all = () => Array.prototype.map.apply(document.querySelectorAll(".post-wrapper"), [ node => LCNPostWrapper.assign(node) ]);
$().ready(() => {
LCNSite.INSTANCE = new LCNSite();
const clazzes = [ LCNPost, LCNThread, LCNPostContainer, LCNPostWrapper ]
for (const clazz of clazzes) {
clazz.forEach = fn => clazz.all().forEach(fn)