PluginProbe
HubSpot All-In-One Marketing – Forms, Popups, Live Chat / 11.0.54
HubSpot All-In-One Marketing – Forms, Popups, Live Chat v11.0.54
11.3.75 11.3.73 11.3.71 11.3.70 11.3.69 11.3.64 11.3.65 11.3.62 11.3.61 11.3.56 11.3.58 11.0.31 11.0.52 11.0.54 11.0.56 11.0.58 11.0.7 11.1.10 11.1.11 11.1.13 11.1.14 11.1.15 11.1.2 11.1.20 11.1.21 All 73 releases
leadin / scripts / utils / iframe.ts

iframe.ts in HubSpot All-In-One Marketing – Forms, Popups, Live Chat 11.0.54, at scripts/utils/iframe.ts

37 lines 1011 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useEffect, useState } from 'react';
2
3 const IFRAME_DISPLAY_TIMEOUT = 5000;
4
5 export function useIframeNotRendered(app: string) {
6 const [iframeNotRendered, setIframeNotRendered] = useState(false);
7 useEffect(() => {
8 const timer = setTimeout(() => {
9 const iframe = document.getElementById(app);
10 if (!iframe) {
11 setIframeNotRendered(true);
12 }
13 }, IFRAME_DISPLAY_TIMEOUT);
14
15 return () => {
16 if (timer) {
17 clearTimeout(timer);
18 }
19 };
20 }, []);
21
22 return iframeNotRendered;
23 }
24
25 export const resizeWindow = () => {
26 const adminMenuWrap = document.getElementById('adminmenuwrap');
27 const sideMenuHeight = adminMenuWrap ? adminMenuWrap.offsetHeight : 0;
28 const adminBar = document.getElementById('wpadminbar');
29 const adminBarHeight = (adminBar && adminBar.offsetHeight) || 0;
30 const offset = 4;
31 if (window.innerHeight < sideMenuHeight) {
32 return sideMenuHeight - offset;
33 } else {
34 return window.innerHeight - adminBarHeight - offset;
35 }
36 };
37