import { init as initSearch } from "./Ui/Search";
import { PageMenuMainProvider } from "./Ui/Page/Menu/Main/Provider";
import { whenFirstSeen } from "./LazyLoader";
-import { adoptPageOverlayContainer } from "./Helper/PageOverlay";
+import { adoptPageOverlayContainer, getPageOverlayContainer } from "./Helper/PageOverlay";
// perfectScrollbar does not need to be bound anywhere, it just has to be loaded for WCF.js
import "perfect-scrollbar";
whenFirstSeen("[data-google-maps-geocoding]", () => {
void import("./Component/GoogleMaps/Geocoding").then(({ setup }) => setup());
});
+
+ // Move the reCAPTCHA widget overlay to the `pageOverlayContainer`
+ // when widget form elements are placed in a dialog.
+ const observer = new MutationObserver((mutations) => {
+ for (const mutation of mutations) {
+ for (const node of mutation.addedNodes) {
+ if (!(node instanceof HTMLElement)) {
+ continue;
+ }
+
+ if (node.querySelectorAll(".g-recaptcha-bubble-arrow").length === 0) {
+ return;
+ }
+
+ const iframe = node.querySelector("iframe");
+ if (!iframe) {
+ return;
+ }
+ const name = "a-" + iframe.name.split("-")[1];
+ const widget = document.querySelector(`iframe[name="${name}"]`);
+ if (!widget) {
+ return;
+ }
+ const dialog = widget.closest("woltlab-core-dialog");
+ if (!dialog) {
+ return;
+ }
+
+ getPageOverlayContainer().append(node);
+ node.classList.add("g-recaptcha-container");
+ }
+ }
+ });
+ observer.observe(document.body, {
+ childList: true,
+ });
}
(0, LazyLoader_1.whenFirstSeen)("[data-google-maps-geocoding]", () => {
void new Promise((resolve_5, reject_5) => { require(["./Component/GoogleMaps/Geocoding"], resolve_5, reject_5); }).then(tslib_1.__importStar).then(({ setup }) => setup());
});
+ // Move the reCAPTCHA widget overlay to the `pageOverlayContainer`
+ // when widget form elements are placed in a dialog.
+ const observer = new MutationObserver((mutations) => {
+ for (const mutation of mutations) {
+ for (const node of mutation.addedNodes) {
+ if (!(node instanceof HTMLElement)) {
+ continue;
+ }
+ if (node.querySelectorAll(".g-recaptcha-bubble-arrow").length === 0) {
+ return;
+ }
+ const iframe = node.querySelector("iframe");
+ if (!iframe) {
+ return;
+ }
+ const name = "a-" + iframe.name.split("-")[1];
+ const widget = document.querySelector(`iframe[name="${name}"]`);
+ if (!widget) {
+ return;
+ }
+ const dialog = widget.closest("woltlab-core-dialog");
+ if (!dialog) {
+ return;
+ }
+ (0, PageOverlay_1.getPageOverlayContainer)().append(node);
+ node.classList.add("g-recaptcha-container");
+ }
+ }
+ });
+ observer.observe(document.body, {
+ childList: true,
+ });
}
exports.setup = setup;
});
#recaptcha_response_field {
margin-top: 20px;
}
+
+/* ReCAPTCHA container for a dialog element */
+.g-recaptcha-container {
+ position: fixed !important;
+
+ > div:not(:first-child):nth-of-type(-n+3) {
+ display: none !important;
+ }
+
+ > div:last-child {
+ position: fixed !important;
+ top: 0 !important;
+ left: 0 !important;
+ bottom: 0 !important;
+ right: 0 !important;
+ margin: auto !important;
+ }
+}