PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Agent / agent.js

agent.js in Extendify 2.2.0, at src/Agent/agent.js

43 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import domReady from '@wordpress/dom-ready';
2 import { render } from '@shared/lib/dom';
3 import { isOnLaunch } from '@shared/lib/utils';
4 import { Agent } from '@agent/Agent.jsx';
5 import '@agent/agent.css';
6 import '@agent/buttons';
7 import { GuidedTour } from '@agent/components/GuidedTour';
8 import { ReOpenToolTip } from '@agent/components/tooltip/ReOpenToolTip';
9
10 const isInsideIframe = () => !!document.querySelector('#plugin-information');
11
12 domReady(() => {
13 const bg =
14 // admin area
15 document.getElementById('wpwrap') ||
16 // TODO: is this on all block themes?
17 document.querySelector('.wp-site-blocks');
18 if (isOnLaunch() || isInsideIframe() || !bg) return;
19 const id = 'extendify-agent-main';
20 if (document.getElementById(id)) return;
21 const agent = Object.assign(document.createElement('div'), {
22 className: 'extendify-agent',
23 id,
24 });
25 document.body.appendChild(agent);
26 render(<Agent />, agent);
27 // tours
28 const tourId = 'extendify-agent-tour';
29 if (document.getElementById(tourId)) return;
30 const tour = Object.assign(document.createElement('div'), {
31 className: 'extendify-agent-tour',
32 id: tourId,
33 });
34 render(<GuidedTour />, tour);
35
36 // tooltip
37 const div = Object.assign(document.createElement('div'), {
38 id: 'extendify-agent-modal-tooltip',
39 });
40 document.body.appendChild(div);
41 render(<ReOpenToolTip />, div);
42 });
43