' ); $('.open-comment').click(function(){ // Add event click on body for close comment box $('body').on('click', function(e) { if($(e.target).closest('#popup-comment').length == 0) { if (_t._is_open) { _t.close_popup_comment(); } else { _t.open_popup_comment(); } } }); }); $('#close-comment').click(function(){ _t.close_popup_comment(); }); if($(window).width() < 768){ $('.open-comment').click(function(){ $('#popup-comment').addClass('boxOpen'); }); $('#close-comment').click(function(){ $('#popup-comment').removeClass('boxOpen'); }); } $('a.open-comment').hover(function() { $('.open-comment i').removeClass('icon-comment') $('.open-comment i').addClass('icon-comment-article-hover') }, function() { $('.open-comment i').removeClass('icon-comment-article-hover') $('.open-comment i').addClass('icon-comment') }); }, open_popup_comment: function() { var _t = this; $('#popup-comment').addClass('boxOpen'); _t._is_open = true; }, close_popup_comment: function() { var _t = this; _t._is_open = false; $('#popup-comment').removeClass('boxOpen'); $( "body").unbind( "click" ); }, show_comment: function() { var _t = this; if (_t.first_access) { _t.get_comment(); _t.get_template_post_comment(); } }, get_comment: function() { var _t = this; if (typeof(_t.get_commnet_ajax_requrest) == 'object') { _t.get_commnet_ajax_requres_t.abort(); } _t.get_commnet_ajax_requrest = $.get("/comment/process", { 'use_id': _t.use_id, act: 'get_comment', order: _t.order, paging: _t.paging }, function(data) { // console.log(data); if (_t.paging == 0) { var isFirst = true; } else { var isFirst = false; } _t.paging = data.paging; var _html = _t.get_template_comment(data); if (isFirst) { $('#comment_container').html(_html); } else { $('#comment_container').append(_html); } if (_t.first_access) { // _t.goToComment(); _t.first_access = false; } _t.get_commnet_ajax_requrest = false; }, 'JSON'); }, show_form_comment_thankyou: function(mode) { var _t = this; mode = (mode == undefined) ? 'comment' : mode; if (mode == 'comment') { var _elm = $('.box-add-comment'); _elm.hide(); _elm.html(_t.get_template_thankyou()); _elm.fadeIn(500); _t.time_interval = setInterval(function(){_t.hide_form_comment_thankyou()},5000); } else if (mode == 'reply') { var _elm = $('.box-reply'); _elm.hide(); _elm.html(_t.get_template_thankyou()); _elm.fadeIn(500); _t.time_interval = setInterval(function(){_t.hide_form_comment_thankyou('reply')},5000); } }, hide_form_comment_thankyou: function(mode) { var _t = this; mode = (mode == undefined) ? 'comment' : mode; if (mode == 'comment') { var _elm = $('.box-add-comment'); _elm.hide(); _t.get_template_post_comment(); _elm.fadeIn(500); } else if (mode == 'reply') { var _elm = $('.box-reply'); _elm.slideUp(function() { // Animation complete. _elm.remove(); }); } clearInterval(_t.time_interval); }, get_template_thankyou: function() { var _html = '