<script type="text/javascript">
function select_position(fieldset, type) {
    fieldset.find('input[value=' + type + ']:first').attr('checked', 'checked');
    fieldset.find('li').removeClass('mark').filter('.type').addClass('mark');
}

/*
type: content type identifier (required)
class: quickbutton CSS class
raw_id_picker: URL of raw_id_fields picker which should be automatically opened
after: callback, receives new fieldset as argument
keep: keep entry in content type dropdown (defaults to false)
*/
var CONTENT_TYPE_BUTTONS = [
    {
        type: 'richtextcontent'
    }, {
        type: 'mediafilecontent',
        class: 'imagecontent',
        raw_id_picker: '{% url admin:medialibrary_mediafile_changelist %}?type__exact=image&pop=1',
        after: function(fieldset) { select_position(fieldset, 'default'); }
    }, {
        type: 'gallerycontent'
    }, {
        type: 'mediafilecontent',
        class: 'pdfcontent',
        raw_id_picker: '{% url admin:medialibrary_mediafile_changelist %}?type__exact=pdf&pop=1',
        after: function(fieldset) { select_position(fieldset, 'download'); }
    }, {
        type: 'oembedcontent'
    }, {
        type: 'mediafilecontent',
        class: 'audiocontent',
        raw_id_picker: '{% url admin:medialibrary_mediafile_changelist %}?type__exact=audio&pop=1',
        after: function(fieldset) { select_position(fieldset, 'default'); }
    }
];
</script>

<script type="text/javascript">
/*
type: content type identifier (required)
class: quickbutton CSS class
raw_id_picker: URL of raw_id_fields picker which should be automatically opened
after: callback, receives new fieldset as argument
keep: keep entry in content type dropdown (defaults to false)
*/
var CONTENT_TYPE_BUTTONS = [
    {
        type: 'richtextcontent'
    }, {
        type: 'mediafilecontent',
        class: 'imagecontent',
        raw_id_picker: '{% url admin:medialibrary_mediafile_changelist %}?type__exact=image&pop=1',
    }, {
        type: 'gallerycontent'
    }, {
        type: 'mediafilecontent',
        class: 'pdfcontent',
        raw_id_picker: '{% url admin:medialibrary_mediafile_changelist %}?type__exact=pdf&pop=1',
    }, {
        type: 'oembedcontent'
    }, {
        type: 'mediafilecontent',
        class: 'audiocontent',
        raw_id_picker: '{% url admin:medialibrary_mediafile_changelist %}?type__exact=audio&pop=1',
    }
];
</script>

Remove select_position -- it crept in from our internal code repository
ItemEditor: Remove select_position -- it crept in from our internal code repository
