| 1 |
jQuery( function(){ |
| 2 |
|
| 3 |
/* Display custom redirect URL section if type of restriction is "Redirect" */ |
| 4 |
jQuery( 'input[type=radio][name=wppb-content-restrict-type]' ).on( "click", function() { |
| 5 |
if( jQuery( this ).is(':checked') && jQuery( this ).val() == 'redirect' ){ |
| 6 |
jQuery( '#wppb-meta-box-fields-wrapper-restriction-redirect-url' ).addClass( 'wppb-content-restriction-enabled' ); |
| 7 |
|
| 8 |
// hide the custom restriction messages section (not needed for Redirect) |
| 9 |
jQuery( '#wppb-meta-box-fields-wrapper-restriction-custom-messages' ).hide(); |
| 10 |
} |
| 11 |
else { |
| 12 |
jQuery( '#wppb-meta-box-fields-wrapper-restriction-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' ); |
| 13 |
|
| 14 |
// this needs to be unchecked so that the Custom URL is properly disabled |
| 15 |
jQuery( '#wppb-content-restrict-custom-redirect-url-enabled' ).prop( 'checked', false ); |
| 16 |
jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' ); |
| 17 |
|
| 18 |
// show the custom restriction messages section |
| 19 |
jQuery( '#wppb-meta-box-fields-wrapper-restriction-custom-messages' ).show(); |
| 20 |
} |
| 21 |
} ); |
| 22 |
|
| 23 |
/* Display custom redirect URL field */ |
| 24 |
jQuery( '#wppb-content-restrict-custom-redirect-url-enabled' ).on( "click", function() { |
| 25 |
if( jQuery( this ).is( ':checked' ) ) |
| 26 |
jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).addClass( 'wppb-content-restriction-enabled' ); |
| 27 |
else |
| 28 |
jQuery( '.wppb-meta-box-field-wrapper-custom-redirect-url' ).removeClass( 'wppb-content-restriction-enabled' ); |
| 29 |
} ); |
| 30 |
|
| 31 |
/* Display custom messages editors */ |
| 32 |
jQuery( '#wppb-content-restrict-messages-enabled' ).on( "click", function() { |
| 33 |
if( jQuery( this ).is( ':checked' ) ) |
| 34 |
jQuery( '.wppb-meta-box-field-wrapper-custom-messages' ).addClass( 'wppb-content-restriction-enabled' ); |
| 35 |
else |
| 36 |
jQuery( '.wppb-meta-box-field-wrapper-custom-messages' ).removeClass( 'wppb-content-restriction-enabled' ); |
| 37 |
} ); |
| 38 |
|
| 39 |
} ); |