Skip to content

Commit

Permalink
fix(work codes): run in iframes again
Browse files Browse the repository at this point in the history
  • Loading branch information
ROpdebee committed Jun 20, 2022
1 parent 5f53627 commit fced6f0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/mb_work_code_toolbox/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { GMdeleteValue, GMgetValue, GMinfo, GMsetValue } from '@lib/compat';
import { difference, groupBy, intersect } from '@lib/util/array';
import { logFailure } from '@lib/util/async';
import { onWindowLoaded } from '@lib/util/dom';

import { agencyNameToID, validateCode, VERSION as CODES_VERSION } from './identifiers';
import { validateCodes } from './validate';
Expand Down Expand Up @@ -548,9 +549,13 @@ function handleMB(): void {
// FIXME: We should check the changes in more detail before querying.
const workForms: Array<[HTMLFormElement, boolean]> = [...document.querySelectorAll<HTMLFormElement>(editWorkFormQuery)].map((f) => [f, false]);
document.querySelectorAll('iframe').forEach((iframe) => {
iframe.contentWindow?.document
.querySelectorAll<HTMLFormElement>('editWorkFormQuery')
.forEach((form) => workForms.push([form, true]));
if (!iframe.contentWindow) return;

onWindowLoaded(() => {
iframe.contentWindow.document
.querySelectorAll<HTMLFormElement>(editWorkFormQuery)
.forEach((form) => workForms.push([form, true]));
}, iframe.contentWindow);
});

workForms
Expand Down

0 comments on commit fced6f0

Please sign in to comment.