class.js seems to load now, idk if i've introduced any bugs though

This commit is contained in:
towards-a-new-leftypol 2024-02-27 18:28:51 +00:00
parent 342b0cd804
commit 12b06cdcdf
1 changed files with 392 additions and 376 deletions

View File

@ -3,6 +3,14 @@
* @author jonsmy * @author jonsmy
*/ */
function cont(value_to_test, fn) {
if (value_to_test != null) {
return fn(value_to_test);
} else {
return null;
}
}
globalThis.LCNSite = class LCNSite { globalThis.LCNSite = class LCNSite {
static "createAbortable" () { static "createAbortable" () {
@ -105,7 +113,7 @@ globalThis.LCNSite = class LCNSite {
} }
LCNSite.INSTANCE = null; globalThis.LCNSite.INSTANCE = null;
globalThis.LCNPostInfo = class LCNPostInfo { globalThis.LCNPostInfo = class LCNPostInfo {
@ -128,383 +136,391 @@ globalThis.LCNPostInfo = class LCNPostInfo {
} }
// static "assign" (post) { return post[this.nodeAttrib] ?? (post[this.nodeAttrib] = this.from(post)); } static "assign" (post) {
// static "from" (post) { if (post[this.nodeAttrib] == null) {
// assert.ok(post.classList.contains("post"), "Arty must be expected Element.") return post[this.nodeAttrib] = this.from(post);
// const inst = new this() } else {
// const intro = post.querySelector(".intro") return post[this.nodeAttrib];
// const link = intro.querySelector(".post_no:not([id])").href.split("/").reverse() }
// inst.#postId = link[0].slice(link[0].indexOf("#q") + 2) }
// inst.#threadId = link[0].slice(0, link[0].indexOf("."))
// inst.#boardId = link[2] static "from" (post) {
// inst.#isThread = post.classList.contains("op") assert.ok(post.classList.contains("post"), "Arty must be expected Element.");
// inst.#isReply = !inst.#isThread const inst = new this();
// const intro = post.querySelector(".intro");
// inst.#subject = intro.querySelector(".subject")?.innerText ?? null const link = intro.querySelector(".post_no:not([id])").href.split("/").reverse();
// inst.#name = intro.querySelector(".name")?.innerText ?? null inst._postId = link[0].slice(link[0].indexOf("#q") + 2);
// inst.#email = intro.querySelector(".email")?.href.slice(7) ?? null inst._threadId = link[0].slice(0, link[0].indexOf("."));
// inst.#flag = intro.querySelector(".flag")?.src.split("/").reverse()[0].slice(0, -4) ?? null inst._boardId = link[2];
// inst._isThread = post.classList.contains("op");
// inst.#capcode = intro.querySelector(".capcode")?.innerText ?? null inst._isReply = !inst._isThread;
// inst.#ip = intro.querySelector(".ip-link")?.innerText ?? null
// inst.#createdAt = new Date(intro.querySelector("time[datetime]").dateTime ?? NaN) inst._subject = cont(intro.querySelector(".subject"), x => x.innerText);
// inst._name = cont(intro.querySelector(".name"), x => x.innerText);
// inst.#isSticky = !!intro.querySelector("i.fa-thumb-tack") inst._email = cont(intro.querySelector(".email"), x => x.href.slice(7));
// inst.#isLocked = !!intro.querySelector("i.fa-lock") inst._flag = cont(intro.querySelector(".flag"), x => x.src.split("/").reverse()[0].slice(0, -4));
//
// return inst inst._capcode = cont(intro.querySelector(".capcode"), x => x.innerText);
// } inst._ip = cont(intro.querySelector(".ip-link"), x => x.innerText);
// inst._createdAt = new Date(intro.querySelector("time[datetime]").dateTime || NaN);
// "getParent" () { return this.#parent; }
// "__setParent" (inst) { return this.#parent = inst; } inst._isSticky = !!intro.querySelector("i.fa-thumb-tack");
// inst._isLocked = !!intro.querySelector("i.fa-lock");
// "getBoardId" () { return this.#boardId; }
// "getThreadId" () { return this.#threadId; } return inst;
// "getPostId" () { return this.#postId; } }
// "getHref" () { return `/${this.boardId}/res/${this.threadId}.html#q${this.postId}`; }
// "getParent" () { return this._parent; }
// "getName" () { return this.#name; } "__setParent" (inst) { return this._parent = inst; }
// "getEmail" () { return this.#email; }
// "getIP" () { return this.#ip; } "getBoardId" () { return this._boardId; }
// "getCapcode" () { return this.#capcode; } "getThreadId" () { return this._threadId; }
// "getSubject" () { return this.#subject; } "getPostId" () { return this._postId; }
// "getCreatedAt" () { return this.#createdAt; } "getHref" () { return `/${this.boardId}/res/${this.threadId}.html#q${this.postId}`; }
//
// "isSticky" () { return this.#isSticky; } "getName" () { return this._name; }
// "isLocked" () { return this.#isLocked; } "getEmail" () { return this._email; }
// "isThread" () { return this.#isThread; } "getIP" () { return this._ip; }
// "isReply" () { return this.#isReply; } "getCapcode" () { return this._capcode; }
// "getSubject" () { return this._subject; }
// "is" (info) { "getCreatedAt" () { return this._createdAt; }
// assert.ok(info, "Must be LCNPost.")
// return this.getBoardId() == info.getBoardId() && this.getPostId() == info.getPostId() "isSticky" () { return this._isSticky; }
// } "isLocked" () { return this._isLocked; }
// "isThread" () { return this._isThread; }
"isReply" () { return this._isReply; }
"is" (info) {
assert.ok(info, "Must be LCNPost.")
return this.getBoardId() == info.getBoardId() && this.getPostId() == info.getPostId()
}
} }
LCNPostInfo.nodeAttrib = "$LCNPostInfo"; LCNPostInfo.nodeAttrib = "$LCNPostInfo";
LCNPostInfo.selector = ".post:not(.grid-li)"; LCNPostInfo.selector = ".post:not(.grid-li)";
// globalThis.LCNPost = class LCNPost { globalThis.LCNPost = class LCNPost {
//
// static nodeAttrib = "$LCNPost"; static "assign" (post) { return post[this.nodeAttrib] || (post[this.nodeAttrib] = this.from(post)); }
// static selector = ".post:not(.grid-li)"; static "from" (post) { return new this(post); }
// #parent = null;
// #post = null; "constructor" (post) {
// #info = null; this._parent = null;
// #ipLink = null; this._post = null;
// #controls = null; this._info = null;
// #customControlsSeperatorNode = null; this._ipLink = null;
// this._controls = null;
// static "assign" (post) { return post[this.nodeAttrib] ?? (post[this.nodeAttrib] = this.from(post)); } this._customControlsSeperatorNode = null;
// static "from" (post) { return new this(post); }
// assert.ok(post.classList.contains("post"), "Arty must be expected Element.");
// "constructor" (post) { const intro = post.querySelector(".intro");
// assert.ok(post.classList.contains("post"), "Arty must be expected Element.") this._post = post;
// const intro = post.querySelector(".intro") this._info = LCNPostInfo.assign(post);
// this.#post = post this._ipLink = intro.querySelector(".ip-link");
// this.#info = LCNPostInfo.assign(post) this._controls = Array.prototype.at.apply(post.querySelectorAll(".controls"), [ -1 ]);
// this.#ipLink = intro.querySelector(".ip-link")
// this.#controls = Array.prototype.at.apply(post.querySelectorAll(".controls"), [ -1 ]) assert.equal(this._info.getParent(), null, "Info should not have parent.");
// this._info.__setParent(this);
// assert.equal(this.#info.getParent(), null, "Info should not have parent.") }
// this.#info.__setParent(this)
// }
// "jQuery" () { return $(this._post); }
// "jQuery" () { return $(this.#post); } "trigger" (event_id, data=null) { $(this._post).trigger(event_id, [ data ]); }
// "trigger" (event_id, data=null) { $(this.#post).trigger(event_id, [ data ]); }
// "getElement" () { return this._post; }
// "getElement" () { return this.#post; } "getInfo" () { return this._info; }
// "getInfo" () { return this.#info; }
// "getIPLink" () { return this._ipLink; }
// "getIPLink" () { return this.#ipLink; } "setIP" (ip) { this._ipLink.innerText = ip; }
// "setIP" (ip) { this.#ipLink.innerText = ip; }
// "getParent" () { return this._parent; }
// "getParent" () { return this.#parent; } "__setParent" (inst) { return this._parent = inst; }
// "__setParent" (inst) { return this.#parent = inst; }
// "addCustomControl" (obj) {
// static #NBSP = String.fromCharCode(160); if (LCNSite.INSTANCE.isModerator()) {
// "addCustomControl" (obj) { const link = document.createElement("a")
// if (LCNSite.INSTANCE.isModerator()) { link.innerText = `[${obj.btn}]`
// const link = document.createElement("a") link.title = obj.tooltip
// link.innerText = `[${obj.btn}]`
// link.title = obj.tooltip if (typeof obj.href == "string") {
// link.href = obj.href
// if (typeof obj.href == "string") { link.referrerPolicy = "no-referrer"
// link.href = obj.href } else if (obj.onClick != undefined) {
// link.referrerPolicy = "no-referrer" link.style.cursor = "pointer"
// } else if (obj.onClick != undefined) { link.addEventListener("click", e => { e.preventDefault(); obj.onClick(this); })
// link.style.cursor = "pointer" }
// link.addEventListener("click", e => { e.preventDefault(); obj.onClick(this); })
// } if (this._customControlsSeperatorNode == null) {
// this._controls.insertBefore(this._customControlsSeperatorNode = new Text(`${this.constructor.NBSP}-${this.constructor.NBSP}`), this._controls.firstElementChild)
// if (this.#customControlsSeperatorNode == null) { } else {
// this.#controls.insertBefore(this.#customControlsSeperatorNode = new Text(`${this.constructor.#NBSP}-${this.constructor.#NBSP}`), this.#controls.firstElementChild) this._controls.insertBefore(new Text(this.constructor.NBSP), this._customControlsSeperatorNode)
// } else { }
// this.#controls.insertBefore(new Text(this.constructor.#NBSP), this.#customControlsSeperatorNode)
// } this._controls.insertBefore(link, this._customControlsSeperatorNode)
// }
// this.#controls.insertBefore(link, this.#customControlsSeperatorNode) }
// }
// } }
//
// } globalThis.LCNPost.nodeAttrib = "$LCNPost";
// globalThis.LCNPost.selector = ".post:not(.grid-li)";
// globalThis.LCNThread = class LCNThread { globalThis.LCNPost. NBSP = String.fromCharCode(160);
//
// static nodeAttrib = "$LCNThread"; globalThis.LCNThread = class LCNThread {
// static selector = ".thread:not(.grid-li)";
// #element = null; static "assign" (thread) { return thread[this.nodeAttrib] || (thread[this.nodeAttrib] = this.from(thread)); }
// #parent = null; static "from" (thread) { return new this(thread); }
// #op = null;
// "constructor" (thread) {
// static "assign" (thread) { return thread[this.nodeAttrib] ?? (thread[this.nodeAttrib] = this.from(thread)); } this._element = null;
// static "from" (thread) { return new this(thread); } this._parent = null;
// this._op = null;
// "constructor" (thread) { assert.ok(thread.classList.contains("thread"), "Arty must be expected Element.")
// assert.ok(thread.classList.contains("thread"), "Arty must be expected Element.") this._element = thread
// this.#element = thread this._op = LCNPost.assign(this._element.querySelector(".post.op"))
// this.#op = LCNPost.assign(this.#element.querySelector(".post.op"))
// assert.equal(this._op.getParent(), null, "Op should not have parent.")
// //assert.equal(this.#op.getParent(), null, "Op should not have parent.") this._op.__setParent(this)
// this.#op.__setParent(this) }
// }
// "getElement" () { return this._element; }
// "getElement" () { return this.#element; } "getContent" () { return this._op; }
// "getContent" () { return this.#op; } "getPosts" () { return Array.prototype.map.apply(this._element.querySelectorAll(".post"), [ el => LCNPost.assign(el) ]); }
// "getPosts" () { return Array.prototype.map.apply(this.#element.querySelectorAll(".post"), [ el => LCNPost.assign(el) ]); } "getReplies" () { return Array.prototype.map.apply(this._element.querySelectorAll(".post:not(.op)"), [ el => LCNPost.assign(el) ]); }
// "getReplies" () { return Array.prototype.map.apply(this.#element.querySelectorAll(".post:not(.op)"), [ el => LCNPost.assign(el) ]); }
// "getParent" () { return this._parent; }
// "getParent" () { return this.#parent; } "__setParent" (inst) { return this._parent = inst; }
// "__setParent" (inst) { return this.#parent = inst; } }
// }
// globalThis.LCNThread.nodeAttrib = "$LCNThread";
// globalThis.LCNThread.selector = ".thread:not(.grid-li)";
// globalThis.LCNPostContainer = class LCNPostContainer {
//
// static nodeAttrib = "$LCNPostContainer"; globalThis.LCNPostContainer = class LCNPostContainer {
// static selector = ".postcontainer";
// #parent = null; static "assign" (container) { return container[this.nodeAttrib] || (container[this.nodeAttrib] = this.from(container)); }
// #element = null; static "from" (container) { return new this(container); }
// #content = null;
// #postId = null; "constructor" (container) {
// #boardId = null; this._parent = null;
// this._element = null;
// static "assign" (container) { return container[this.nodeAttrib] ?? (container[this.nodeAttrib] = this.from(container)); } this._content = null;
// static "from" (container) { return new this(container); } this._postId = null;
// this._boardId = null;
// "constructor" (container) {
// assert.ok(container.classList.contains("postcontainer"), "Arty must be expected Element.") assert.ok(container.classList.contains("postcontainer"), "Arty must be expected Element.")
// const child = container.querySelector(".thread, .post") const child = container.querySelector(".thread, .post")
// this.#element = container this._element = container
// this.#content = child.classList.contains("thread") ? LCNThread.assign(child) : LCNPost.assign(child) this._content = child.classList.contains("thread") ? LCNThread.assign(child) : LCNPost.assign(child)
// this.#boardId = container.dataset.board this._boardId = container.dataset.board
// this.#postId = container.id.slice(2) this._postId = container.id.slice(2)
//
// assert.equal(this.#content.getParent(), null, "Content should not have parent.") assert.equal(this._content.getParent(), null, "Content should not have parent.")
// this.#content.__setParent(this) this._content.__setParent(this)
// } }
//
// "getElement" () { return this.#element; } "getElement" () { return this._element; }
// "getContent" () { return this.#content; } "getContent" () { return this._content; }
// "getBoardId" () { return this.#boardId; } "getBoardId" () { return this._boardId; }
// "getPostId" () { return this.#postId; } "getPostId" () { return this._postId; }
//
// "getParent" () { return this.#parent; } "getParent" () { return this._parent; }
// "__setParent" (inst) { return this.#parent = inst; } "__setParent" (inst) { return this._parent = inst; }
//
// } }
//
// globalThis.LCNPostWrapper = class LCNPostWrapper { globalThis.LCNPostContainer.nodeAttrib = "$LCNPostContainer";
// globalThis.LCNPostContainer.selector = ".postcontainer";
// static nodeAttrib = "$LCNPostWrapper";
// static selector = ".post-wrapper";
// #wrapper = null; globalThis.LCNPostWrapper = class LCNPostWrapper {
// #eitaLink = null;
// #eitaId = null; static "assign" (wrapper) { return wrapper[this.nodeAttrib] || (wrapper[this.nodeAttrib] = this.from(wrapper)); }
// #eitaHref = null static "from" (wrapper) { return new this(wrapper); }
// #content = null;
// "constructor" (wrapper) {
// static "assign" (wrapper) { return wrapper[this.nodeAttrib] ?? (wrapper[this.nodeAttrib] = this.from(wrapper)); } this._wrapper = null;
// static "from" (wrapper) { return new this(wrapper); } this._eitaLink = null;
// this._eitaId = null;
// "constructor" (wrapper) { this._eitaHref = null
// assert.ok(wrapper.classList.contains("post-wrapper"), "Arty must be expected Element.") this._content = null;
// this.#wrapper = wrapper
// this.#eitaLink = wrapper.querySelector(".eita-link") assert.ok(wrapper.classList.contains("post-wrapper"), "Arty must be expected Element.")
// this.#eitaId = this.#eitaLink.id this._wrapper = wrapper
// this.#eitaHref = this.#eitaLink.href this._eitaLink = wrapper.querySelector(".eita-link")
// void Array.prototype.find.apply(wrapper.children, [ this._eitaId = this._eitaLink.id
// el => { this._eitaHref = this._eitaLink.href
// if (el.classList.contains("thread")) {
// return this.#content = LCNThread.assign(el) void Array.prototype.find.apply(wrapper.children, [
// } else if (el.classList.contains("postcontainer")) { el => {
// return this.#content = LCNPostContainer.assign(el) if (el.classList.contains("thread")) {
// } return this._content = LCNThread.assign(el)
// } } else if (el.classList.contains("postcontainer")) {
// ]) return this._content = LCNPostContainer.assign(el)
// }
// assert.ok(this.#content, "Wrapper should contain content.") }
// assert.equal(this.#content.getParent(), null, "Content should not have parent.") ])
// this.#content.__setParent(this)
// } assert.ok(this._content, "Wrapper should contain content.")
// assert.equal(this._content.getParent(), null, "Content should not have parent.")
// "getPost" () { this._content.__setParent(this)
// const post = this.getContent().getContent() }
// assert.ok(post instanceof LCNPost, "Post should be LCNPost.")
// return post "getPost" () {
// } const post = this.getContent().getContent()
// assert.ok(post instanceof LCNPost, "Post should be LCNPost.")
// "getElement" () { return this.#wrapper; } return post
// "getContent" () { return this.#content; } }
// "getEitaId" () { return this.#eitaId; }
// "getEitaHref" () { return this.#eitaHref; } "getElement" () { return this._wrapper; }
// "getEitaLink" () { return this.#eitaLink; } "getContent" () { return this._content; }
// "getEitaId" () { return this._eitaId; }
// } "getEitaHref" () { return this._eitaHref; }
// "getEitaLink" () { return this._eitaLink; }
// globalThis.LCNSetting = class LCNSetting { }
// #id = null;
// #eventId = null; globalThis.LCNPostWrapper.nodeAttrib = "$LCNPostWrapper";
// #label = null; globalThis.LCNPostWrapper.selector = ".post-wrapper";
// #value = null;
// #valueDefault = null;
// globalThis.LCNSetting = class LCNSetting {
// static "build" (id) { return new this(id); } static "build" (id) { return new this(id); }
//
// "constructor" (id) { "constructor" (id) {
// this.#id = id; this._id = null;
// this.#eventId = `lcnsetting::${this.#id}` this._eventId = null;
// } this._label = null;
// this._value = null;
// #getValue () { this._valueDefault = null;
// const v = localStorage.getItem(this.#id)
// if (v != null) { this._id = id;
// return this.__builtinValueImporter(v) this._eventId = `lcnsetting::${this._id}`
// } else { }
// return this.#valueDefault
// } "_getValue" () {
// } const v = localStorage.getItem(this._id)
// if (v != null) {
// "getValue" () { return this.#value ?? (this.#value = this.#getValue()); } return this.__builtinValueImporter(v)
// "setValue" (v) { } else {
// if (this.#value !== v) { return this._valueDefault
// this.#value = v }
// localStorage.setItem(this.#id, this.__builtinValueExporter(this.#value)) }
// setTimeout(() => $(document).trigger(`${this.#eventId}::change`, [ v, this ]), 1)
// } "getValue" () { return this._value || (this._value = this._getValue()); }
// } "setValue" (v) {
// if (this._value !== v) {
// "getLabel" () { return this.#label; } this._value = v
// "setLabel" (label) { this.#label = label; return this; } localStorage.setItem(this._id, this.__builtinValueExporter(this._value))
// setTimeout(() => $(document).trigger(`${this._eventId}::change`, [ v, this ]), 1)
// "getDefaultValue" () { return this.#valueDefault; } }
// "setDefaultValue" (vd) { this.#valueDefault = vd; return this; } }
//
// "onChange" (fn) { $(document).on(`${this.#eventId}::change`, (_,v,i) => fn(v, i)); } "getLabel" () { return this._label; }
// __setIdPrefix (prefix) { this.#id = `${prefix}_${this.#id}`; } "setLabel" (label) { this._label = label; return this; }
// }
// "getDefaultValue" () { return this._valueDefault; }
// globalThis.LCNToggleSetting = class LCNToggleSetting extends LCNSetting { "setDefaultValue" (vd) { this._valueDefault = vd; return this; }
// __builtinValueImporter (v) { return v == "1"; }
// __builtinValueExporter (v) { return v ? "1" : ""; } "onChange" (fn) { $(document).on(`${this._eventId}::change`, (_,v,i) => fn(v, i)); }
// __builtinDOMConstructor () { __setIdPrefix (prefix) { this._id = `${prefix}_${this._id}`; }
// const div = document.createElement("div") }
// const chk = document.createElement("input")
// const txt = document.createElement("label") globalThis.LCNToggleSetting = class LCNToggleSetting extends LCNSetting {
// txt.innerText = this.getLabel() __builtinValueImporter (v) { return v == "1"; }
// chk.type = "checkbox" __builtinValueExporter (v) { return v ? "1" : ""; }
// chk.checked = this.getValue() __builtinDOMConstructor () {
// chk.addEventListener("click", e => { const div = document.createElement("div")
// e.preventDefault(); const chk = document.createElement("input")
// this.setValue(!this.getValue()) const txt = document.createElement("label")
// }) txt.innerText = this.getLabel()
// this.onChange(v => chk.checked = v) chk.type = "checkbox"
// chk.checked = this.getValue()
// div.appendChild(chk) chk.addEventListener("click", e => {
// div.appendChild(txt) e.preventDefault();
// return div this.setValue(!this.getValue())
// } })
// } this.onChange(v => chk.checked = v)
//
// globalThis.LCNSettingsSubcategory = class LCNSettingsSubcategory { div.appendChild(chk)
// div.appendChild(txt)
// #tab_id = null; return div
// #id = null; }
// }
// #fieldset = null;
// #legend = null;
// #label = null; globalThis.LCNSettingsSubcategory = class LCNSettingsSubcategory {
//
// static "for" (tab_id, id) { static "for" (tab_id, id) {
// const domid = `lcnssc_${tab_id}_${id}` const domid = `lcnssc_${tab_id}_${id}`
// const inst = document.getElementById(domid)?.$LCNSettingsSubcategory const inst = cont(document.getElementById(domid), x => x.$LCNSettingsSubcategory)
// if (inst == null) {
// const fieldset = document.createElement("fieldset") if (inst == null) {
// const legend = document.createElement("legend") const fieldset = document.createElement("fieldset")
// fieldset.id = domid const legend = document.createElement("legend")
// fieldset.appendChild(legend) fieldset.id = domid
// fieldset.appendChild(legend)
// // XXX: extend_tab only takes a string so this hacky workaround is used to let us use the regular dom api
// Options.extend_tab(tab_id, `<div id="__${domid}" hidden></div>`) // XXX: extend_tab only takes a string so this hacky workaround is used to let us use the regular dom api
// const div = document.getElementById(`__${domid}`)?.parentElement Options.extend_tab(tab_id, `<div id="__${domid}" hidden></div>`)
// assert.ok(div) const div = cont(document.getElementById(`__${domid}`), x => x.parentElement)
// assert.ok(div)
// div.replaceChildren(fieldset)
// return new this(tab_id, id, fieldset) div.replaceChildren(fieldset)
// } else { return new this(tab_id, id, fieldset)
// return inst } else {
// } return inst
// } }
// }
// "constructor" (tab_id, id, fieldset) {
// this.#tab_id = tab_id "constructor" (tab_id, id, fieldset) {
// this.#id = id this._tab_id = tab_id
// this.#fieldset = fieldset this._id = id
// this.#legend = this.#fieldset.querySelector("legend") this._fieldset = fieldset
// this.#fieldset.$LCNSettingsSubcategory = this this._legend = this._fieldset.querySelector("legend")
// } this._fieldset.$LCNSettingsSubcategory = this
// }
// "getLabel" () { return this.#label; }
// "setLabel" (label) { this.#legend.innerText = this.#label = label; return this; } "getLabel" () { return this._label; }
// "addSetting" (setting) { "setLabel" (label) { this._legend.innerText = this._label = label; return this; }
// assert.ok(setting instanceof LCNSetting) "addSetting" (setting) {
// setting.__setIdPrefix(`lcnsetting_${this.#tab_id}_${this.#id}`) assert.ok(setting instanceof LCNSetting)
// if (setting.__builtinDOMConstructor != null) { setting.__setIdPrefix(`lcnsetting_${this._tab_id}_${this._id}`)
// const div = setting.__builtinDOMConstructor() if (setting.__builtinDOMConstructor != null) {
// div.classList.add("lcn-setting-entry") const div = setting.__builtinDOMConstructor()
// this.#fieldset.appendChild(div) div.classList.add("lcn-setting-entry")
// } this._fieldset.appendChild(div)
// }
// return this
// } return this
// }
// }
// }
// $().ready(() => {
// LCNSite.INSTANCE = new LCNSite(); $().ready(() => {
// LCNSite.INSTANCE = new LCNSite();
// for (const clazz of [ LCNPost, LCNPostInfo, LCNThread, LCNPostContainer, LCNPostWrapper ]) {
// clazz.allNodes = (node=document) => node.querySelectorAll(clazz.selector) for (const clazz of [ LCNPost, LCNPostInfo, LCNThread, LCNPostContainer, LCNPostWrapper ]) {
// clazz.all = (node=document) => Array.prototype.map.apply(clazz.allNodes(node), [ elem => clazz.assign(elem) ]); clazz.allNodes = (node=document) => node.querySelectorAll(clazz.selector)
// clazz.clear = (node=document) => Array.prototype.forEach.apply(clazz.allNodes(node), [ elem => elem[clazz.nodeAttrib] = null ]) clazz.all = (node=document) => Array.prototype.map.apply(clazz.allNodes(node), [ elem => clazz.assign(elem) ]);
// clazz.forEach = (fn, node=document) => clazz.allNodes(node).forEach(elem => fn(clazz.assign(elem))) clazz.clear = (node=document) => Array.prototype.forEach.apply(clazz.allNodes(node), [ elem => elem[clazz.nodeAttrib] = null ])
// clazz.filter = (fn, node=document) => clazz.all(node).filter(fn) clazz.forEach = (fn, node=document) => clazz.allNodes(node).forEach(elem => fn(clazz.assign(elem)))
// clazz.find = fn => clazz.all().find(fn) clazz.filter = (fn, node=document) => clazz.all(node).filter(fn)
// clazz.first = (node=document) => clazz.assign(node.querySelector(clazz.selector)) clazz.find = fn => clazz.all().find(fn)
// clazz.last = (node=document) => clazz.assign(Array.prototype.at.apply(clazz.allNodes(node), [ -1 ])) clazz.first = (node=document) => clazz.assign(node.querySelector(clazz.selector))
// } clazz.last = (node=document) => clazz.assign(Array.prototype.at.apply(clazz.allNodes(node), [ -1 ]))
// }
// // XXX: May be a cleaner way to do this but this should be fine for now.
// for (const clazz of [ LCNPostContainer, LCNPostWrapper, LCNThread, LCNPost ]) { void clazz.all(); } // XXX: May be a cleaner way to do this but this should be fine for now.
// $(document).on("new_post", (e, post) => { for (const clazz of [ LCNPostContainer, LCNPostWrapper, LCNThread, LCNPost ]) { void clazz.all(); }
// if (LCNSite.INSTANCE.isModRecentsPage()) { $(document).on("new_post", (e, post) => {
// void LCNPostWrapper.all() if (LCNSite.INSTANCE.isModRecentsPage()) {
// } else { void LCNPostWrapper.all()
// void LCNPostContainer.all() } else {
// } void LCNPostContainer.all()
// }) }
// })
// $(window).on("focus", () => LCNSite.INSTANCE.clearUnseen())
// $(document.body).on("mousemove", () => LCNSite.INSTANCE.clearUnseen()) $(window).on("focus", () => LCNSite.INSTANCE.clearUnseen())
// }) $(document.body).on("mousemove", () => LCNSite.INSTANCE.clearUnseen())
})