Thread updator - handle case where you're a mod
- mod triggers refresh - not a mod uses the response
This commit is contained in:
parent
07db8e2db4
commit
ba120d32f7
|
@ -151,19 +151,27 @@ $().ready(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const refresh = () => {
|
||||||
|
secondsCounter = 0;
|
||||||
|
onTickFn();
|
||||||
|
}
|
||||||
|
|
||||||
$(document).on("ajax_after_post", (_, xhr_body) => {
|
$(document).on("ajax_after_post", (_, xhr_body) => {
|
||||||
if (kIsEnabled.getValue() && xhr_body != null) {
|
if (kIsEnabled.getValue() && xhr_body != null) {
|
||||||
|
if (xhr_body['mod'] == true) {
|
||||||
|
refresh();
|
||||||
|
} else {
|
||||||
const thread = LCNThread.first()
|
const thread = LCNThread.first()
|
||||||
const dom = parser.parseFromString(xhr_body.thread, "text/html")
|
const dom = parser.parseFromString(xhr_body.thread, "text/html")
|
||||||
updateThreadFn(thread, dom)
|
updateThreadFn(thread, dom)
|
||||||
updateSecondsByTSLP(thread.getReplies().at(-1).getInfo())
|
updateSecondsByTSLP(thread.getReplies().at(-1).getInfo())
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$(document).on("thread_manual_refresh", () => {
|
$(document).on("thread_manual_refresh", () => {
|
||||||
if (kIsEnabled.getValue() && secondsCounter >= 0) {
|
if (kIsEnabled.getValue() && secondsCounter >= 0) {
|
||||||
secondsCounter = 0
|
refresh();
|
||||||
onTickFn()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue