We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a97a1dc commit 7712806Copy full SHA for 7712806
features/bitmap-default/script.js
@@ -1,8 +1,11 @@
1
-export default async function ({ feature, console }) {
2
- ScratchTools.waitForElements(".paint-editor_bitmap-button_OEHDO", (bitmapButton) => {
3
- if (feature.self.enabled) {
+export default async function ({ feature }) {
+ ScratchTools.waitForElements("body", () => {
+ const observer = new MutationObserver(() => {
4
+ const bitmapButton = document.querySelector(".paint-editor_bitmap-button_OEHDO");
5
+ if (bitmapButton && feature.self.enabled) {
6
bitmapButton.click();
7
}
8
});
- }
-
9
+ observer.observe(document.body, { childList: true, subtree: true });
10
+ });
11
+}
0 commit comments