Permalink
Browse files

added loader

  • Loading branch information...
1 parent 19e713b commit d03eefd4cb3d889365e59ae274394ecef60a45da @NoahY committed Aug 13, 2011
Showing with 8 additions and 1 deletion.
  1. BIN ajax-loader.gif
  2. +8 −1 qa-comment-layer.php
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -53,6 +53,10 @@ function toggleComment(idx) {
function ajaxPost(idx,id) {
var content = escape(jQuery('textarea#comment').eq(idx).val());
+ var oldcss = jQuery('textarea#comment').eq(idx).css('background');
+ jQuery('textarea#comment').eq(idx).css('background','url(".."ajax-loader.gif) no-repeat scroll center center white');
+ jQuery('textarea#comment').eq(idx).val('');
+
var dataString = 'ajax_comment_content='+content+(id!==false?'&ajax_comment_id='+id:'')+'&notify=true&email=yuttadhammo@gmail.com';
jQuery.ajax({
@@ -63,16 +67,19 @@ function ajaxPost(idx,id) {
if(/^###/.exec(data)) {
var error = data.substring(4);
window.alert(error);
+ jQuery('textarea#comment').eq(idx).val(content);
}
else if(!idx) {
if(jQuery('.qa-q-view-c-list').length == 0) jQuery('<div class=\"qa-q-view-c-list\">'+data+'</div>').insertBefore('.qa-q-view-main .ajax-comment').find('div.qa-c-list-item:last').fadeIn('slow');
else jQuery('.qa-q-view-c-list').append(data).find('div.qa-c-list-item:last').fadeIn('slow');
+ toggleComment(false);
}
else {
if(jQuery('.qa-a-item-c-list').eq(idx-1).length == 0) jQuery('<div class=\"qa-q-view-c-list\">'+data+'</div>').insertBefore('.ajax-comment:eq('+idx+')').find('div.qa-c-list-item:last').fadeIn('slow');
else jQuery('.qa-a-item-c-list').eq(idx-1).append(data).find('div.qa-c-list-item:last').fadeIn('slow');
+ toggleComment(false);
}
- toggleComment(false);
+ jQuery('textarea#comment').eq(idx).css('background',oldcss);
}
});
}

0 comments on commit d03eefd

Please sign in to comment.