store
1 year ago
AddonRow.jsx
1 year ago
App.jsx
1 year ago
Metabox.jsx
1 year ago
Modal.jsx
1 year ago
Notices.jsx
1 year ago
Select2.jsx
1 year ago
Settings.jsx
1 year ago
Step1.jsx
1 year ago
Step2.jsx
1 year ago
Step3.jsx
1 year ago
StepWrapper.jsx
1 year ago
main.js
1 year ago
main.js
42 lines
| 1 | /** |
| 2 | * WordPress Dependencies |
| 3 | */ |
| 4 | import domReady from '@wordpress/dom-ready'; |
| 5 | import { createRoot, createElement, render } from '@wordpress/element'; |
| 6 | |
| 7 | /** |
| 8 | * Internal Dependencies |
| 9 | */ |
| 10 | import App from './App'; |
| 11 | |
| 12 | if (!String.format) { |
| 13 | String.format = function (format) { |
| 14 | const args = Array.prototype.slice.call(arguments, 1); |
| 15 | return format.replace(/{(\d+)}/g, function (match, number) { |
| 16 | return typeof args[number] !== 'undefined' ? args[number] : match; |
| 17 | }); |
| 18 | }; |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Init |
| 23 | */ |
| 24 | domReady(() => { |
| 25 | const domNode = document.getElementById('advads-oneclick-app'); |
| 26 | if (!domNode) { |
| 27 | return; |
| 28 | } |
| 29 | // add a div at the end of the element with id=advanced-ads-addon-box |
| 30 | const div = document.createElement('div'); |
| 31 | div.id = 'advads-oneclick-addon-row'; |
| 32 | document.getElementById('advanced-ads-addon-box').appendChild(div); |
| 33 | |
| 34 | const uiElement = createElement(App); |
| 35 | |
| 36 | if (createRoot) { |
| 37 | createRoot(domNode).render(uiElement); |
| 38 | } else { |
| 39 | render(uiElement, domNode); |
| 40 | } |
| 41 | }); |
| 42 |