2014-09-19 09:58:54 +00:00
2014-01-18 13:35:29 +00:00
{if $userquery->login_check('',true) || $Cbucket->configs.anonym_comments == 'yes'}
2014-09-19 09:58:54 +00:00
< div class = "add_comment_box" id = "add_comment" > < / div >
2014-02-04 13:16:11 +00:00
< div class = "" >
2014-05-08 14:12:46 +00:00
< div id = "comment-add-err" > < / div >
2015-02-25 18:21:01 +00:00
< script type = "text/javascript" >
//Edit the counter/limiter value as your wish
var count = "125";
//Example: var count = "175";
function limiter(){
var tex = document.myform.comment.value;
var len = tex.length;
if(len > count){
tex = tex.substring(0,count);
document.myform.comment.value =tex;
return false;
}
document.myform.limit.value = count-len;
}
< / script >
< form class = "" id = "comment_form" name = "myform" >
2014-01-18 13:35:29 +00:00
< input type = "hidden" name = "reply_to" id = "reply_to" value = "0" >
< input type = "hidden" name = "obj_id" id = "obj_id" value = "{$id}" >
{if !$userquery->login_check('',true) & & $Cbucket->configs.anonym_comments == 'yes'}
2014-02-13 11:29:11 +00:00
< div class = "form-group" >
2014-01-18 13:35:29 +00:00
< label for = "comment_name" >
{lang code='name'}
< / label >
2015-02-25 18:21:01 +00:00
< input type = "text" name = "comment" id = "comment_name" class = "form-control" >
2014-01-18 13:35:29 +00:00
< / div >
2014-02-13 11:29:11 +00:00
< div class = "form-group" >
2014-01-18 13:35:29 +00:00
< label for = "comment_email" >
{lang code='email_wont_display'}
< / label >
< input type = "email" name = "email" id = "comment_email" class = "form-control" >
< / div >
{else}
2014-12-09 08:10:25 +00:00
< strong class = "comment-as" > {sprintf(lang('Comment as %s'),$userquery->username)}< / strong >
2014-01-18 13:35:29 +00:00
{/if}
{ANCHOR place='before_compose_box'}
{if config('comments_captcha')=='all' || ( config('comments_captcha')=='guests' & & !$userquery->login_check('',true) )}
2014-02-13 11:29:11 +00:00
< div class = "form-group" >
2014-01-18 13:35:29 +00:00
{assign var=captcha value=get_captcha()}
{if $captcha}
{if $captcha.show_field}
< label class = "label" for = "captcha" > Verification Code< / label >
{load_captcha captcha=$captcha load=field field_params = ' id="captcha" class="input" '}
{/if}
{load_captcha captcha=$captcha load=function}
{/if}
< / div >
{/if}
2014-02-04 13:16:11 +00:00
< div class = "form-group" >
2014-01-18 13:35:29 +00:00
{if !$userquery->login_check('',true) & & $Cbucket->configs.anonym_comments == 'yes'}
< label for = "comment_text" >
{lang code='Your comment'}
< / label >
2014-09-19 09:58:54 +00:00
{/if}
2015-02-25 18:21:01 +00:00
< script type = "text/javascript" >
document.write("< input style = 'float:right;margin-top:-31px' type = text name = limit size = 4 readonly value = "+count+" > ");
< / script >
< div class = "clear" > < / div >
2015-05-20 10:42:27 +00:00
< textarea onkeyup = "limiter()" name = "comment" placeholder = "Type your comment here. Make sure it means something.." id = "comment_text" class = "form-control clearfix comment_text_new" > < / textarea >
2015-02-25 18:21:01 +00:00
2014-09-19 09:58:54 +00:00
< div id = "reply_to_img" > < i class = "glyphicon glyphicon-share-alt" style = "color:#428BCA;" > < / i > < / div >
2014-02-04 13:16:11 +00:00
< / div >
< div class = "form-group clearfix" >
2014-05-08 14:12:46 +00:00
< button data-loading-text = "Loading..." type = "button" class = "hidden-xs hidden-sm btn btn-primary pull-right" id = "addCommentButton" > {lang('Comment')}< / button >
2014-01-18 13:35:29 +00:00
< / div >
2014-05-08 14:12:46 +00:00
2014-02-05 12:26:01 +00:00
< script >
2014-09-19 09:58:54 +00:00
function blink(selector){
$(selector).fadeOut('slow', function(){
$(this).fadeIn('slow', function(){
blink(this);
});
});
}
2014-12-02 08:46:47 +00:00
2014-05-08 14:12:46 +00:00
var ajaxPage = baseurl+'/ajax.php';
2014-12-03 06:55:46 +00:00
$('#addCommentButton').on('click',function(e){
2014-05-08 14:12:46 +00:00
e.preventDefault();
var btn =$(this);
2014-12-02 07:55:04 +00:00
btn.button('loading');
2014-05-08 14:12:46 +00:00
$('#comment-add-err').hide();
var data = $(this).parents("form").serialize() + "&type={$type}&mode=add_comment";
$.ajax({
url: ajaxPage,
type: "post",
data: data,
dataType : 'json',
}).success(function(response){
2014-12-03 06:55:46 +00:00
2014-05-08 14:12:46 +00:00
//var response = $.parseJSON(response);
2014-12-03 06:55:46 +00:00
2014-05-08 14:12:46 +00:00
var cid = parseInt(response.cid);
if(cid > 1){
2014-02-05 12:26:01 +00:00
$.ajax({
url: ajaxPage,
type: "post",
2014-05-08 14:12:46 +00:00
data: {
mode: "get_comment",
2014-12-02 07:55:04 +00:00
cid: cid,
2014-05-08 14:12:46 +00:00
},
}).success(function(comment){
$("#comment_text").val('');
$("#userCommentsList").prepend(comment);
2014-12-02 07:55:04 +00:00
var count_comments = $("#comment_counter").val();
$("#com_count").html("");
2014-12-02 08:46:47 +00:00
$("#com_count").append(count_comments);
2014-12-02 07:55:04 +00:00
2014-02-05 12:26:01 +00:00
});
2014-05-08 14:12:46 +00:00
}else{
if(response.msg){
$('#comment-add-err').show().html(response.msg);
}
else if(response.err)
{
$('#comment-add-err').show().html(response.err);
}
2014-02-05 12:26:01 +00:00
}
2014-05-08 14:12:46 +00:00
btn.button('reset');
2014-02-05 12:26:01 +00:00
});
2014-05-08 14:12:46 +00:00
2014-02-05 12:26:01 +00:00
});
< / script >
2014-09-23 13:47:24 +00:00
< div class = "hidden-lg hidden-md mbxl" >
2014-02-04 13:16:11 +00:00
< button type = "submit" class = "btn btn-primary" onclick = "add_comment_js('comment_form','{$type}'){ANCHOR place='onClickAddComment'}" > {lang('Comment')}< / button >
2014-01-18 13:35:29 +00:00
< / div >
< / form >
2014-09-19 09:58:54 +00:00
2014-01-18 13:35:29 +00:00
< div id = "add_comment_result" class = "add_comment_result mtm mbm" style = "display:none" > < / div >
{else}
{lang code='please_login_to_comment'}
{/if}
< / div >
2014-09-19 09:58:54 +00:00
< style >
#reply_to_img{
position:absolute;
margin-left:686px;
margin-top:-65px;
display:none;
}
< / style >
2015-02-25 18:21:01 +00:00
<!-- Script by hscripts.com -->