Pederastia

Pederastiawindow.tabbola_type = “article”;
Comentario

(function ($) {
// // returns the value of a specified cookie
function getCookie(cname) {
var name = cname + “=”;

var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(‘;’);
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
data = c.substring(name.length, c.length);
return JSON.parse(data);
}
}
return "";
}
function _read_cookie() {
if(typeof window.register_services == 'undefined'){
window.register_services = getCookie("_register_services");
}
}

function can_update_comment(commentName){
if(
typeof window.register_services != 'undefined' &&
window.register_services !== null && window.register_services != '' &&
window.register_services.hasOwnProperty('name') &&
window.register_services.name == commentName
){
return true;
}else{
return false;
}
}

function can_create_comment(){
if(typeof window.register_services == 'undefined' || window.register_services == null || window.register_services == '') return 0;
if( window.register_services.role != 1 ) return 2;
return 1;
}
function _html_form_register(user_rol){
html = '';
html += '’+

Este es un espacio para la construcción de ideas, y de opinión.

‘+

Se busca crear un foro de convivencia y reflexión, no un escenario de ataques al pensamiento contrario

‘;
if(user_rol == 1){
html += ”+
‘Su correo no ha sido confirmado. para poder opinar en los contenidos de El Espectador debe confirmarlo haciendo click ‘+
‘AQUÍ’+
”;
}else{
html += ‘

‘+
”+
Ingrese aquí‘+
”+
”;
}
return html;
}

function generate_popup(message) {
return ”+
”+
”+
‘+
”+
”+
”+
”+
”+
‘Error message’+
message +”+
”+
”+
”+
”;
}
function init(comments, canComment) {
var canComment = can_create_comment();
var html = “”;
html += canComment == 2 ? _html_form_send(false) : _html_form_register(canComment);
html += “”;
$.each(comments.data, function (i, comment) {
html += _html_comment(comment, canComment);
});
html += “”;
html += “”;
$(“.comment_list_807737″).html(html).slideToggle(200);
_active_events();
}

function _html_comment(comment, canComment) {
var html = ”;
html += “”;
html += “”;
html += “

” + comment.name + ” ” + comment.create + “

“;
html += “”;
html += “

” + comment.body + “

“;
html += “”;
if(canComment == 2) html += “Responder”;
if(can_update_comment(comment.name)) html += “Editar”;
html += “”;
html += “”;
if (typeof comment.lchildren !== ‘undefined’ && comment.lchildren.length > 0) {

$.each(comment.lchildren, function (i, cm) {
html += _html_comment(cm, 0);
});

}
html += “”;
html += “”;
return html;
}

function _html_form_send(cancel) {
var html = ”;
html = ”+

Este es un espacio para la construcción de ideas, y de opinión.

‘+

Se busca crear un foro de convivencia y reflexión, no un escenario de ataques al pensamiento contrario

‘+

Máximo 1500 caracteres

‘+
”;
if(cancel) html=”;
html += ” +
” +
” +
‘Enviar’;
html += cancel ?’Cancelar’ : ”;
html +=” +
”;
return html;
}

function _active_events() {

$(“.btn-cancel”).off(“click”);
$(“.btn-cancel”).on(“click”, function (event) {
event.preventDefault();
var p = $(this).parents(“.form-comment”).first();
p.siblings(“.btns”).show();
p.remove();
});

$(“.btn-send”).off(“click”);
$(“.btn-send”).on(“click”, function (event) {
event.preventDefault();
var p = $(this).parents(“.form-comment”).first();
p.children(“textarea”).removeAttr(‘style’);
var text = p.children(“textarea”).val();
var that = $(this);
that.hide();
if (text == “”) {
$(“.comment_list_807737”).append(generate_popup(‘El campo Comentario es obligatorio.’));
p.children(“textarea”).css({“border-color”: “red”, “border-width”:”2px”, “border-style”:”solid”});
that.show();
} else {
var p_comment = $(this).parents(“.item-comment-chield”).first();
var formData = new FormData();
formData.append(“comment”, text);
if( p_comment.hasClass(“update”) ){
p_comment.find(‘.bts-form’).hide();
var comment_id = p_comment.attr(“data-commentid”);
// formData.append(“parentId”, comment_id);
formData.append(“nid”, “807737”);
$.ajax({
url: “/ee-comments-services/comments/update/”+comment_id,
type: ‘POST’,
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (response) {
if (response.status == true) {
p_comment.children(“.comment-body”).text(text);
p_comment.children(“.form-comment”).remove();
p_comment.children(“.btns”).show();
p_comment.removeClass(“update”);
} else {
if(response.message){
p_comment.children(“.comment-body”).append(generate_popup(response.message));
}else{
p_comment.children(“.comment-body”).append(generate_popup(‘No se pudo actualizar el comentario’));
}
p_comment.children(“.form-comment”).remove();
p_comment.children(“.btns”).show();
}
that.show();
}
});
}else{
var cantComment = 0;
if (p_comment.length == 0) {
cantComment = can_create_comment();
formData.append(“parentId”, “0”);
console.log(‘este es nuevo’);
} else {
cantComment = 0;
formData.append(“parentId”, p_comment.attr(“data-commentid”));
console.log(‘esto es una respuesta’);
}
$.ajax({
url: “/ee-comments-services/comments/create/807737”,
type: ‘POST’,
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (response) {
if (response.status == true) {
var html_comment = _html_comment(response.data, cantComment);
if (p_comment.length == 0) {
p.find(“textarea”).val(“”);
p.parents(“.super_box”).first().find(“.comments_box”).prepend(html_comment);
} else {
var btn = p.siblings(“.btns”);
btn.show();
p.remove();
btn.siblings(“.lchildren”).append(html_comment);
}
_active_events();
} else {
var btn = p.siblings(“.btns”);
if(response.message){
console.log(response);
$(“.comment_list_807737”).append(generate_popup(response.message));
}else{
$(“.comment_list_807737”).append(generate_popup(‘No se pudo guardar el comentario’));
}
}
that.show();
}
});
}

}
_active_events();
});

$(“.btn-responder”).off(“click”);
$(“.btn-responder”).on(“click”, function (event) {
event.preventDefault();
var btn = $(this).parents(“.item-comment-chield”).first().children(“.btns”);
btn.after(_html_form_send(true));
btn.hide();
_active_events();
});

$(“.btn-editar”).off(“click”);
$(“.btn-editar”).on(“click”, function (event) {
event.preventDefault();
console.log(‘entro al editar’);
var p = $(this).parents(“.item-comment-chield”).first();
var btn = p.children(“.btns”);
btn.after(_html_form_send(true));
btn.hide();
p.addClass(“update”);
p.find(“textarea”).val(p.children(“.comment-body”).text());
_active_events();
});
$(“.btn-send-notify-user-zone”).off(“click”);
$(‘.btn-send-notify-user-zone’).click(function () {
$.ajax({
method: ‘GET’,
url: ‘/register-services/user/confirm’,
cache: false,
contentType: false,
processData: false,
dataType: ‘json’,
success: function (result) {
if(result.status) $(‘.div-btn-send-notify’).append(generate_popup(result.message));
},
})
})
}
var host = window.location.origin;
_read_cookie();
var urlcount = host + “/ee-comments-services/comments/count/” + “807737”;
$.get(urlcount, function (response) {
$(“.get_comments_807737”).children(‘span’).html(response.totalComments);
});
$(“.get_comments_807737”).on(‘click’, function (event) {
event.preventDefault();
var selector = $(“.comment_list_807737”);
if( selector.hasClass( “push” )){
selector.removeClass(“push”)
}else{
selector.addClass(“push”)

}
if( selector.hasClass( “response” )){
selector.slideToggle(200);
}else{
selector.addClass(“response”)
$.get(host + “/ee-comments-services/comments/read/” + “807737”, function (response) {
init(response);
});
}

});
})(jQuery);

Comments are closed.