Torneo: -
Hrs.
Estadio:
Árbitro:
';
}
var $container = $('.cont_comment_rt');
var $container_y = $('.ps__rail-y');
var effectScroll = $container.prop('scrollHeight') - $container.scrollTop() - $container_y.height();
var business = (dataJson.businessCreator)?"enterprise":"";
var embed = "";
if(dataJson.embeds){
embed = dataJson.embeds;
}
var htmlComment = '';
$('#cont_comment_mjs').append(htmlComment);
$("img.lazyload").lazy();
try{
if($('.flo_left .text_comentario.fb_comments_count.comentario_plural').length > 1){
if(isNew && $('.flo_left .text_comentario.fb_comments_count.comentario_plural')[0].innerText){
var intCont = (isNaN(parseInt($('.flo_left .text_comentario.fb_comments_count.comentario_plural')[0].innerText)))?0:parseInt($('.flo_left .text_comentario.fb_comments_count.comentario_plural')[0].innerText);
var Total = intCont+1;
for(var i=0; $('.flo_left .text_comentario.fb_comments_count.comentario_plural').length > i; i++){
$('.flo_left .text_comentario.fb_comments_count.comentario_plural')[i].innerText = Total;
}
$('.num_comentarios').html(Total);
$('#contadorA span.num').html(Total);
$('#n_comentarios_txt').html(Total + " Comentarios");
CommentsApi.updateComments();
// CommentsApi.getTotalComments();
// getCommentsNumbers(configTv.videoActivo.idVideo,"emoltv");
}
}else{
if(isNew && $('.num_comments_realtime .cont_contador_comentarios a .fb_comments_count').html()){
var intCont = (isNaN(parseInt($('.num_comments_realtime .cont_contador_comentarios a .fb_comments_count').html())))?0:parseInt($('.num_comments_realtime .cont_contador_comentarios a .fb_comments_count').html());
var Total = intCont+1;
$('.num_comments_realtime .cont_contador_comentarios a .fb_comments_count').html(Total);
$('.num_comentarios').html(Total);
$('#contadorA span.num').html(Total);
$('#n_comentarios_txt').html(Total + " Comentarios");
CommentsApi.updateComments();
// CommentsApi.getTotalComments();
// getCommentsNumbers(configTv.videoActivo.idVideo,"emoltv");
}
}
}catch(error){
console.log("update numbers");
}
if (effectScroll == 0) {
$('.new_commets').fadeOut('slow');
if (isNew || isNew == null) {
ScrollBottomRT('cont_comment_rt');
}
} else {
if (isNew || isNew == null) {
$('.new_commets').fadeIn('slow');
$("img.lazyload").lazy();
}
if(mobilecheck()){
ScrollBottomRT('cont_comment_rt');
}
}
}
if (dataJson.status == "DELETED" || dataJson.status == "PENDING" || dataJson.status == "REJECTED") {
$('#comment_user_real_time_' + dataJson.id).remove();
try {
if (!mobilecheck()) {
ps_list_comments.update();
}
} catch (error) { }
}
} catch (e) {
console.log(e);
}
};
function insertCommentRealTime(id) {
var commentText = '';
commentText = Mentions($('#comment_area_tiempo_real').html().remHmtlSend());
commentText = encodeURIComponent(commentText.trim());
if (commentText != '') {
if (commentText != '') {
var isIE = /(MSIE 8)|(MSIE 9)/i.test(navigator.userAgent);
var method = "POST";
if (isIE) {
method = "GET";
}
$(".bt_send_message").addClass('disabled');
$(".bt_send_message").attr("onclick", "");
setTimeout(function () {
$(".bt_send_message").attr("onclick", "insertCommentRealTime(); return false;");
idResp = "";
}, 3000);
$.ajax({
url: urlComments,
method: method,
dataType: "json",
data: {
action: "newComment",
text: commentText,
url: cmtData.page.replace('comentaristalab', 'comentarista'),
accessToken: cmtData.accessToken,
title: encodeURIComponent(cmtData.title),
authType: cmtData.authType,
id: id,
isAdmin: cmtData.isAdmin ? 'Y' : 'N',
acceptedConditions: (cmtData.aprtym) ? 'Y' : 'N'
}
}).done(function (response) {
if (response.hasOwnProperty('error')) {
vex.dialog.alert("Ha ocurrido un error, inténtelo nuevamente");
enableInsertCommentButton(id);
return;
}
if (response.hasOwnProperty('status') && response.status === 'PENDING') {
vex.dialog.alert('Tu comentario será revisado por nuestros moderadores');
if (typeof id !== 'undefined')
showReply(id);
} else {
var el = document.querySelector('li[data-order="TIME_DESC"]');
if (el !== null) {
el.click();
}
}
$('#comment_area_tiempo_real').html("");
//$(".bt_send_message").addClass('disabled');
if (document.querySelector('#comentarios') !== null) {
setTimeout(CommentsApi.updateComments, 1000);
}
})
.fail(function (err) {
vex.dialog.alert("Ha ocurrido un error, inténtelo nuevamente", err);
});
}
}
}
function showReplyRT(idCrt){
var idResp = idCrt;
$.getJSON("//cache-comentarios.ecn.cl/Comments/Api", { action: "getCommentById", id: idCrt }).done(function (d) {
var htmlTxt = $('#comment_area_tiempo_real').html();
$('#comment_area_tiempo_real').html(
htmlTxt + ' ' + d.creator + ' '
);
// $('#comment_area_tiempo_real').focus();
placeCaretAtEnd(document.getElementById("comment_area_tiempo_real"));
$(".bt_send_message").attr('onclick','insertCommentRealTime('+idCrt+'); return false;');
idResp = idCrt;
});
}
function placeCaretAtEnd(el) {
el.focus();
if (typeof window.getSelection != "undefined"
&& typeof document.createRange != "undefined") {
var range = document.createRange();
range.selectNodeContents(el);
range.collapse(false);
var sel = window.getSelection();
sel.removeAllRanges();
sel.addRange(range);
} else if (typeof document.body.createTextRange != "undefined") {
var textRange = document.body.createTextRange();
textRange.moveToElementText(el);
textRange.collapse(false);
textRange.select();
}
}
function removeID(){
$(".bt_send_message").attr('onclick','insertCommentRealTime(); return false;');
var idResp = "";
}
function reverseArray(arr) {
var newArray = [];
for (var i = arr.length - 1; i >= 0; i--) {
newArray.push(arr[i]);
}
return newArray.sort(function(a, b){return a.time-b.time});
}
setTimeout(function () {
var urlCacheComments = "//cache-comentarios.ecn.cl/Comments/Api";
var data = {
action: 'getComments',
url: cmtData.page,
includePending: "false",
format: "json",
order: "TIME_DESC",
rootComment: "true",
withoutBoost: "true",
limit: "40"
};
$.ajax({
url: urlCacheComments,
dataType: "json",
data: data,
method: "GET",
async: true,
cache: true
}).done(function (response) {
if(!response.error){
(reverseArray(response.comments)).forEach(function (res) {
newCommentNews(res, false);
})
ScrollBottomRT('cont_comment_rt');
$('.new_commets').fadeOut('slow');
setTimeout(function () {
CommentsApi.autoComplete('_tiempo_real');
$("a.linkContNews").contents().unwrap();
}, 1000);
$(".bt_send_message").attr('onclick','insertCommentRealTime(); return false;');
}
}).always(function () {
var $container = $('.cont_comment_rt');
MAX_SCROLL = $container.scrollTop();
});
}, 1000);