Yablog-0.2.0: templates/edit-article.julius
$(document).ready(function(){
var filecount = 0;
function updatePreview(data, type) {
$("#preview-contents").html(data);
}
function reloadPreview() {
var src = $('#src').val();
var title = $('#title').val()
$("#preview-contents").contents().find("html").load("/preview", $("#edit-form").serializeArray());
}
function appendFileForm() {
filecount += 1;
var newForm = $("<form enctype=\"multipart/form-data\" action=\"@{AttachR (YablogDay day) ident}\" class=uploader><input type=file name=file #file></form>");
newForm.insertAfter(".uploader:last");
newForm.find(':file').change(function() {
$(this).upload("@{AttachR (YablogDay day) ident}",
$(this).parent().serialize(),
function(html){});
});
}
$('#show-preview').click(function(){ reloadPreview(); });
$('#append-file').click(function() { appendFileForm(); });
$(':file').change(function() {
$(this).upload("@{AttachR (YablogDay day) ident}",
$(this).parent().serialize(),
function(html){});
});
});