| 1 |
/* global jQuery */ |
| 2 |
|
| 3 |
( function ( $ ) { |
| 4 |
'use strict'; |
| 5 |
|
| 6 |
const $fields = $( |
| 7 |
'#beyondwords-plugin-settings .beyondwords-setting--preselect--post-type' |
| 8 |
); |
| 9 |
|
| 10 |
$fields.each( function () { |
| 11 |
if ( $( this ).find( '> label > input' ).is( ':checked' ) ) { |
| 12 |
$( this ) |
| 13 |
.find( '.beyondwords-setting--preselect--taxonomy' ) |
| 14 |
.hide(); |
| 15 |
} |
| 16 |
} ); |
| 17 |
|
| 18 |
$fields.on( 'change', '> label > input', function () { |
| 19 |
const $postType = $( this ).closest( |
| 20 |
'.beyondwords-setting--preselect--post-type' |
| 21 |
); |
| 22 |
if ( this.checked ) { |
| 23 |
$postType |
| 24 |
.find( '.beyondwords-setting--preselect--taxonomy' ) |
| 25 |
.hide(); |
| 26 |
$postType |
| 27 |
.find( '.beyondwords-setting--preselect--term input' ) |
| 28 |
.prop( 'checked', false ); |
| 29 |
} else { |
| 30 |
$postType |
| 31 |
.find( '.beyondwords-setting--preselect--taxonomy' ) |
| 32 |
.show(); |
| 33 |
} |
| 34 |
} ); |
| 35 |
} )( jQuery ); |
| 36 |
|