Merge pull request #97 from towards-a-new-leftypol/fixes
WIP post ajax behaviour fixes
This commit is contained in:
commit
d227644986
|
@ -79,6 +79,7 @@ $(window).ready(function() {
|
|||
|| (!settings.get('always_noko_replies', true) && !post_response.noko)) {
|
||||
document.location = post_response.redirect;
|
||||
} else {
|
||||
/*
|
||||
$.ajax({
|
||||
url: document.location,
|
||||
success: function(data) {
|
||||
|
@ -105,9 +106,14 @@ $(window).ready(function() {
|
|||
contentType: false,
|
||||
processData: false
|
||||
}, 'html');
|
||||
*/
|
||||
}
|
||||
$(form).find('input[type="submit"]').val(_('Posted...'));
|
||||
$(document).trigger("ajax_after_post", post_response);
|
||||
$(form).find('input[type="submit"]').val(submit_txt);
|
||||
$(form).find('input[type="submit"]').removeAttr('disabled');
|
||||
$(form).find('input[name="subject"],input[name="file_url"],\
|
||||
textarea[name="body"],input[type="file"]').val('').change();
|
||||
} else {
|
||||
alert(_('An unknown error occured when posting!'));
|
||||
$(form).find('input[type="submit"]').val(submit_txt);
|
||||
|
|
|
@ -233,8 +233,11 @@ $(document).ready(function(){
|
|||
url: document.location,
|
||||
success: function(data) {
|
||||
var loaded_posts = 0; // the number of new posts loaded in this update
|
||||
|
||||
$(data).find('div.post.reply').each(function() {
|
||||
var id = $(this).attr('id');
|
||||
|
||||
// check that this post doesn't already exist
|
||||
if($('#' + id).length == 0) {
|
||||
if (!new_posts) {
|
||||
first_new_post = this;
|
||||
|
@ -256,6 +259,7 @@ $(document).ready(function(){
|
|||
recheck_activated();
|
||||
}
|
||||
});
|
||||
|
||||
time_loaded = Date.now(); // interop with watch.js
|
||||
|
||||
|
||||
|
@ -312,8 +316,12 @@ $(document).ready(function(){
|
|||
};
|
||||
|
||||
$(post).on('submit', function(e){
|
||||
poll(manualUpdate = true);
|
||||
dothis(this);
|
||||
setTimeout(
|
||||
function() {
|
||||
poll(manualUpdate = true)
|
||||
},
|
||||
500
|
||||
);
|
||||
});
|
||||
|
||||
$(window).scrollStopped(function() {
|
||||
|
|
Loading…
Reference in New Issue