comicpress-core/js/MediaUpload.js

24 lines
879 B
JavaScript
Raw Normal View History

2009-11-03 03:32:31 +00:00
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});
2009-11-02 03:32:35 +00:00
});
2009-11-03 03:32:31 +00:00
2009-11-02 03:32:35 +00:00
var show_insert = function(t) {
2009-11-03 03:32:31 +00:00
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); });
});
2009-11-02 03:32:35 +00:00
2009-11-03 03:32:31 +00:00
var type = item.select('input[name*=comic_image_type][checked]').pop();
2009-11-02 03:32:35 +00:00
if (type) {
2009-11-03 03:32:31 +00:00
item.select('.filename.new').pop().insert({bottom: new Element('strong').update(type.parentNode.innerHTML.stripTags())});
2009-11-02 03:32:35 +00:00
show_insert(type);
}
});
2009-11-03 03:32:31 +00:00
});