Skip to content

Instantly share code, notes, and snippets.

@benmay
Created April 2, 2013 05:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benmay/5290110 to your computer and use it in GitHub Desktop.
Save benmay/5290110 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function($) {
/* Array of ACF items we're working on */
var acf_items = new Array( 'acf-image', 'acf-pdf', 'acf-rtf', 'acf-audio_upload', 'acf-video_low_res', 'acf-video_high_res' );
/* hide all boxes */
acf_cleanup( 'none' );
/* check if there is a taxonomy set */
var selected_id = $('#mc-formatchecklist input:radio:checked').val();
acf_cleanup( 'in-mc-format-' + selected_id );
$('#mc-format-all input').change( function()
{
acf_cleanup( this.id );
});
function acf_cleanup( this_id )
{
/*
* Taxonomies:
* in-mc-format-3 = fact sheets
* in-mc-format-4 = images
* in-mc-format-5 = audio
* in-mc-format-6 = video
*
*/
$( acf_items ).each(function( k, v ) {
$( '#' + v ).hide();
});
/* Video */
if( this_id == 'in-mc-format-6' )
{
$( '#acf-video_low_res' ).show();
$( '#acf-video_high_res' ).show();
}
/* Audio */
if( this_id == 'in-mc-format-5' )
{
$( '#acf-audio_upload' ).show();
}
/* Images */
if( this_id == 'in-mc-format-4' )
{
$( '#acf-image' ).show();
}
/* Fact Sheets */
if( this_id == 'in-mc-format-3' )
{
$( '#acf-pdf' ).show();
$( '#acf-rtf' ).show();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment