diff --git a/app.ts b/app.ts index ffe8cf170..9ea6584a8 100644 --- a/app.ts +++ b/app.ts @@ -49,10 +49,13 @@ async function init() { initPosts(); } } - + initUI(); initAuth(); initProfiles(); + + // Fire off site fully loaded event for userscripts + document.dispatchEvent(new CustomEvent('site_fully_loaded', {bubbles:true})); } init().catch((err) => { diff --git a/ts/client/index.ts b/ts/client/index.ts index 9fa602d07..7f63d0422 100644 --- a/ts/client/index.ts +++ b/ts/client/index.ts @@ -42,6 +42,9 @@ export function insertPost(data: PostData) { if (options.scrollToBottom && atBottom && !isHoverActive()) { scrollToBottom(); } + // Fire event to signal userscripts that a new post was added + document.dispatchEvent(new CustomEvent('new_post_hook', {bubbles:true, + detail: {post: view.el}})); } export function init() {