From e517577080d39db97547776dfc2265c974d8ac21 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 24 Nov 2023 06:32:55 +0800 Subject: [PATCH] ui: post judge result to parent window --- packages/hydrooj/src/handler/record.ts | 1 + packages/ui-default/pages/record_detail.page.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/hydrooj/src/handler/record.ts b/packages/hydrooj/src/handler/record.ts index 9eae08f9..880d8351 100644 --- a/packages/hydrooj/src/handler/record.ts +++ b/packages/hydrooj/src/handler/record.ts @@ -364,6 +364,7 @@ class RecordDetailConnectionHandler extends ConnectionHandler { async sendUpdate(rdoc: RecordDoc) { this.send({ + status: rdoc.status, status_html: await this.renderHTML('record_detail_status.html', { rdoc, pdoc: this.pdoc }), summary_html: await this.renderHTML('record_detail_summary.html', { rdoc, pdoc: this.pdoc }), }); diff --git a/packages/ui-default/pages/record_detail.page.ts b/packages/ui-default/pages/record_detail.page.ts index a6972277..b4df9c89 100644 --- a/packages/ui-default/pages/record_detail.page.ts +++ b/packages/ui-default/pages/record_detail.page.ts @@ -18,6 +18,7 @@ const page = new NamedPage('record_detail', async () => { const newSummary = $(msg.summary_html); const oldSummary = $('#summary'); dd.apply(oldSummary[0], dd.diff(oldSummary[0], newSummary[0])); + if (typeof msg.status === 'number' && window.parent) window.parent.postMessage({ status: msg.status }); }; });