mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-19 01:24:05 +01:00
Fix some bugs with new post form
This commit is contained in:
parent
7d8bdb4e53
commit
ca39eb255a
12
js/ajax.js
12
js/ajax.js
@ -23,12 +23,12 @@ $(window).ready(function() {
|
||||
$form.submit(function() {
|
||||
if (do_not_ajax)
|
||||
return true;
|
||||
var form = this;
|
||||
var form = $(this).find('form')[0];
|
||||
var submit_txt = $(this).find('input[type="submit"]').val();
|
||||
if (window.FormData === undefined)
|
||||
return true;
|
||||
|
||||
var formData = new FormData(this);
|
||||
var formData = new FormData(form);
|
||||
formData.append('json_response', '1');
|
||||
formData.append('post', submit_txt);
|
||||
|
||||
@ -46,7 +46,7 @@ $(window).ready(function() {
|
||||
};
|
||||
|
||||
$.ajax({
|
||||
url: this.action,
|
||||
url: '/post.php',
|
||||
type: 'POST',
|
||||
xhr: function() {
|
||||
var xhr = $.ajaxSettings.xhr();
|
||||
@ -137,9 +137,9 @@ $(window).ready(function() {
|
||||
return false;
|
||||
});
|
||||
};
|
||||
setup_form($('form[name="post"]'));
|
||||
setup_form($('div#post-form-outer'));
|
||||
$(window).on('quick-reply', function() {
|
||||
$('form#quick-reply').off('submit');
|
||||
setup_form($('form#quick-reply'));
|
||||
$('div#quick-reply').off('submit');
|
||||
setup_form($('div#quick-reply'));
|
||||
});
|
||||
});
|
||||
|
@ -15,14 +15,14 @@ function multi_image() {
|
||||
$(document).on('click', 'a.add_image', function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var images_len = $('form:not([id="quick-reply"]) [type=file]').length;
|
||||
var images_len = $('div#post-form-outer [type=file]').length;
|
||||
|
||||
if (!(images_len >= max_images)) {
|
||||
var new_file = '<br class="file_separator"/><input type="file" name="file'+(images_len+1)+'" id="upload_file'+(images_len+1)+'">';
|
||||
|
||||
$('[type=file]:last').after(new_file);
|
||||
if ($("#quick-reply").length) {
|
||||
$('form:not(#quick-reply) [type=file]:last').after(new_file);
|
||||
$('#quick-reply [type=file]:last').after(new_file);
|
||||
}
|
||||
if (typeof setup_form !== 'undefined') setup_form($('form[name="post"]'));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user