Manipulating Media uploader

what i ended up doing was launching the thickbox uploaded manually via a jquery click event. then with setInterval i was able to hide the pieces i wanted.

jQuery(document).ready(function($) {

  $('.specialclass').click(function() { 
       //get post id from somewhere (for me this was the row column
    string = $(this).parents('tr.type-portfolio').attr('id'); 
    if(/post-(\d+)/.exec(string)[1]) post_id = parseInt(/post-(\d+)/.exec(string)[1], 10);

    tbframe_interval = setInterval(function() {

       //remove url, alignment and size fields- auto set to null, none and full respectively                        
       $('#TB_iframeContent').contents().find('.url').hide().find('input').val('');
       $('#TB_iframeContent').contents().find('.align').hide().find('input:radio').filter('[value="none"]').attr('checked', true);
       $('#TB_iframeContent').contents().find('.image-size').hide().find('input:radio').filter('[value="full"]').attr('checked', true);

    }, 2000);

    if(post_id) tb_show('', 'media-upload.php?post_id='+post_id+'&type=image&tab=library&TB_iframe=true'); //tab sets the opened TB window to show library by default

    return false;
   });
});

Leave a Comment