switch media uploader to prototype

This commit is contained in:
John Bintz 2009-11-02 22:32:31 -05:00
parent 5d66b8b589
commit e8c2bdabe5
2 changed files with 18 additions and 14 deletions

View File

@ -208,7 +208,7 @@ class ComicPressAddonCore extends ComicPressAddon {
}
if (strpos($pagenow, "media-upload") === 0) {
wp_enqueue_script('cp-media', get_stylesheet_directory_uri() . '/js/MediaUpload.js', array('jquery'));
wp_enqueue_script('cp-media', get_stylesheet_directory_uri() . '/js/MediaUpload.js', array('prototype'));
}
}

View File

@ -1,18 +1,22 @@
jQuery(function() {
jQuery('.media-item').each(function() {
var item = this;
jQuery('.savesend', item).each(function() {
jQuery(this).prepend(jQuery('<input type="submit" name="save" value="Save changes" />').addClass('button'));
Event.observe(window, 'load', function() {
$$('.media-item').each(function(item) {
item.select('.savesend').each(function(savesend) {
var button = new Element('input', { type: 'submit', name: 'save', value: 'Save changes' }).addClassName('button');
savesend.insert({top: button});
});
var show_insert = function(t) {
jQuery('input[name*=send]', item)[(t.value == 'none') ? 'show' : 'hide']();
};
var b = item.select('input[name*=send]').pop();
if (b) { b[(t.value == 'none') ? 'show' : 'hide'](); }
}
jQuery('input[name*=comic_image_type]', item).bind('click', function() { show_insert(this); });
var type = jQuery('input[name*=comic_image_type][checked]', item).get(0);
item.select('input[name*=comic_image_type]').each(function(radio) {
radio.observe('click', function(e) { show_insert(radio); });
});
var type = item.select('input[name*=comic_image_type][checked]').pop();
if (type) {
jQuery('.filename.new', item).append(jQuery('<strong />').text(' (' + jQuery.trim(jQuery(type).parent().text()) + ')'));
item.select('.filename.new').pop().insert({bottom: new Element('strong').update(type.parentNode.innerHTML.stripTags())});
show_insert(type);
}
});