18.2 C
New York
Sunday, September 26, 2021

Buy now

El gesto de Eduardo “Wado” de Pedro para que aplaudan a Alberto Fernández en medio del discurso en el que – Clarín

‘);
$(“#activateComments”).trigger(‘refreshPlugin’);
}

$(document).on(“wa.login”, function(e, user){
var status = sasSiteHelper.getKwPw();
if (status != 2) {
$(“div.comment-buttons”).show();
$(“.habilito_comentar”).show();

} else {
$(“div.comment-buttons”).hide();
$(“.habilito_comentar”).hide();
}

refreshCommentPlugin();
});

$(document).on(“wa.logout”, function(e, user){
var status = sasSiteHelper.getKwPw();
if (status != 2) {
$(“div.comment-buttons”).show();
$(“.habilito_comentar”).show();

} else {
$(“div.comment-buttons”).hide();
$(“.habilito_comentar”).hide();
}

refreshCommentPlugin();
});

$(window).scroll(function() {
var divEntry = $(“.content-top-right”);
var bottom = $(window).height() – divEntry.height();
bottom = divEntry.offset().top – bottom;
if ($(window).scrollTop() > bottom) {
$(“#containerID-comments-pase”).attr(‘style’,’width: 100%;clear: both’);
}
})

const box1 = document.querySelector(“.head-comments”);

const observer1 = new IntersectionObserver(
(entries, observer) => {
entries.forEach((entry) => {
if (entry.isIntersecting && !acum) {
acum++
loadComments()
}
});
},
{
rootMargin: “700px”
}
);

observer1.observe(box1);

const getCommentCount = () =>{
$(“.numb_comment.top”).addClass(“viafoura-observer”)
$(“.numb_comment.top”).html(““);
const box2 = document.querySelector(“.numb_comment.top”);
observer1.observe(box2);
}

getCommentCount()

let acum = 0

const loadScript = src => {
return new Promise((resolve, reject) => {
const script = document.createElement(‘script’)
script.type = ‘text/javascript’
script.defer = true;
script.onload = resolve
script.onerror = reject
script.src = src
document.head.append(script)
})
}

const loadComments = () => {
loadScript(‘//cdn.viafoura.net/vf-v2.js’)
.then(() => {
console.log(‘CARGO VIAFOURA’)

window.vf.$prepublish((channel, event, …args) => {
console.log(channel, event)
if(channel === ‘comments’ && event === ‘read’ && !$( “.vf-comments-count” ).length > 0){
$(“.numb_comment”).html(“0“)
}
if (channel === ‘authentication’ && event === ‘required’) {
return false;
}
else if (channel === ‘commenting’ && event === ‘loaded’ || channel === ‘comments’ && event === ‘read’) {
// console.log(sasSiteHelper.getKwPw(), $.cookie(“__WASID”))

$(‘.vf-content-editor-input’).attr(‘placeholder’,’Sumá tu opinión y dejá tu comentario’)
$(‘.vf-load-more__button .vf-loader-button__content’).text(‘Cargar mas comentarios’)

$(“.vf-editor-area”).click(function(){
$(‘.vf-content-editor-actions__submit .vf-loader-button__content’).text(‘Comentar’)
});
$(“.vf-content-actions__reply”).click(function(){
$(‘.content-focus-container__footer .vf-loader-button__content’).text(‘Comentar’)
});

if(sasSiteHelper.getKwPw() != 2){
$( “.vf-post-form__new-content” ).hide();
}
else{
$( “.vf-post-form__new-content” ).show();
}

if($( “.numb_comment.top” ).hasClass(“viafoura-observer”)){
let count = $( “.numb_comment.top .vf-comments-count” ).text();
let value = 0

if(count.length){
value = count.match(/d+/)[0]
}

console.log(“VALUE”, value);

}

return false;
}
else if(channel === ‘tray’ && event === ‘open-intent’){
$(“.vf-front-avatar”).removeClass(‘vf-avatar’);
$(“.vf-front-avatar”).addClass(‘vf-relative-custom’);
return false;
}
else if(channel == ‘login’ && event == ‘success’){
if(sasSiteHelper.getKwPw() != 2){
window.vf.session.logout();
return false;
}
else{
return { channel, event, args };
}
}
else {
return { channel, event, args };
}
});

})
.catch(() => console.error(‘ERROR CARGANDO VIAFOURA.’))
}

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Stay Connected

0FansLike
2,956FollowersFollow
0SubscribersSubscribe
- Advertisement -spot_img

Latest Articles