switch media uploader to prototype
This commit is contained in:
parent
5d66b8b589
commit
e8c2bdabe5
@ -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'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,19 +1,23 @@
|
||||
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) {
|
||||
var b = item.select('input[name*=send]').pop();
|
||||
if (b) { b[(t.value == 'none') ? 'show' : 'hide'](); }
|
||||
}
|
||||
|
||||
item.select('input[name*=comic_image_type]').each(function(radio) {
|
||||
radio.observe('click', function(e) { show_insert(radio); });
|
||||
});
|
||||
|
||||
var show_insert = function(t) {
|
||||
jQuery('input[name*=send]', item)[(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);
|
||||
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);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user