| 1 |
jQuery(function($) { |
| 2 |
|
| 3 |
// Add .dfrapi_hide_label class to .form-table > tr > th labels when specified in add_settings_field(); |
| 4 |
dfrapi_hide_label = $( "label[for='DFRAPI_HIDE_LABEL']" ).closest( "th" ); |
| 5 |
$(dfrapi_hide_label).addClass( "dfrapi_hide_label" ); |
| 6 |
|
| 7 |
// Toggle Amazon API settings |
| 8 |
function dfrapi_toggle_amazon_api_settings() { |
| 9 |
var amazon_api = $( 'input[name="dfrapi_configuration[amazon_api]"]:checked' ).val(); |
| 10 |
if ( amazon_api == 'paapi' ) { |
| 11 |
$( '.paapi_settings' ).show(); |
| 12 |
$( '.capi_settings' ).hide(); |
| 13 |
} else { |
| 14 |
$( '.paapi_settings' ).hide(); |
| 15 |
$( '.capi_settings' ).show(); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
$( 'input[name="dfrapi_configuration[amazon_api]"]' ).on( 'change', function() { |
| 20 |
dfrapi_toggle_amazon_api_settings(); |
| 21 |
} ); |
| 22 |
|
| 23 |
dfrapi_toggle_amazon_api_settings(); |
| 24 |
|
| 25 |
}); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|