accordion.css
3 months ago
button.css
4 weeks ago
card.css
3 months ago
common.css
3 months ago
common.js
3 months ago
deprecated.css
3 months ago
form.css
3 months ago
header.css
3 months ago
modal-new.css
3 months ago
modal.css
3 months ago
modal.js
3 months ago
screen-options.js
3 months ago
tabs.js
3 months ago
toast.css
3 months ago
toaster.js
3 months ago
toggles.js
3 months ago
screen-options.js
36 lines
| 1 | import { btnCloseLabel } from '@advancedAds/i18n'; |
| 2 | |
| 3 | export function screenOptions() { |
| 4 | const screenMetaLinks = document.querySelector( '#screen-meta-links' ); |
| 5 | |
| 6 | if ( ! screenMetaLinks ) { |
| 7 | return; |
| 8 | } |
| 9 | |
| 10 | const header = document.querySelector( '#advads-header' ); |
| 11 | const innerWrap = header.querySelector( '.inner-wrap' ); |
| 12 | const screenMeta = document.querySelector( '#screen-meta' ); |
| 13 | |
| 14 | // Move elements after header |
| 15 | innerWrap.after( screenMeta ); |
| 16 | innerWrap.after( screenMetaLinks ); |
| 17 | |
| 18 | // Append to #adv-settings .submit inside #advads-header |
| 19 | const submitContainer = header.querySelector( '#adv-settings .submit' ); |
| 20 | |
| 21 | if ( submitContainer ) { |
| 22 | // Create close button |
| 23 | const closeBtn = document.createElement( 'button' ); |
| 24 | closeBtn.type = 'button'; |
| 25 | closeBtn.className = 'advads-button button button-secondary'; |
| 26 | closeBtn.textContent = btnCloseLabel; |
| 27 | |
| 28 | submitContainer.appendChild( closeBtn ); |
| 29 | |
| 30 | // Click handler |
| 31 | closeBtn.addEventListener( 'click', () => { |
| 32 | document.querySelector( '#show-settings-link' ).click(); |
| 33 | } ); |
| 34 | } |
| 35 | } |
| 36 |