// EuroArt CMS - Generated JS //
/**/
// Render a comment
function render_comment(user_name, user_id, time, comment_text, comment_id) {
if (0 == 1) {
var append_to_html = 'Obriši komentar';
} else {
var append_to_html = '';
}
$("#comments").prepend('
');
}
// Delete a comment
function delete_comment(id) {
$.post("/ajax/?request=comments", { delete_comment: id } );
$("#c_"+id).fadeOut("Slow");
}
$(document).ready(function() {
// Request static comments
$.post("/ajax/?request=comments", {
fetch: 35 },
function(data){
for ( var i in data )
{
render_comment(data[i].first_name + ' ' + data[i].last_name, data[i].user_id, data[i].time, data[i].body, data[i].comment_id);
}
}, "json");
// Posting a comment
$('#comment_form').submit(function() { return false; });
if (0 > 0) {
$("#comment_error").hide();
$("#comment_send").bind("click", function(e){
$("#comment_send").fadeOut("Fast");
$.post("/ajax/?request=comments", {
article_id: 35,
comment: $("#comment_body").val() },
function(data){
if (data == 'ip_blocked') {
$("#comment_error").html("Komentar odbijen.
Već smo primili jedan Vaš komentar, pričekajte trenutak prije slanja novog.");
$("#comment_error").fadeIn("Fast");
$("#comment_send").fadeIn("Fast");
} else if(data == 'comment_posted') {
$("#comment_error").hide();
$("#comment_send").fadeIn("Fast");
$("label[for='comment_body']").html("Hvala!");
render_comment('Moj komentar:', '', 'Upravo sada.', $("#comment_body").val(), 'na');
$("#comment_body").val(" ");
} else {
$("#comment_send").fadeIn("Fast");
$("#comment_error").html("Komentar odbijen.
Ne možemo prihvatiti ovaj komentar.");
$("#comment_error").fadeIn("Fast");
}
});
});
} else {
$("#comment_send").hide();
$("#comment_body").hide();
$("#comment_header").hide();
$("#comment_error").show();
$("label[for='comment_body']").hide();
}
});
'+ user_name +'
'+ time +''+ append_to_html +''+ comment_text +'