summaryrefslogtreecommitdiffstats
path: root/browser/extensions/webcompat/injections/js/bug1855071-www.meteoam.it.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/extensions/webcompat/injections/js/bug1855071-www.meteoam.it.js')
-rw-r--r--browser/extensions/webcompat/injections/js/bug1855071-www.meteoam.it.js46
1 files changed, 46 insertions, 0 deletions
diff --git a/browser/extensions/webcompat/injections/js/bug1855071-www.meteoam.it.js b/browser/extensions/webcompat/injections/js/bug1855071-www.meteoam.it.js
new file mode 100644
index 0000000000..2bf38345dc
--- /dev/null
+++ b/browser/extensions/webcompat/injections/js/bug1855071-www.meteoam.it.js
@@ -0,0 +1,46 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+/**
+ * www.meteoam.it - virtual keyboard is hidden as it is opened
+ * webcompat issue #121197 - https://webcompat.com/issues/121197
+ *
+ * the site's map is 75vh tall, and it hides the keyboard onresize,
+ * meaning the keyboard is closed as it it brought up in Firefox.
+ */
+
+console.info(
+ "Map iframe height is being managed for compatibility reasons. see https://webcompat.com/issues/77221 for details."
+);
+
+const selector = "#iframe_map";
+
+const moOptions = {
+ childList: true,
+ subtree: true,
+};
+
+const mo = new MutationObserver(() => {
+ const map = document.querySelector(selector);
+ let lastSize;
+ if (map) {
+ mo.disconnect();
+ const maybeGrowMap = () => {
+ const winHeight = window.outerHeight;
+ if (lastSize && lastSize > winHeight) {
+ return;
+ }
+ map.style.height = winHeight * 0.75 + "px";
+ lastSize = winHeight;
+ };
+ maybeGrowMap();
+ window.addEventListener("resize", () =>
+ window.requestAnimationFrame(maybeGrowMap)
+ );
+ }
+});
+
+mo.observe(document.documentElement, moOptions);