Created
April 2, 2013 05:20
-
-
Save benmay/5290110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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