(by _username_さん。_date_)
-->
\
';
var img_src = '/api/v0/file/get?width=_size_&height=_size_&image_id=_id_';
img_tag = img_tag.replace(/_src_thubnail_/g, img_src.replace(/_size_/g,150) );
img_tag = img_tag.replace(/_id_/g,image_id);
$('#fileupload_image_loading').before(img_tag);
}
$('#fileupload').fileupload({
dataType: 'json',
start: function (e, data) {
$('#fileupload_form .caution').hide();
$('#fileupload_image_loading').css('display','inline');
},
done: function (e, data) {
$('#fileupload_image_loading').hide();
var res = data.result;
if ('OK'==res.status){
console.log('upload done.');
add_fileupload_thubnail(res.id)
}else{
console.log('upload error.');
var err_msg = $('#fileupload_form .caution');
err_msg.text(res.message);
err_msg.show();
}
},
error: function (e, data) {
$('#fileupload_image_loading').hide();
var err_msg = $('#fileupload_form .caution');
err_msg.text(data.textStatus);
err_msg.show();
}
});
$('#fileupload_thubnails').on('click', '.fileupload_thubnail_remover', function(){
var image_id = $(this).parent().data('image-id');
$('#fileupload_image_'+image_id).remove();
});
$('#comment_form input[name="submit"], #comment_form button[type="submit"]').on('click',function(e){
var comment_area = $('#comment_form textarea[name="comment"]');
var img_tags = '';
$('#fileupload_thubnails .fileupload_thubnail_frame').each(function(){
var img_tag = '';
var img_id = $(this).data('image-id');
if (img_id){
img_tag = img_tag.replace(/_size_/g,150);
img_tag = img_tag.replace(/_id_/g,img_id);
img_tags = img_tags+img_tag;
}
});
if (img_tags.length>0){comment_area.val(comment_area.val()+"\n"+img_tags);}
});
$(function(){
$('#fileupload_form input[name="url"]').val(document.URL);
$('#comment_form input[name="name"]').on('change',function(){
$('#fileupload_form input[name="username"]').val( $(this).val() );
});
});
皆様からの情報