if (typeof ESKUP == "undefined" || !ESKUP) {
var ESKUP = {};
}
ESKUP.hashHostPorMedio = {
'ep': 'elpais.com',
'cs': 'cadenaser.com',
'los40es': 'los40.com',
'los40es': 'los40.cl',
'los40es': 'los40.com.co',
'los40es': 'los40.com.mx',
'los40es': 'los40.com.ar',
'los40es': 'los40.com.pa',
'los40es': 'los40.co.cr',
'as': 'as.com',
'5d': 'cincodias.com',
'dias5': 'cincodias.elpais.com',
'retina': 'retina.elpais.com',
'caracol': 'caracol.com.co',
'wradiomx': 'wradio.com.mx'
}
ESKUP.addEvent = function (el,type,handler){
if (el.addEventListener) {
el.addEventListener(type,handler,false);
} else {
el['on'+type] = handler;
}
}
ESKUP.removeEvent = function (el,type,handler){
if (el.removeEventListener) {
el.removeEventListener(type,handler,false);
} else {
el['on'+type]=null;
}
}
ESKUP.triggerEvent = function (el,eventName) {
var event;
if (document.createEvent) {
event = document.createEvent('HTMLEvents');
event.initEvent(eventName,true,true);
} else if (document.createEventObject) {
event = document.createEventObject();
event.eventType = eventName;
}
event.eventName = eventName;
if (el.dispatchEvent) {
el.dispatchEvent(event);
} else if (el[eventName]) {
el[eventName]();
} else if (el['on'+eventName]) {
el['on'+eventName]();
}
}
ESKUP.triggerEventParam = function (el,eventName,details) {
var params = { bubbles: false, cancelable: false, detail:details };
var evt = document.createEvent('CustomEvent');
evt.initCustomEvent( eventName, params.bubbles, params.cancelable, params.detail );
el.dispatchEvent(evt);
}
ESKUP.peticionJSONP = function (url) {
var tagScript = null;
tagScript = document.createElement("script");
tagScript.setAttribute("type", "text/javascript");
tagScript.setAttribute("src", url);
tagScript.onload = tagScript.onerror = tagScript.onreadystatechange = function() {
if ((tagScript.readyState && !(/^c|loade/.test(tagScript.readyState))) || tagScript.loaded) return;
tagScript.onload = tagScript.onreadystatechange = null
tagScript.parentNode.removeChild(tagScript);
}
var _head = document.head || document.getElementsByTagName('head')[0];
_head.appendChild(tagScript);
}
ESKUP.obtenerHashMensaje = function(idMensaje) {
var hashMensaje = Array();
if (typeof _hashMsgs != 'undefined' && _hashMsgs.mensajes != 'undefined') {
for (var i in _hashMsgs.mensajes) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
hashMensaje = _hashMsgs.mensajes[i];
break;
}
}
}
return hashMensaje;
}
ESKUP.obtenerDatosExtraMensaje = function(idMensaje) {
var hashMensaje = ESKUP.obtenerHashMensaje(idMensaje);
hashMensaje.urlAsociada = '';
hashMensaje.textoAsociado = '';
hashMensaje.tipoMensaje = '';
hashMensaje.idWidget = '';
hashMensaje.tipoSuscripcion = '';
if (typeof hashMensaje.idMsg == 'undefined') {
return hashMensaje;
}
var listaTablones = hashMensaje['CopiaEnTablones'];
var arrayTablones = listaTablones.split(",");
for (var i = 0; i < arrayTablones.length; i++){
var nombreTablon = arrayTablones[i];
if (nombreTablon.substr(0,3)=="ev-"){
nombreTablon = nombreTablon.substr(3);
if (typeof _hashMsgs['perfilesEventos'] != 'undefined' &&
typeof _hashMsgs['perfilesEventos'][nombreTablon] != 'undefined') {
var datosTablon = _hashMsgs['perfilesEventos'][nombreTablon];
if(datosTablon.tipo_evento == '200'){
hashMensaje.tipoMensaje = 'entrevista_digital';
} else {
hashMensaje.tipoMensaje = 'evento';
}
if (typeof datosTablon.url_estatica != 'undefined') {
hashMensaje.urlAsociada = datosTablon.url_estatica;
}
if (typeof datosTablon.nombre != 'undefined') {
hashMensaje.textoAsociado = datosTablon.nombre;
}
if (typeof datosTablon.tipo_suscripcion != 'undefined') {
if (typeof datosTablon.activo != 'undefined' && datosTablon.activo) {
hashMensaje.tipoSuscripcion = datosTablon.tipo_suscripcion;
} else {
hashMensaje.tipoSuscripcion = 0;
}
}
hashMensaje.idWidget = 'widget_eskup_' + nombreTablon;
return hashMensaje;
}
}
}
if (hashMensaje.hilo &&
typeof _hashMsgs['perfilesHilos'] != 'undefined' &&
typeof _hashMsgs['perfilesHilos']['_' + hashMensaje.hilo] != 'undefined') {
var datosHilo =_hashMsgs['perfilesHilos']['_'+hashMensaje.hilo];
if (typeof datosHilo.tipo != 'undefined' && datosHilo.tipo == 'comentarios') {
hashMensaje.tipoMensaje = 'comentario';
}
if (typeof datosHilo.url_asociada != 'undefined') {
hashMensaje.urlAsociada = datosHilo.url_asociada;
}
if (typeof datosHilo.titulo_noticia != 'undefined') {
hashMensaje.textoAsociado = ESKUPdecodeURIComponent(datosHilo.titulo_noticia);
}
hashMensaje.idWidget = 'comentarios_noticia_' + hashMensaje.hilo;
}
return hashMensaje;
}
ESKUP.rrss = {};
ESKUP.rrss.share = function(url, ancho, alto) {
var width = ancho || 550;
var height = alto || 450;
var sheight = screen.height;
var swidth = screen.width;
var left = Math.round((swidth/2)-(width/2));
var top = (sheight>height)? Math.round((sheight/2)-(height/2)) : 0;
var win = window.open(url,
"Recomendar",
"left="+left+",top="+top+",width="+width+",height="+height+",personalbar=0,toolbar=0,scrollbars=1,resizable=1");
if (win) {
win.focus();
}
return true;
}
ESKUP.rrss.componerInfoCompartir = function(idMensaje) {
var hashInfoCompartir = Array();
var hashDatosExtraMensaje = ESKUP.obtenerDatosExtraMensaje(idMensaje);
var url = '';
var compartirComoEmbebido = false;
if(hashDatosExtraMensaje instanceof Array && hashDatosExtraMensaje.length == 0){
var hashMensaje = Array();
if (typeof _hashMsgs != 'undefined' && typeof _hashMsgs.mensajes != 'undefined' && _hashMsgs.mensajes.length != 0) {
hashDatosExtraMensaje = ESKUP.obtenerDatosExtraMensaje(_hashMsgs.mensajes[0].idMsg);
}
}
if (typeof _shareSimple != 'undefined' && _shareSimple){
url = window.location.href;
}else if (typeof _urlContenedor != 'undefined' && _urlContenedor) {
url = _urlContenedor;
compartirComoEmbebido = true;
} else if (typeof hashDatosExtraMensaje.urlAsociada != 'undefined' && hashDatosExtraMensaje.urlAsociada) {
url = hashDatosExtraMensaje.urlAsociada;
compartirComoEmbebido = true;
} else {
var urlBase = '';
if (typeof hashDatosExtraMensaje.origen != 'undefined' &&
typeof ESKUP.hashHostPorMedio[hashDatosExtraMensaje.origen] != 'undefined') {
urlBase = 'http://' + ESKUP.hashHostPorMedio[hashDatosExtraMensaje.origen] + '/Comentario/';
} else {
urlBase = 'http://eskup.elpais.com/';
}
url = urlBase + idMensaje;
if (typeof LANGESKUP != 'undefined' && LANGESKUP) {
url += '/' + LANGESKUP;
}
}
if (compartirComoEmbebido) {
if (url.indexOf('#') == -1) {
url += '#';
} else {
url += ';';
}
url += 'skp_idwdg=' + encodeURIComponent(hashDatosExtraMensaje.idWidget) +
';skp_idmsg=' + encodeURIComponent(idMensaje);
if (typeof LANGESKUP != 'undefined' && LANGESKUP) {
url += ';skp_paramwdg=' + encodeURIComponent('&gla=' + LANGESKUP);
}
}
hashInfoCompartir.url = url;
hashInfoCompartir.texto = hashDatosExtraMensaje.textoAsociado;
return(hashInfoCompartir);
}
ESKUP.rrss.twitterShare = function(idMensaje, textoCompartir, via) {
var hashInfoCompartir = ESKUP.rrss.componerInfoCompartir(idMensaje);
if (typeof textoCompartir != 'undefined' || textoCompartir) {
hashInfoCompartir.texto = textoCompartir;
}
var urlShare = 'http://twitter.com/share?url=' + encodeURIComponent(hashInfoCompartir.url) + '&text=' + encodeURIComponent(hashInfoCompartir.texto);
if (typeof via != 'undefined' && via) {
urlShare += '&via=' + via;
}
ESKUP.rrss.share(urlShare);
}
ESKUP.rrss.facebookShare = function(idMensaje, textoCompartir) {
var hashInfoCompartir = ESKUP.rrss.componerInfoCompartir(idMensaje);
if (typeof textoCompartir != 'undefined' || textoCompartir) {
hashInfoCompartir.texto = textoCompartir;
}
ESKUP.rrss.share('http://www.facebook.com/sharer.php?u='+encodeURIComponent(hashInfoCompartir.url)+'&t='+encodeURIComponent(hashInfoCompartir.texto));
}
ESKUP.rrss.facebookFeed = function(idMensaje, textoCompartir,metas,urlDeadPage) {
var hashInfoCompartir = ESKUP.rrss.componerInfoCompartir(idMensaje);
if (typeof textoCompartir != 'undefined' || textoCompartir) {
hashInfoCompartir.texto = textoCompartir;
}
var returnUrl = urlDeadPage;
var name = encodeURIComponent(hashInfoCompartir.texto);
var link = encodeURIComponent(hashInfoCompartir.url);
var appid = metas[0];
var caption = metas[1];
ESKUP.rrss.share('http://www.facebook.com/dialog/feed?app_id='+appid+'&description=&display=popup&name='+name+'&caption='+caption+'&link='+link+'&redirect_uri='+returnUrl);
}
ESKUP.rrss.linkedinShare = function(idMensaje, textoCompartir) {
var hashInfoCompartir = ESKUP.rrss.componerInfoCompartir(idMensaje);
if (typeof textoCompartir != 'undefined' || textoCompartir) {
hashInfoCompartir.texto = textoCompartir;
}
var ts = new Date().getTime();
ESKUP.rrss.share('http://www.linkedin.com/cws/share?url=' + encodeURIComponent(hashInfoCompartir.url) + '&original_referer=' + encodeURIComponent(hashInfoCompartir.url) + '&token=&isFramed=false&lang=es_ES&_ts=' + ts);
}
ESKUP.rrss.googleplusShare = function(idMensaje, textoCompartir) {
var hashInfoCompartir = ESKUP.rrss.componerInfoCompartir(idMensaje);
if (typeof textoCompartir != 'undefined' || textoCompartir) {
hashInfoCompartir.texto = textoCompartir;
}
ESKUP.rrss.share('https://plus.google.com/share?url='+encodeURIComponent(hashInfoCompartir.url));
}
var _ESKUPhashMsgByLang = {
"es": {
"tu_respuesta" : "Tu respuesta",
"ver_todos_los_mensajes" : "Ver todos los mensajes",
"todos_los_comentarios" : "todos los comentarios",
"ver_mensaje_al_que_responde" : "Ver mensaje al que responde",
"responder" : "Responder",
"reenviar_mensaje" : "Reenviar mensaje",
"enlace_permanente" : "Enlace permanente",
"notificar_insulto" : "Notificar insulto",
"marcar_como_spam" : "Marcar como spam",
"seguir_al_usuario" : "Seguir al usuario",
"cancelar" : "Cancelar",
"el_contenido_del_mensaje_no_puede_ser_vacio" : "El contenido del mensaje no puede ser vacío",
"hace" : "Hace",
"hora" : "hora",
"horas" : "horas",
"minuto" : "minuto",
"minutos" : "minutos",
"menos_de_un_minuto" : "Menos de 1 minuto",
"a_las" : "a las",
"pagina_siguiente" : "Página siguiente",
"pagina_anterior" : "Página anterior",
"primera_pagina" : "Primera página",
"mostrar_mas" : "Mostrar más",
"la_notificacion_de_insulto" : "Muchas gracias por colaborar.",
"la_notificacion_de_spam" : "Muchas gracias por colaborar.",
"no_se_ha_podido_hacer_la_notificacion" : "Por favor. inténtalo más tarde.",
"dinos_la_ubicacion_de_la_imagen" : "Dinos la ubicación de la imagen que quieres que acompañe tu mensaje",
"borrar_imagen" : "Borrar imagen",
"error_al_enviar_el_mensaje" : "Ha ocurrido un error al enviar el mensaje. Por favor, inténtalo más tarde.",
"mensaje_enviado_correctamente" : "El mensaje se ha enviado correctamente",
"no_perteneces_al_foro" : "AVISO: no perteneces al Foro EL PAÍS, tu mensaje se publicará en la pestaña ",
"no_has_escrito_nada" : "No has escrito nada para enviar",
"el_mensaje_no_puede_tener_mas_de" : "El mensaje no puede tener más de ",
"caracteres" : "caracteres",
"procesando_tu_mensaje" : "Procesando tu mensaje",
"espera_por_favor" : "Espera por favor",
"estamos_procesando_tu_mensaje" : "Estamos procesando tu mensaje",
"para_seguir_al_usuario" : "Para seguir a un usuario tienes que estar autenticado",
"confirmar" : "Confirmar",
"le_estas_siguiendo" : "Le estás siguiendo",
"dejar_de_seguirle" : "Dejar de seguirle",
"error_al_realizar_la_operacion" : "Se ha producido un error al realizar la operacion. Por favor, intentalo mas tarde.",
"editar_mensaje" : "Editar mensaje",
"borrar_mensaje" : "Borrar mensaje",
"no_es_posible_responder_al_mensaje" : "No es posible responder al mensaje, la conversación está cerrada",
"para_responder_tienes_que_identificarte" : "Para responder un mensaje tienes que identificarte",
"no_es_posible_recuperar_los_mensajes" : "No es posible recuperar los mensajes",
"no_hay_mensajes_disponibles" : "No hay mensajes disponibles",
"tienes_nuevos_mensajes" : "Tienes nuevos mensajes",
"estas_seguro_de_borrar_el_mensaje" : "¿Estás seguro de que deseas borrar tu mensaje?",
"error_al_borrar_el_mensaje" : "Se ha producido un error al borrar el mensaje. Por favor inténtalo más tarde.",
"mensaje_borrado_correctamente" : "Mensaje borrado correctamente",
"enviar" : "Enviar",
"estas_seguro_de_cancelar_el_mensaje" : "¿Estás seguro de cancelar el mensaje?",
"ha_ocurrido_un_error" : "Ha ocurrido un error. Por favor, inténtalo más tarde.",
"mensaje_disponible_en_unos_segundos" : "Tu mensaje estará disponible en unos segundos",
"recargar_la_pagina" : "Recargar la página",
"tamano_ventana" : "Tamaño ventana",
"tamano_real" : "Tamaño real",
"cerrar" : "Cerrar",
"mensaje_borrado" : "mensaje borrado",
"ver_video" : "Ver vídeo",
"ver_contenido_externo" : "Ver contenido externo",
"mensaje_pendiente_moderacion" : "Estamos moderando tu comentario. Si es aprobado, estará visible en unos segundos.",
"pendiente_moderacion" : "pendiente de moderación",
"foto" : "Foto",
"edicion_mensaje" : "La edición de este mensaje será moderada. En caso de no pasar el filtro, será eliminado el mensaje actual.",
"no_editar" : "No se puede editar el mensaje porque está pendiente de moderar",
"continuar" : "Continuar",
"xxx": "xxx"
},
"ca": {
"tu_respuesta" : "La teva resposta",
"ver_todos_los_mensajes" : "Veure tots els missatges",
"todos_los_comentarios" : "Tots els comentaris",
"ver_mensaje_al_que_responde" : "Veure missatge a què correspon",
"responder" : "Respondre",
"reenviar_mensaje" : "Reenviar missatge",
"enlace_permanente" : "Enllaç permanent",
"notificar_insulto" : "Notificar insult",
"marcar_como_spam" : "Marcar com a spam",
"seguir_al_usuario" : "Seguir l'usuari",
"cancelar" : "Cancel·lar",
"el_contenido_del_mensaje_no_puede_ser_vacio" : "El contingut del missatge no pot ser buit",
"hace" : "Fa",
"hora" : "hora",
"horas" : "hores",
"minuto" : "minut",
"minutos" : "minuts",
"menos_de_un_minuto" : "Menys d'1 minut",
"a_las" : "a les",
"pagina_siguiente" : "Pàgina següent",
"pagina_anterior" : "Pàgina anterior",
"primera_pagina" : "Primera pàgina",
"mostrar_mas" : "Mostrar más",
"la_notificacion_de_insulto" : "Moltes gràcies per col·laborar.",
"la_notificacion_de_spam" : "Moltes gràcies per col·laborar.",
"no_se_ha_podido_hacer_la_notificacion" : "Sisplau, intenta-ho més tard.",
"dinos_la_ubicacion_de_la_imagen" : "Digues la ubicació de la imatge que vols que acompanyi el teu missatge",
"borrar_imagen" : "Esborrar imatge",
"error_al_enviar_el_mensaje" : "S'ha produït un error en enviar el missatge. Sisplau, intenta-ho més tard.",
"mensaje_enviado_correctamente" : "El missatge s'ha enviat correctament",
"no_perteneces_al_foro" : "AVÍS: no pertanys al Fòrum EL PAÍS, el teu missatge es publicarà a la pestanya ",
"no_has_escrito_nada" : "No has escrit res per enviar",
"el_mensaje_no_puede_tener_mas_de" : "El missatge no pot tenir més de ",
"caracteres" : "caràcters",
"procesando_tu_mensaje" : "Processant el teu missatge",
"espera_por_favor" : "Espera sisplau",
"estamos_procesando_tu_mensaje" : "Estem processant el teu missatge",
"para_seguir_al_usuario" : "Per seguir un usuari has d'estar autenticat",
"confirmar" : "Confirmar",
"le_estas_siguiendo" : "L'estàs seguint",
"dejar_de_seguirle" : "Deixar de seguir-lo",
"error_al_realizar_la_operacion" : "S'ha produït un error en fer l'operació. Sisplau, intenta-ho més tard.",
"editar_mensaje" : "Editar missatge",
"borrar_mensaje" : "Esborrar missatge",
"no_es_posible_responder_al_mensaje" : "No és possible respondre al missatge, la conversa està tancada",
"para_responder_tienes_que_identificarte" : "Per respondre a un missatge t\\'has d\\'identificar",
"no_es_posible_recuperar_los_mensajes" : "No és possible recuperar els missatges",
"no_hay_mensajes_disponibles" : "No hi ha missatges disponibles",
"tienes_nuevos_mensajes" : "Tens nous missatges",
"estas_seguro_de_borrar_el_mensaje" : "Estàs segur d'esborrar el missatge?",
"error_al_borrar_el_mensaje" : "S'ha produït un error en esborrar el missatge. Sisplau, intenta-ho més tard.",
"mensaje_borrado_correctamente" : "Missatge esborrat correctament",
"enviar" : "Enviar",
"estas_seguro_de_cancelar_el_mensaje" : "Estàs segur de cancel·lar el missatge?",
"ha_ocurrido_un_error" : "S'ha produït un error. Sisplau, intentar-ho més tard.",
"mensaje_disponible_en_unos_segundos" : "El teu missatge estarà disponible en uns segons",
"recargar_la_pagina" : "Racarregar la pàgina",
"tamano_ventana" : "Mida finestra",
"tamano_real" : "Mida real",
"cerrar" : "Tancar",
"mensaje_borrado" : "missatge esborrat",
"ver_video" : "Veure vídeo",
"ver_contenido_externo" : "Veure contingut extern",
"mensaje_pendiente_moderacion" : "Estem moderant el teu comentari. Si s\'aprova, es podrà veure d\'aquí a uns segons.",
"pendiente_moderacion" : "pendent de moderació",
"foto" : "Foto",
"edicion_mensaje" : "L\'edició d\'aquest missatge serà moderada. En cas que no passi el filtre, serà eliminat el missatge actual",
"no_editar" : "No es pot editar el missatge perquè està pendent de moderar",
"continuar" : "Continua",
"xxx": "xxx"
},
"pt-br": {
"tu_respuesta" : "Sua resposta",
"ver_todos_los_mensajes" : "Ver todas as mensagens",
"todos_los_comentarios" : "todos os comentários",
"ver_mensaje_al_que_responde" : "Ver mensagem a que responde",
"responder" : "Responder",
"reenviar_mensaje" : "Reenviar mensagem",
"enlace_permanente" : "Link permanente",
"notificar_insulto" : "Notificar insulto",
"marcar_como_spam" : "Marcar como spam",
"seguir_al_usuario" : "Seguir usuário",
"cancelar" : "Cancelar",
"el_contenido_del_mensaje_no_puede_ser_vacio" : "O conteúdo da mensagem não pode ser vazio",
"hace" : "Faz",
"hora" : "hora",
"horas" : "horas",
"minuto" : "minuto",
"minutos" : "minutos",
"menos_de_un_minuto" : "Menos de 1 minuto",
"a_las" : "às",
"pagina_siguiente" : "Próxima página",
"pagina_anterior" : "Página anterior",
"primera_pagina" : "Primeira página",
"mostrar_mas" : "Mostrar mais",
"la_notificacion_de_insulto" : "Muito obrigado por colaborar.",
"la_notificacion_de_spam" : "Muito obrigado por colaborar.",
"no_se_ha_podido_hacer_la_notificacion" : "Por favor, tente mais tarde.",
"dinos_la_ubicacion_de_la_imagen" : "Informe a localização da imagem com que deseja acompanhar sua mensagem",
"borrar_imagen" : "Apagar imagem",
"error_al_enviar_el_mensaje" : "Ocorreu um erro ao enviar a mensagem. Por favor, tente mais tarde.",
"mensaje_enviado_correctamente" : "A mensagem foi enviada corretamente",
"no_perteneces_al_foro" : "AVISO: você não está logado no fórum do EL PAÍS, sua mensagem será publicada na aba ",
"no_has_escrito_nada" : "Você não escreveu nada para enviar",
"el_mensaje_no_puede_tener_mas_de" : "A mensagem não pode ter mais de ",
"caracteres" : "caracteres",
"procesando_tu_mensaje" : "Processando sua mensagem",
"espera_por_favor" : "Espere, por favor",
"estamos_procesando_tu_mensaje" : "Estamos processando sua mensagem",
"para_seguir_al_usuario" : "Para seguir um usuário você precisa estar logado",
"confirmar" : "Confirmar",
"le_estas_siguiendo" : "Você está seguindo o usuário ",
"dejar_de_seguirle" : "Deixar de seguir",
"error_al_realizar_la_operacion" : "Ocorreu um erro ao realizar a operação. Por favor, tente mais tarde.",
"editar_mensaje" : "Editar mensagem",
"borrar_mensaje" : "Apagar mensagem",
"no_es_posible_responder_al_mensaje" : "Não é possível responder à mensagem, a conversação está encerrada",
"para_responder_tienes_que_identificarte" : "Para responder uma mensagem você precisa se identificar",
"no_es_posible_recuperar_los_mensajes" : "Não é possível recuperar as mensagens",
"no_hay_mensajes_disponibles" : "Não há mensagens disponíveis",
"tienes_nuevos_mensajes" : "Você tem novas mensagens",
"estas_seguro_de_borrar_el_mensaje" : "Tem certeza de que deseja apagar sua mensagem?",
"error_al_borrar_el_mensaje" : "Ocorreu um erro ao apagar a mensagem. Por favor, tente mais tarde.",
"mensaje_borrado_correctamente" : "Mensagem apagada corretamente",
"enviar" : "Enviar",
"estas_seguro_de_cancelar_el_mensaje" : "Tem certeza de que deseja cancelar a mensagem?",
"ha_ocurrido_un_error" : "Ocorreu um erro. Por favor, tente mais tarde.",
"mensaje_disponible_en_unos_segundos" : "Sua mensagem estará disponível em alguns segundos",
"recargar_la_pagina" : "Recarregar a página",
"tamano_ventana" : "Tamanho janela",
"tamano_real" : "Tamanho real",
"cerrar" : "Fechar",
"mensaje_borrado" : "mensagem apagada",
"ver_video" : "Ver vídeo",
"ver_contenido_externo" : "Ver conteúdo externo",
"mensaje_pendiente_moderacion" : "Estamos moderando seu comentário. Se for aprovado, estará visível em alguns segundos.",
"foto" : "Foto",
"edicion_mensaje" : "A edição desta mensagem será moderada. Se não passar pelo filtro, a mensagem atual será eliminada.",
"no_editar" : "Não é possível editar a mensagem porque ela está pendente de moderação",
"continuar" : "Seguir",
"xxx": "xxx",
'comentario_destacado':'Usuário de destaque',
'participa_foro':'Você precisa estar cadastrado para participar',
'accede_foro' :'Accede desde aquí al nuevo espacio de comentarios de nuestra web',
'autenticado' :'Você precisa estar cadastrado para participar',
'participa':'Participa',
'solicitud_pendiente':'Solicitud pendiente de valoración',
'foro':'Foro',
'lo_que_sigo':'Lo que sigo',
'sigo':'Sigo',
'ver_mensajes_sigo':'Ver solo los mensajes de los usuarios a los que sigo',
'ver_mensajes_foro':'Ver solo los mensajes del Foro EL PAÍS',
'los_que_sigo':'Los que sigo',
'debes_identificarte':'Para ver los mensajes de los usuarios a los que sigues tienes que identificarte',
'todos':'Todos',
'ver_todos_comentarios':'Ver todos los comentarios',
'comentarios_cerrados':'Comentarios cerrados',
'hay_mensajes':'Há novas mensagens',
'publicar':'Publicar',
'negrita':'Inserção em negrito CONTROL+N ',
'cursiva':'Inserir o itálico CONTROL+I ',
'adjuntar_imagen':'Anexar imagem',
'dinos_ubicacion':'Indique o caminho da imagem que você deseja anexar à mensagem:',
'refrescar':'Atualizar página',
'hay_nuevos':'Há mensagens novas',
'procesando_mensaje':'Estamos processando sua mensagem',
'ver_imagen':'Ver imagen',
'ver_todos_de':'Ver todos los mensajes de ',
'ver_mensaje_responde':'Ver mensaje al que responde',
'ampliar_foto':'Ampliar foto',
'mas_opciones':'Mais opções',
'foto_mensaje':'Foto da mensagem',
'responde_a':'Responder a',
'ver_completa':'Ver conversaci&ooacute;n completa',
'cancelar':'Cancelar',
'debes_aceptar':'Você precisa aceitar os termos de participação para completar seu cadastro e publicar a sua pergunta',
'completar_registro':'',
'para_publicar':'',
'previamente_puedes':'Se desejar, você pode rever seu histórico de comentários antes',
'historial_comentarios':'',
'es_necesario':'Es necesario que rellenes tu nombre y primer apellido para publicar tu comentario. Por favor, ',
'activa':'activa esos campos en tu perfil de usuario.',
'pagina_siguiente':'Próxima página',
'ver_conversaciones':'Respuestas',
'ver_conversacion':'Ver conversa',
'ocultar_conversacion':'Esconder conversa',
'votar':'Votar',
'votar_positivo':'Voto positivo',
'votar_negativo':'Voto negativo',
'gracias':'Obrigado!',
'denunciar':'Denunciar',
'editar':'Editar',
'borrar':'Apagar',
'insulto':'Insulto',
'spam':'Spam',
'no_acuerdo':'Discordo',
'fuera_tema':'Fora do tema abordado',
'gracias_colaborar':'Agradecemos a colaboração',
'respuestas':'Respostas',
'mensaje_registrado':'É necessário estar registrado e iniciar uma sessão para usar esta ferramenta',
'ordenar_por':'Organizar por',
'mejor_valorados':'Mais bem avaliados',
'mas_nuevos':'Mais recentes primeiro',
'mas_antiguos':'Mais antigos primeiro',
'modo_conversacion':'Modo conversação',
'ver_en':'Ver em',
'ver':'Ver',
'mostrar_respuestas':'Mostrar respostas',
'ten_cuenta_entrevistas':'Sua pergunta será publicada com o seu nome e sobrenome',
'enviar_pregunta':'Enviar pergunta',
'pregunta_recibida':'Pergunta recebida. Agradecemos a sua participação.',
'ver_enlace':'Ver o link',
'compartir':'Compartilhar',
'compartir_mensaje':'Compartilhar mensagem',
'insertar':'Inserir',
'codigo_insertar':'Código HTML para compartilhar conteúdo',
'copia_pega':'Copie e cole este HTML para a sua página',
'recomendar_facebook':'Recomendar no Facebook',
'twittear':'Twitar',
'enviar_linkedin':'Compartilhar no Linkedin',
'enviar_google':'Compartilhar no Google +',
'debes_registrado_1':'Para enviar uma pergunta, você precisa estar cadastrado no',
'debes_registrado_2':'e fazer o seu login',
'nuevas_preguntas':'Hay nuevas preguntas',
'no_existe':'La entrevista no existe',
'no_comenzado':'La entrevista no ha comenzado',
'entrevista_finalizada':'Entrevista finalizada',
'Extraído de':'Tirado de',
'pregunta_aceptada':'Pergunta aceitou, em poucos segundos que e será atendida pelo entrevistado.',
'no_hay_preguntas':'Não há perguntas disponíveis',
'fragmento_charla':'Trecho do bate-papo com ',
'comentario_noticia':'Tirado de ',
'comentario_emision':'Comentário feito na transmissão em tempo real de ',
'fragmento_charla_twitter':'Trecho do bate-papo com #NOMBRE_ENTREVISTADO# no @elpais_brasil',
'fragmento_charla_facebook':'Trecho do bate-papo com #NOMBRE_ENTREVISTADO# no El PAÍS',
'fragmento_charla_linkedin':'Trecho do bate-papo com #NOMBRE_ENTREVISTADO# no El PAÍS',
'fragmento_charla_googleplus':'Trecho do bate-papo com #NOMBRE_ENTREVISTADO# no El PAÍS',
'compartir_liveblogging_twitter':'#TEXTO_COMPARTIR#',
'compartir_liveblogging_facebook':'#TEXTO_COMPARTIR#',
'compartir_liveblogging_linkedin':'#TEXTO_COMPARTIR#',
'compartir_liveblogging_googleplus':'#TEXTO_COMPARTIR#',
'twitter_via':'elpais_brasil',
'mensaje_despedida':'Mensagem de despedida',
'enviocorrecto':'A mensagem foi enviada com sucesso',
'pendiente_moderacion':'(pendente de moderação)',
'en_moderacion' : 'Sob moderação',
'tu_comentario':'Seu comentário',
'ya_valorado':'O comentário já foi submetido anteriormente',
'error_valoracion':'Ocorreu um problema com sua solicitação',
'no_hay_mensajes_valorados':'Ele ainda não classificado nenhuma mensagem',
'confirma_borrar':'Tem certeza que deseja apagar a mensagem?',
}
}
if (typeof ESKUPobtieneIdioma == 'undefined') {
function ESKUPobtieneIdioma() {
var metas = document.getElementsByTagName('meta');
var idioma = "es";
var idioma_meta = "";
var i;
for (i=0; i0) && (incremento<1)) incremento = 1;
if((incremento<0) && (incremento>-1)) incremento = -1;
if ( posfin == coor ) {
if ( coordenada == "x" ) {
clearInterval ( elIntervalo_x ); return;
}
else {
clearInterval ( elIntervalo_y ); return;
}
}
coor += incremento;
if ( coordenada == "x" ) {
elDiv.style.left = coor + "px";
}
else {
elDiv.style.top = coor + "px";
}
}
function f_muestra_menciones_usuario(idUsuario) {
location.href = '/' + idUsuario + '/referencias';
}
function f_muestra_mensajes_enviados(idUsuario) {
location.href = '/' + idUsuario;
}
function f_comprobar_url_valida(url) {
if (url == '') {
return '';
}
if (/https?:\/\/([\w-]+\.)/.test(url)) {
return url;
}
else {
return 'http://' + url;
}
}
function trim(cadena) {
var nueva_cadena = cadena.replace(/^\s*|\s*$/g,"");
return nueva_cadena;
}
function f_asigna_valor(campo_select, id_campo_texto) {
var valor_seleccionado = campo_select.options[campo_select.selectedIndex].value;
var campo_texto = document.getElementById(id_campo_texto);
campo_texto.value = valor_seleccionado;
}
function f_fija_class(id, estilo) {
var divCaja = document.getElementById(id);
divCaja.className = estilo;
}
function f_abrir_panel(idCaja) {
var divCaja = document.getElementById(idCaja);
divCaja.style.display = '';
}
function f_cerrar_panel(idCaja) {
var divCaja = document.getElementById(idCaja);
divCaja.style.display = 'none';
}
function f_quita_imagen_adjuntada(idCampo) {
var campoFile = document.getElementById(idCampo);
campoFile.value = '';
}
function f_activa_boton_envio_externo(boton, estilo) {
var nombre_class_activo = estilo + 'activo';
var nombre_class_noactivo = estilo;
if (boton.className == nombre_class_activo) {
boton.className = nombre_class_noactivo;
}
else {
boton.className = nombre_class_activo;
}
}
function f_muestra_servicios_externos(idMensaje, activa_servicios) {
var divTextoPublicarExterno = document.getElementById("id_texto_publicar_externo_" + idMensaje);
var divEnlacePublicarTwitter = document.getElementById("id_enlace_publicar_twitter_" + idMensaje);
var divEnlacePublicarFacebook = document.getElementById("id_enlace_publicar_facebook_" + idMensaje);
if (activa_servicios) {
if (divTextoPublicarExterno) {
divTextoPublicarExterno.style.display = '';
}
if (divEnlacePublicarTwitter) {
divEnlacePublicarTwitter.style.display = '';
}
if (divEnlacePublicarFacebook) {
divEnlacePublicarFacebook.style.display = '';
}
}
else {
if (divTextoPublicarExterno) {
divTextoPublicarExterno.style.display = 'none';
}
if (divEnlacePublicarTwitter) {
divEnlacePublicarTwitter.style.display = 'none';
}
if (divEnlacePublicarFacebook) {
divEnlacePublicarFacebook.style.display = 'none';
}
}
}
function f_obtener_lista_servicios_externos_seleccionado(id) {
var servicios_externos_seleccionados = '';
var opcionTwitter = document.getElementById('id_enlace_publicar_twitter_' + id);
if (opcionTwitter) {
if (opcionTwitter.className == 'externo twitteractivo') {
servicios_externos_seleccionados = _id_servicio_externo_twitter;
}
}
var opcionFacebook = document.getElementById('id_enlace_publicar_facebook_' + id);
if (opcionFacebook) {
if (opcionFacebook.className == 'externo facebookactivo') {
if (servicios_externos_seleccionados != '') {
servicios_externos_seleccionados = servicios_externos_seleccionados + '|';
}
servicios_externos_seleccionados = servicios_externos_seleccionados + _id_servicio_externo_facebook;
}
}
return servicios_externos_seleccionados;
}
function f_pulsa_video(objeto,contenedor) {
var nombre_class_activo = 'flotante';
var nombre_class_noactivo = 'normal';
var boton_alternar = document.getElementById('alternar');
var pos_Y_original = encuentraPosY (document.getElementById('alternancia'));
if (objeto.className == nombre_class_activo) {
objeto.className = nombre_class_noactivo;
objeto.style.top = '0px';
objeto.style.left = '0px';
boton_alternar.innerHTML = 'siempre visible';
boton_alternar.className = 'alternar';
if(window.addEventListener){
document.removeEventListener('scroll', f_posiciona, false);
} else {
window.detachEvent('onscroll', f_posiciona);
}
f_alto_ventana_padre();
}
else {
objeto.className = nombre_class_activo;
if(window.addEventListener){
document.addEventListener('scroll', f_posiciona = function() {f_posiciona_video(pos_Y_original);}, false);
} else {
window.attachEvent('onscroll', f_posiciona = function() {f_posiciona_video(pos_Y_original);});
}
objeto.style.left = '-20' + 'px';
contenedor.style.height = '0';
boton_alternar.innerHTML = 'ubicación original';
boton_alternar.className = 'alternar minimizar';
f_posiciona_video(pos_Y_original);
}
}
function f_alto_ventana_padre() {
document.getElementById('libre').style.height=document.getElementById('alternancia').offsetHeight+'px';
}
function f_posiciona_video(pos_Y_original) {
var objeto = document.getElementById('alternancia');
objeto.style.top = (f_obtieneScrollY() + document.documentElement.clientHeight - objeto.offsetHeight - pos_Y_original) + 'px';
}
function f_obtieneScrollY() {
navegador = navigator.userAgent;
var scrollY = document.documentElement.scrollTop;
if ( navegador.indexOf("WebKit") != - 1 ) scrollY = document.body.scrollTop;
return(scrollY);
}
function encuentraPosY(obj) {
var curtop = 0;
if (obj.offsetParent) while(1) {
curtop += obj.offsetTop;
if (!obj.offsetParent) break;
obj = obj.offsetParent;
}
else if (obj.y) curtop += obj.y;
return curtop;
}
function f_gestionar_check_recordarme(campoCheck, idCampo) {
var campoHiddenCheck = document.getElementById(idCampo);
if (campoCheck.className == 'recordarme') {
campoCheck.className = 'recordarme activo';
campoHiddenCheck.value = '1';
}
else {
campoCheck.className = 'recordarme';
campoHiddenCheck.value = '0';
}
}
function f_cerrar_panel_aclaracion_suscripciones() {
var divPanel = document.getElementById('panel_aclaracion');
divPanel.style.display = 'none';
_mostrarPanelAclaracion = false;
}
function f_cambia_boton_recarga(idBoton, estilo, idLetrero, estilo2) {
var nombre_class_activo = estilo + ' activo';
var nombre_class_noactivo = estilo;
var letrero = document.getElementById(idLetrero);
var boton = document.getElementById(idBoton);
if (boton.className == nombre_class_activo) {
boton.className = nombre_class_noactivo;
letrero.innerHTML = 'Off';
_activarRecargaAutomatica = false;
}
else {
boton.className = nombre_class_activo;
letrero.innerHTML = 'On';
_activarRecargaAutomatica = true;
if (_hayInformacionPendiente) {
f_forzar_recarga_mensajes();
}
}
var nombre_class_activo2 = estilo2 + ' activo';
var nombre_class_noactivo2 = estilo2;
if (letrero.className == nombre_class_activo2) {
letrero.className = nombre_class_noactivo2;
}
else {
letrero.className = nombre_class_activo2;
}
}
function f_forzar_recarga_mensajes() {
recuperarInformacionMensajes();
_hayInformacionPendiente = false;
if (document.getElementById(_idContenedorRefr)) {
document.getElementById(_idContenedorRefr).style.display = 'none';
}
}
function f_ir_arriba() {
posicionarEnDivMensajes();
}
function f_muestra_panel_ayuda(tipo_tablon) {
if (_mostrarPanelAclaracion == true) {
var html = '';
if (tipo_tablon == 2) {
html = ' En este panel aparecen los mensajes de los temas a los que estés suscrito y de los contactos a los que sigues.
';
}
else {
if (tipo_tablon == 3) {
html = ' Desde este panel puedes enviar mensajes privados a cualquier usuario de ESKUP. También aquí recibes los que te envían. Una N te avisará..
';
}
else {
if (tipo_tablon == 4) {
html = ' En este panel aparecen todos los mensajes que se están escribiendo en ESKUP. Todos todos.
';
}
else {
if (tipo_tablon == 1) {
html = ' En este panel ves sólo los mensajes que tú has escrito en ESKUP.
';
}
}
}
}
if (html != '') {
html = html + ' ';
if (document.getElementById('panel_aclaracion')) {
var divPanel = document.getElementById('panel_aclaracion');
divPanel.innerHTML = html;
divPanel.style.display = '';
}
}
}
}
function f_es_valor_vacio(valor) {
nuevo_valor = valor.replace(/^(\s|\ )*|(\s|\ )*$/g,"");
if (nuevo_valor == '') {
return true;
}
else {
return false;
}
}
function f_es_longitud_correcta(mensaje) {
var valor_actual = mensaje.replace(/((https?|ftp):\/\/[\w\.\-\:/\%\~\?\#\[\]\@\!\$\&\'\(\)\*\+,;=]+)/ig, function($1) {
if ($1.length>=20) {
return '12345678901234567890';
}
return($1);
}
);
valor_actual = valor_actual.replace(/<\/?[bi]>/ig, '');
var num = valor_actual.length;
if (num > _numero_maximo_caracteres_mensaje) {
return false;
}
else {
return true;
}
}
function f_obtener_paginacion_usuarios(idUsuario, tipoUsuario, numeroUsarios, pagina) {
var html_paginacion = '';
if ( numeroUsarios == 0) {
return html_paginacion;
}
if (numeroUsarios <= _numero_maximo_usuarios_a_mostrar) {
return html_paginacion;
}
if (tipoUsuario == 1) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_seguidores_movil";
} else {
html_funcion = "javascript:f_muestra_listado_seguidores";
}
}
else {
if (tipoUsuario == 2) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_a_quien_sigo_movil";
} else {
html_funcion = "javascript:f_muestra_listado_a_quien_sigo";
}
}
else {
if (tipoUsuario == 3) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_seguidores_evento_movil";
} else {
html_funcion = "javascript:f_muestra_listado_seguidores_evento";
}
}
else {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html_funcion = "javascript:f_muestra_listado_escritores_evento_movil";
} else {
html_funcion = "javascript:f_muestra_listado_escritores_evento";
}
}
}
}
html_paginacion = html_paginacion + ' ';
var pagina_anterior = pagina - 1;
if (pagina <= 1) {
pagina_anterior = 1;
pagina = 1;
html_paginacion = html_paginacion + '<< ';
html_paginacion = html_paginacion + '< ';
}
else {
html_paginacion = html_paginacion + '<< ';
html_paginacion = html_paginacion + '< ';
}
html_paginacion = html_paginacion + '' + pagina + ' ';
numero_paginas = Math.ceil(numeroUsarios / _numero_maximo_usuarios_a_mostrar);
pagina_siguiente = pagina + 1;
if (pagina >= numero_paginas) {
pagina_siguiente = numero_paginas;
html_paginacion = html_paginacion + '> ';
}
else {
html_paginacion = html_paginacion + '> ';
}
html_paginacion = html_paginacion + ' ';
return html_paginacion;
}
function f_obtener_html_numero_usuarios_listado(numero) {
var html = '';
var str_numero = numero + '';
var numero_caracteres = str_numero.length;
if (numero_caracteres == 1) {
html = '' + numero + ' ';
}
else {
for (i=0; i' + digito + '';
}
}
return html;
}
function f_limpia_campos_formulario_evento(id) {
if (document.getElementById('campo_formulario_texto_mensaje')) {
if(document.getElementById('campo_formulario_texto_mensaje').placeholder){
document.getElementById('campo_formulario_texto_mensaje').value = '';
}else{
document.getElementById('campo_formulario_texto_mensaje').value = _texto_inicializacion_textarea;
}
document.getElementById('campo_formulario_texto_mensaje').className = 'cajareposo';
}
if (document.getElementById('secundario_campo_formulario_texto_mensaje')) {
document.getElementById('secundario_campo_formulario_texto_mensaje').className = 'secundario';
}
if (document.getElementById('m')) {
document.getElementById('m').value = '';
}
if (document.getElementById('p')) {
document.getElementById('p').value = '';
}
if (document.getElementById('adjuntarImagen') && document.getElementById('borrarImagen')){
var patt = new RegExp("oculto");
if(patt.test(document.getElementById('adjuntarImagen').className)){
document.getElementById('adjuntarImagen').classList.toggle('oculto');
}
if(!patt.test(document.getElementById('borrarImagen').className)){
document.getElementById('borrarImagen').classList.toggle('oculto');
}
}
if (document.getElementById('etiqueta_numero_maximo_caracteres') ) {
var etiqueta = document.getElementById('etiqueta_numero_maximo_caracteres');
etiqueta.innerHTML = _numero_maximo_caracteres_mensaje;
etiqueta.style.color = '';
}
if (document.getElementById('t') ) {
document.getElementById('t').value = '';
var numero_li = 0;
var panelEventos = null;
if (document.getElementById('id_eventos_para_escribir_' + id) ) {
panelEventos = document.getElementById('id_eventos_para_escribir_' + id);
numero_li = panelEventos.childNodes.length;
}
for (var i = 0; i < numero_li; i++) {
campo_li = panelEventos.childNodes[i];
clave_id = campo_li.id;
campo_li.id = '';
var campo = document.getElementById('li_' + id + '_' + clave_id);
if (campo) {
campo.className = 'nombretema';
}
}
}
if (document.getElementById('id_listausuarios')) {
var panelUsuarios = document.getElementById('id_listausuarios');
panelUsuarios.innerHTML = '';
}
if (document.getElementById('capaopciones_adjuntar_' + id)) {
var divAdjuntar = document.getElementById('capaopciones_adjuntar_' + id);
divAdjuntar.innerHTML = '';
divAdjuntar.style.display = 'none';
}
}
function f_lanza_proceso_para_borrar_temporal(idMensajeTemporal) {
if (typeof _timer_borrado_temporal != "undefined") {
clearInterval(_timer_borrado_temporal);
}
_idMensajeTemporal = idMensajeTemporal;
_timer_borrado_temporal = setInterval(f_borra_mensaje_temporal, _segsBorrarTemporal * 1000);
}
function f_borra_mensaje_temporal() {
if (typeof _timer_borrado_temporal != "undefined") {
clearInterval(_timer_borrado_temporal);
}
if (document.getElementById('provisional')) {
var idMsg = 'mensaje_' + _idMensajeTemporal;
if (document.getElementById(idMsg)) {
var divMensajeTemporal = document.getElementById('provisional');
divMensajeTemporal.removeChild(document.getElementById(idMsg));
}
}
}
function f_autentica_usuario(idCampoLogin, idCampoPasswd) {
var campoLogin = document.getElementById(idCampoLogin);
var campoPasswd = document.getElementById(idCampoPasswd);
if ( (campoLogin.value == '') || (campoPasswd.value == '') ) {
alert('Tienes que teclear usuario y contraseña');
return false;
}
var valor_usuario = campoLogin.value;
if ( valor_usuario.match(/(\w*)@(\w+)/) ) {
var formulario = document.getElementById('formulario_sesion');
formulario.submit();
}
else {
alert('El campo \'usuario\' no parece un correo electrónico. Por favor, revísalo.');
return false;
}
}
function f_comprobar_submit(evento, idFormulario) {
if (window.event) {
tecla = evento.keyCode;
src = evento.srcElement;
}
else if (evento.which) {
tecla = evento.which;
src = evento.target;
}
if (tecla == 13) {
f_autentica_usuario('cajalogin_camponombreusuario', 'cajalogin_campocontrasena');
}
}
function f_lanza_actualizacion_a_quien_sigo() {
if (typeof _timer_actualizar_aquiensigo != "undefined") {
clearInterval(_timer_actualizar_aquiensigo);
}
_timer_actualizar_aquiensigo = setInterval(f_actualiza_a_quien_sigo, _tiempoActualizarAQuienSigo * 1000);
}
function f_actualiza_a_quien_sigo() {
f_obtener_quien_sigo();
}
function f_poner_foco_campo_texto(idCampo) {
if (document.getElementById(idCampo)) {
var campo_texto = document.getElementById(idCampo);
campo_texto.focus();
}
}
function f_restablecer_boton_publicar(idBoton) {
if (document.getElementById(idBoton)) {
var divBoton = document.getElementById(idBoton);
divBoton.className = "publicar";
}
}
function f_contabiliza_peticion() {
if (_es_primera_carga == 0) {
if (typeof _quiensoy != 'undefined' && (_quiensoy == 'widget' || _quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) {
EPETtrackWidgetNewInfoFromAJAX();
if (parent.postMessage) {
parent.postMessage("{'id':'" + _identificadorWidget + "','command':'trackWidgetNewInfo','params':[]}", "*");
}
} else {
EPETtrackNewInfoFromAJAX();
}
}
}
function f_pide_publicidad() {
}
function f_contabiliza_publicacion_comentario() {
try {
parent.trackPublicarComentario();
} catch (e) {
}
if (((typeof _quiensoy != 'undefined' &&
(_quiensoy == 'widget' || _quiensoy == "comentarios" || _quiensoy == "mensajeUnico")
&& parent.postMessage))
&& (typeof _identificadorWidget !='undefined')) {
parent.postMessage("{'id':'" + _identificadorWidget + "','command':'trackWidgetNewComment','params':[]}", "*");
}
}
function f_cierra_panel_informacion_sms() {
f_cerrar_panel('id_instruccionessms');
}
function f_muestra_panel_informacion_sms(id_campo) {
var panelSMS = null;
if (document.getElementById('id_instruccionessms')) {
panelSMS = document.getElementById('id_instruccionessms');
if (document.getElementById(id_campo)) {
panelPadre = document.getElementById(id_campo);
var posicion_clave_sms = EPETUtils_calcAbsPosition(panelPadre);
panelSMS.style.left = posicion_clave_sms[0] + 'px';
panelSMS.style.top = posicion_clave_sms[1] + panelPadre.clientHeight +'px';
}
esta_visible = panelSMS.style.display;
if (esta_visible == '') {
panelSMS.style.display = 'none';
}
else {
panelSMS.style.display = '';
}
}
}
function f_muestra_panel_aviso_permisos_escritura(idMensaje) {
var panelAviso = null;
if (document.getElementById('cuidado_aclaracion')) {
panelAviso = document.getElementById('cuidado_aclaracion');
var id_campo = 'cuidado_' + idMensaje;
if (document.getElementById(id_campo)) {
panelPadre = document.getElementById(id_campo);
var posicion_clave = EPETUtils_calcAbsPositionV2(panelPadre);
panelAviso.style.left = ( posicion_clave[0] + (panelPadre.clientWidth / 2) ) - 230 +'px';
panelAviso.style.top = posicion_clave[1] - 68 + 'px';
}
esta_visible = panelAviso.style.display;
if (esta_visible == '') {
panelAviso.style.display = 'none';
}
else {
panelAviso.style.display = '';
}
}
}
function f_mostrar_caja_adjuntar_imagen(id) {
var html = "";
html = html + ' ' + _ESKUPhashMsgByLang[LANGESKUP].dinos_la_ubicacion_de_la_imagen + '
';
html = html + ' ';
html = html + ' ' + _ESKUPhashMsgByLang[LANGESKUP].borrar_imagen + ' ';
var boton_adjuntar = document.getElementById('boton_adjuntar_' + id);
var divCajaAdjuntar = document.getElementById('capaopciones_adjuntar_' + id);
if (divCajaAdjuntar.innerHTML == '') {
divCajaAdjuntar.innerHTML = html;
}
if (divCajaAdjuntar.style.display == '') {
divCajaAdjuntar.style.display = 'none';
boton_adjuntar.className = 'boton imagen';
}
else {
divCajaAdjuntar.style.display = '';
boton_adjuntar.className = 'boton imagen activo';
}
if (document.getElementById('capaopciones_destino_' + id)) {
var divCajaDestino = document.getElementById('capaopciones_destino_' + id);
divCajaDestino.style.display = 'none';
}
var boton_donde_publicar = document.getElementById('boton_donde_publicar_' + id);
if (boton_donde_publicar != null) {
boton_donde_publicar.className = 'boton temas';
}
var boton_destinatarios = document.getElementById('boton_destinatario_' + id);
if (boton_destinatarios != null) {
boton_destinatarios.className = 'boton destinatario';
}
}
function f_pinta_caja_destinatarios(idCaja) {
var html = '';
html = html + ' Fijar destinatario ';
html = html + ' ';
var boton_adjuntar = document.getElementById('boton_adjuntar_' + idCaja);
boton_adjuntar.className = 'boton imagen';
var divCajaDestino = document.getElementById('capaopciones_destino_' + idCaja);
if (divCajaDestino.innerHTML == '') {
divCajaDestino.innerHTML = html;
divCajaDestino.className = 'usuarios';
}
var boton_destinatarios = document.getElementById('boton_destinatario_' + idCaja);
if (divCajaDestino.style.display == '') {
divCajaDestino.style.display = 'none';
boton_destinatarios.className = 'boton destinatario';
}
else {
divCajaDestino.style.display = '';
boton_destinatarios.className = 'boton destinatario activo';
}
var divCajaAdjuntar = document.getElementById('capaopciones_adjuntar_' + idCaja);
divCajaAdjuntar.style.display = 'none';
}
function f_muestra_usuarios_para_enviar(lista_usuarios_tecleados) {
var numero_usuarios = lista_usuarios_tecleados.length;
if (numero_usuarios == 0) {
return true;
}
document.getElementById('nombre_usuario_para_publicar').value = '';
for (i = 0; i < numero_usuarios; i++) {
var usuario = lista_usuarios_tecleados[i];
var nick_usuario = trim(usuario.nick);
var nombrebonito_usuario = usuario.nombrebonito;
var foto_usuario = usuario.foto;
var usuario_valido = true;
if (nick_usuario == _nickname) {
usuario_valido = false;
alert('No es posible mandar privados a uno mismo');
}
else {
f_es_usuario_valido(nick_usuario);
var divCajaUL = document.getElementById('id_listausuarios');
var html_actual = divCajaUL.innerHTML;
var numero_elementos_usuario = divCajaUL.childNodes.length;
if (numero_elementos_usuario > 0) {
if (f_comprobar_existe_usuario(divCajaUL, nick_usuario) == true) {
usuario_valido = false;
}
}
}
if (usuario_valido == true) {
var cajaLI = document.createElement('li');
cajaLI.id = "li_" + nick_usuario;
cajaLI.innerHTML = '' + nick_usuario + '' + nombrebonito_usuario + ' ';
divCajaUL.appendChild(cajaLI);
divCajaUL.style.display = '';
}
}
}
function f_quita_usuarios_para_enviar(id_li) {
var cajaLI = document.getElementById(id_li);
var cajaUL = document.getElementById('id_listausuarios');
cajaUL.removeChild(cajaLI);
var numero_elementos_usuario = cajaUL.childNodes.length;
if (numero_elementos_usuario == 0) {
cajaUL.style.display = 'none';
}
}
function f_comprobar_existe_usuario(caja, nombre) {
var existe_usuario = false;
var nuevo_id = 'li_' + nombre;
numero_usuarios = caja.childNodes.length;
for (var i = 0; i < numero_usuarios; i++) {
cajaLI = caja.childNodes[i];
if (cajaLI.id == nuevo_id) {
existe_usuario = true;
}
}
return existe_usuario;
}
function f_es_usuario_valido(nombre) {
}
function f_envia() {
var mensaje_error = 'No has seleccionado ningún usuario';
var cajaUL = document.getElementById('id_listausuarios');
if (cajaUL == null) {
alert(mensaje_error);
return false;
}
if (cajaUL.childNodes == null) {
alert(mensaje_error);
return false;
}
if (cajaUL.childNodes.length == 0) {
alert(mensaje_error);
return false;
}
var numero_destinatarios = cajaUL.childNodes.length;
if (numero_destinatarios == 0) {
alert(mensaje_error);
return false;
}
var hayErrores = false;
var lista_usuarios = '';
for (var i = 0; i < numero_destinatarios; i++) {
usuario = cajaUL.childNodes[i];
clave_id = usuario.id;
id_usuario = clave_id.substring(3);
nombre_class = usuario.className;
if (nombre_class == 'invalido') {
hayErrores = true;
}
lista_usuarios = lista_usuarios + id_usuario + '|';
}
if (hayErrores == true) {
if (numero_destinatarios == 1) {
alert('El usuario al que vas a enviar el mensaje no es válido');
}
else {
alert('Hay usuarios a los que vas a enviar el mensaje que no son válidos');
}
return false;
}
var contenido_mensaje = document.getElementById('campo_formulario_texto_mensaje').value;
if ( f_es_valor_vacio(contenido_mensaje) || (contenido_mensaje == _texto_inicializacion_textarea) ) {
alert(_ESKUPhashMsgByLang[LANGESKUP].no_has_escrito_nada);
return false;
}
if ( ! f_es_longitud_correcta(contenido_mensaje) ) {
alert(_ESKUPhashMsgByLang[LANGESKUP].el_mensaje_no_puede_tener_mas_de + _numero_maximo_caracteres_mensaje + ' ' + _ESKUPhashMsgByLang[LANGESKUP].caracteres);
return false;
}
document.getElementById('m').value = contenido_mensaje;
document.getElementById('t').value = lista_usuarios;
var valor_imagen = '';
if (document.getElementById('p') ) {
valor_imagen = document.getElementById('p').value;
}
if (document.getElementById("boton_publicar")) {
document.getElementById("boton_publicar").className = "trabajando";
}
var formulario = document.getElementById('formulario_escribir');
formulario.submit();
}
function comprobarPost_mensaje_evento(idMensaje, comando, pintarMensajeNuevo) {
var i = document.getElementById("iframe_"+idMensaje);
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames["iframe_"+idMensaje].document;
}
if (d.location.href == "about:blank") {
return true;
}
if (!d.getElementById("status")) {
alert(_ESKUPhashMsgByLang[LANGESKUP].error_al_enviar_el_mensaje);
f_restablecer_boton_publicar("boton_publicar");
return false;
}
if (d.getElementById("status").innerHTML != "OK") {
msg = d.getElementById("info").innerHTML + " (Error " +d.getElementById("code").innerHTML + ")";
alert(msg);
f_restablecer_boton_publicar("boton_publicar");
return false;
}
var retorno = true;
var mensaje = _ESKUPhashMsgByLang[LANGESKUP].mensaje_enviado_correctamente;
if (d.getElementById("info").innerHTML != "") {
mensaje = d.getElementById("info").innerHTML;
alert(mensaje);
}
var quitarMensajeTemporal = false;
var hashMensajeTemporal = null;
if (pintarMensajeNuevo == 1) {
var sigoalevento = false;
var numero_eventos_seleccionados = _arrayEventosSeleccionadosParaEscribir.length;
if (numero_eventos_seleccionados > 0 ) {
for (var i=0; i < numero_eventos_seleccionados; i++) {
var id_evento_seleccionado = _arrayEventosSeleccionadosParaEscribir[i];
for (var claveEvento in _hashEventosSeguidos) {
if (id_evento_seleccionado == claveEvento) {
sigoalevento = true;
}
}
}
}
if ( (_tipoTablon == 2) && (_usuario_sigue_a_si_mismo == 0) && (sigoalevento == false) ) {
quitarMensajeTemporal = true;
}
}
else {
if (_hashDatosEvento.estado_seguimiento == 0) {
quitarMensajeTemporal = true;
}
}
hashMensajeTemporal = crearMensajeTemporal();
var htmlMensajeTemporal = pintaMensaje(hashMensajeTemporal, true);
var divContenedorMensajes = document.getElementById(_idContenedorMsgs);
var divMensajeTemporal = document.createElement('div');
divMensajeTemporal.innerHTML = htmlMensajeTemporal;
divContenedorMensajes.insertBefore(divMensajeTemporal.firstChild, divContenedorMensajes.firstChild);
if (document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"])) {
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) {
if (typeof _tipoHilo != "undefined" && _tipoHilo == "o" &&
typeof _soyOpinador != "undefined" && _soyOpinador == false) {
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].no_perteneces_al_foro + " \"" + _ESKUPhashMsgByLang[LANGESKUP].todos_los_comentarios + "\" ";
} else
if (typeof _hilo != "undefined" && esHiloPremoderado(_hilo) && !(typeof _soyOpinador != "undefined" && _soyOpinador == true)) {
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].mensaje_pendiente_moderacion;
}
} else
if ((esEventoPremoderado(_tablon)&&(typeof _soyOpinador=="undefined"|| _soyOpinador == false))) {
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].mensaje_pendiente_moderacion;
}
}
if (quitarMensajeTemporal) {
f_lanza_proceso_para_borrar_temporal(hashMensajeTemporal["idMsg"]);
}
f_restablecer_boton_publicar("boton_publicar");
f_limpia_campos_formulario_evento('msg');
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico") && (comando == "reply" || comando == "add")) {
f_contabiliza_publicacion_comentario();
}
i.src = "about:blank";
d.location.href = "about:blank";
return retorno;
}
function f_publica(tipo_publicacion, idCaja) {
if (document.getElementById("boton_publicar") &&
document.getElementById("boton_publicar").className == "trabajando") {
return false;
}
_arrayEventosSeleccionadosParaEscribir = Array();
var lista_eventos = '';
if (tipo_publicacion == 'evento') {
lista_eventos = '*' + _tablon;
_arrayEventosSeleccionadosParaEscribir[0] = _tablon;
}
else {
var panelEventos = null;
var numero_li = 0;
if ( document.getElementById('id_eventos_para_escribir_' + idCaja) ) {
panelEventos = document.getElementById('id_eventos_para_escribir_' + idCaja);
numero_li = panelEventos.childNodes.length;
}
var numero_temas_seleccionados = 0;
for (var i = 0; i < numero_li; i++) {
campo = panelEventos.childNodes[i];
clave_id = campo.id;
var estaSeleccionado = false;
id_evento = campo.id;
if (id_evento != '') {
estaSeleccionado = true;
}
if (estaSeleccionado) {
lista_eventos = lista_eventos + '*' + id_evento + '|';
_arrayEventosSeleccionadosParaEscribir[numero_temas_seleccionados] = id_evento;
numero_temas_seleccionados++;
}
}
}
var contenido_mensaje = document.getElementById('campo_formulario_texto_mensaje').value;
if ( f_es_valor_vacio(contenido_mensaje) || (contenido_mensaje == _texto_inicializacion_textarea) ) {
alert(_ESKUPhashMsgByLang[LANGESKUP].no_has_escrito_nada);
return false;
}
if ( ! f_es_longitud_correcta(contenido_mensaje) ) {
alert(_ESKUPhashMsgByLang[LANGESKUP].el_mensaje_no_puede_tener_mas_de + _numero_maximo_caracteres_mensaje + ' ' + _ESKUPhashMsgByLang[LANGESKUP].caracteres);
return false;
}
document.getElementById('m').value = contenido_mensaje;
document.getElementById('t').value = lista_eventos;
var lista_servicios_externos = f_obtener_lista_servicios_externos_seleccionado('');
document.getElementById('d').value = lista_servicios_externos;
var valor_imagen = '';
if (document.getElementById('p') ) {
valor_imagen = document.getElementById('p').value;
}
if (document.getElementById("boton_publicar")) {
document.getElementById("boton_publicar").className = "trabajando";
}
var formulario = document.getElementById('formulario_escribir');
formulario.submit();
}
function f_activa_caja_escribir(idCampo, texto_inicial) {
var campo = document.getElementById(idCampo);
var valor_actual = campo.value;
if (valor_actual == texto_inicial) {
campo.value = '';
}
campo.className = 'cajaactiva';
if (document.getElementById('secundario_' + idCampo)) {
var campoSecundario = document.getElementById('secundario_' + idCampo);
campoSecundario.className = 'secundario activo';
}
f_poner_foco_campo_texto(idCampo);
}
function f_inicia_caja_escribir(idCampo, texto, estiloCaja, estiloCampoCaracteres,modo) {
var campo = document.getElementById(idCampo);
campo.className = estiloCaja;
if(campo.placeholder && typeof modo == 'undefined' ){
campo.placeholder = texto;
campo.value = '';
}else{
campo.value = texto;
}
if (document.getElementById('secundario_' + idCampo)) {
var campoSecundario = document.getElementById('secundario_' + idCampo);
campoSecundario.className = estiloCampoCaracteres;
}
}
function f_tecleando(evento, idCampo, idEtiqueta) {
var valorReturn = true;
var evtobj = window.event ? event : evento;
if (evtobj.type == "keyup" || evtobj.type == "keydown" || evtobj.type == "keypress" ) {
var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode;
var actualkey=String.fromCharCode(unicode);
if (evtobj.ctrlKey) {
if (actualkey == 'b' || actualkey == 'B' || actualkey == 'n' || actualkey == 'N' || actualkey == 'i' || actualkey == 'I') {
if (evtobj.type == "keyup") {
insertaTagEnMensaje(idCampo, actualkey.toLowerCase());
}
evtobj.returnValue = false;
evtobj.cancelBubble = true;
if (evtobj.stopPropagation) evtobj.stopPropagation();
valorReturn = false;
}
}
}
var campo = document.getElementById(idCampo);
var valor_actual = campo.value;
valor_actual = valor_actual.replace(/((https?|ftp):\/\/[\w\.\-\:/\%\~\?\#\[\]\@\!\$\&\'\(\)\*\+,;=]+)/ig, function($1) {
if ($1.length>=20) {
return '12345678901234567890';
}
return($1);
}
);
valor_actual = valor_actual.replace(/<\/?[bi]>/ig, '');
valor_actual = valor_actual.replace(/<\/?div( )?(class=["\']?[^\'"]*["\']?)?>/ig, '');
var len_actual = valor_actual.length;
diferencia = _numero_maximo_caracteres_mensaje - len_actual;
var color_texto = '';
if (diferencia >= 140) {
color_texto = '';
}
else {
if ( (diferencia >= 20) && (diferencia < 140) ) {
color_texto = '#b64924';
}
else {
if ( (diferencia > 0) && (diferencia < 20) ) {
color_texto = '#f80000';
}
else {
color_texto = '#bebebe';
}
}
}
var etiqueta = document.getElementById(idEtiqueta);
etiqueta.innerHTML = diferencia;
etiqueta.style.color = color_texto;
return valorReturn;
}
function insertaTagEnMensaje(idTextarea, queTag) {
if (typeof idTextarea == "undefined") {
return false;
}
if (queTag == 'n') {
queTag = 'b';
}
if (document.getElementById(idTextarea).className == 'cajareposo') {
f_inicia_caja_escribir(idTextarea, '', 'cajaactiva', 'secundario activo');
}
if (isIE && isIE < 9) {
var userSelection;
if (window.getSelection) {
userSelection = window.getSelection();
} else if (document.selection) {
userSelection = document.selection.createRange();
}
if (userSelection.parentElement().id == idTextarea) {
userSelection.text = "<" + queTag + ">" + userSelection.text + "" + queTag + ">";
userSelection.collapse(true);
userSelection.select();
} else {
document.getElementById(idTextarea).value += "<" + queTag + ">" + queTag + ">";
var range = document.getElementById(idTextarea).createTextRange();
range.collapse(true);
range.moveEnd('character', (document.getElementById(idTextarea).value.length-4));
range.moveStart('character', (document.getElementById(idTextarea).value.length-4));
range.select();
}
setTimeout('document.getElementById("'+idTextarea+'").focus()',100);
} else {
scrollAnterior = (document.getElementById(idTextarea).scrollTop);
textoCompleto = document.getElementById(idTextarea).value;
textoAnterior = textoCompleto;
inicioSele = document.getElementById(idTextarea).selectionStart;
finSele = document.getElementById(idTextarea).selectionEnd;
if ( (textoCompleto.substring(finSele-1,finSele)) == " ") finSele--;
if ( (textoCompleto.substring(inicioSele,inicioSele+1)) == " ") inicioSele++;
textoSeleccionado = textoCompleto.substring(inicioSele,finSele);
nuevoTexto = textoCompleto.substring(0,inicioSele) + "<" + queTag + ">" +
textoSeleccionado + "" + queTag + ">" + textoCompleto.substring(finSele,textoCompleto.length);
document.getElementById(idTextarea).value = nuevoTexto;
longitudTag = ( ( queTag.length + 2 ) * 2 ) + 1;
document.getElementById(idTextarea).scrollTop = scrollAnterior;
setTimeout('document.getElementById("'+idTextarea+'").focus()',100);
setTimeout('document.getElementById("'+idTextarea+'").setSelectionRange(finSele+longitudTag,finSele+longitudTag);',200);
}
}
function f_obtener_eventos_seguidos(idCaja) {
var cadena_params = "action=list_eventos";
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
if (_obtenidasSuscripciones == true) {
f_pinta_caja_eventos_seguidos_usuario(idCaja);
}
else {
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
_obtenidasSuscripciones = false;
} else {
_obtenidasSuscripciones = true;
var _hashTMP = Array();
var data = httpRequest.responseText;
eval("_hashTMP = " + data);
_hashEventosSeguidos = _hashTMP.perfilesEventos;
_numeroEventosSeguidos = _hashTMP.numeroEventos;
}
f_pinta_caja_eventos_seguidos_usuario(idCaja);
}, _urlESKUP + "&" + cadena_params);
}
}
function f_cerrar_ventana_listado_para_escribir(idTelon, idContenedor, idCaja) {
var divTelon = document.getElementById(idTelon);
var divCapaFlotante = document.getElementById(idContenedor);
divTelon.style.display = 'none';
divCapaFlotante.style.display = 'none';
if (_datosEventosParaEscribirModificados == true) {
f_obtener_eventos_para_escribir(idCaja, true, false);
}
_datosEventosParaEscribirModificados = false;
}
function f_marca_tema_para_borrar(id) {
var divTema = document.getElementById(id);
if (divTema.className == 'nombretema') {
divTema.className = 'nombretema activo';
divTema.title = 'Dejar de escribir en el tema';
}
else {
divTema.className = 'nombretema';
divTema.title = 'Pulsa para poder escribir en el tema';
}
}
function f_marca_tema_para_borrar_en_listado(idEvento, tipo_suscripcion) {
if (tipo_suscripcion == '0') {
var ret = confirm('El tema no tiene suscripción. Si dejas de escribir en él, necesitarás autorización para volver a escribir. ¿Quieres dejar de escribir en él de todas formas?');
if (ret == false) {
f_mostrar_menu_botones('escribir_evento', 'off', idEvento);
return false;
}
}
else {
if (tipo_suscripcion == '2') {
var ret = confirm('El tema es de participación restringida. Si dejas de escribir en él, necesitarás autorización para volver a escribir. ¿Quieres dejar de escribir en él de todas formas?');
if (ret == false) {
f_mostrar_menu_botones('escribir_evento', 'off', idEvento);
return false;
}
}
else {
}
}
f_peticion_quitar_evento_de_escribir(idEvento);
}
function f_peticion_quitar_evento_de_escribir(idEvento) {
var cadena_params = 'action=del_writers&user=' + _nickname + '&data=' + idEvento;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert(_ESKUPhashMsgByLang[LANGESKUP].error_al_realizar_la_operacion);
}
else {
var data = httpRequest.responseText;
var html_botones_menu_escribir = f_componer_html_botones_menu_escribir_evento(false, idEvento, 0);
var divBotonesTema = document.getElementById('id_menu_botones_escribir_' + idEvento);
divBotonesTema.innerHTML = html_botones_menu_escribir;
if (_hashEventosParaEscribir[idEvento]) {
delete _hashEventosParaEscribir[idEvento];
_numeroEventosParaEscribir--;
}
_datosEventosParaEscribirModificados = true;
var divTemasEscritos = document.getElementById('id_numero_temas_escritos');
divTemasEscritos.innerHTML = _numeroEventosParaEscribir;
}
}, _urlESKUP + "&" + cadena_params);
}
function f_actualizar_eventos_para_escribir(idCaja) {
var str_eventos_para_quitar = '';
var listaEventos = _hashEventosParaEscribir;
for (var codigoEvento in listaEventos) {
var lh_datos_evento = listaEventos[codigoEvento];
nombre = lh_datos_evento['nombre'];
var elemento = document.getElementById('id_' + codigoEvento);
if ( (elemento.className == 'nombretema') && (elemento.style.display == '') ) {
if (str_eventos_para_quitar != '') {
str_eventos_para_quitar = str_eventos_para_quitar + ',';
}
str_eventos_para_quitar = str_eventos_para_quitar + codigoEvento;
}
}
if (str_eventos_para_quitar != '') {
var cadena_params = 'action=del_writers&user=' + _nickname + '&data=' + str_eventos_para_quitar;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
var divError = document.getElementById('capainfo_error');
divError.style.display = '';
}
else {
var data = httpRequest.responseText;
var divOK = document.getElementById('capainfo_ok');
divOK.style.display = '';
var lista_eventos_para_quitar = str_eventos_para_quitar.split(/,/);
for (var i = 0; i < lista_eventos_para_quitar.length; i++) {
var claveEvento = lista_eventos_para_quitar[i];
var elemento = document.getElementById('id_' + claveEvento);
elemento.style.display = 'none';
if (_hashEventosParaEscribir[claveEvento]) {
delete _hashEventosParaEscribir[claveEvento];
_numeroEventosParaEscribir--;
}
}
_datosEventosParaEscribirModificados = true;
var divTemasEscritos = document.getElementById('id_numero_temas_escritos');
divTemasEscritos.innerHTML = _numeroEventosParaEscribir;
f_editar_listado_temas_para_escribir(idCaja);
}
}, _urlESKUP + "&" + cadena_params);
}
}
function f_editar_listado_temas_para_escribir(idCaja) {
var html_listado_temas = f_obtener_html_listado_temas_para_escribir(idCaja, _hashEventosParaEscribir);
var numero_temas = _numeroEventosParaEscribir;
var html = '';
html = html + '';
html = html + '
';
html = html + '
';
var divTelon = document.getElementById('id_telon');
var divCapaFlotante = document.getElementById('id_contenedorCapaFlotante');
divCapaFlotante.innerHTML = html;
var idContenedorReferencia = 'mensaje_' + idCaja;
if ( document.getElementById(idContenedorReferencia) ) {
var divContenedorReferencia = document.getElementById(idContenedorReferencia);
var posDivEnlaces = EPETUtils_calcAbsPositionV2(divContenedorReferencia);
divCapaFlotante.style.left = parseInt(posDivEnlaces[0] - 200) + "px";
divCapaFlotante.style.top = parseInt(posDivEnlaces[1]) + "px";
}
else {
divCapaFlotante.style.left = "0px";
divCapaFlotante.style.top = "0px";
}
divTelon.style.display = '';
divCapaFlotante.style.display = '';
}
function f_existe_usuario_en_lista(idUsuario, listaUsuarios) {
var numero_usuarios = listaUsuarios.length;
for (var i=0; i < numero_usuarios; i++) {
usuario = listaUsuarios[i];
if (idUsuario == usuario) {
return true;
}
}
return false;
}
function f_obtener_html_listado_temas_para_escribir(idCaja, listaEventos) {
var html = '';
var html_elementos = '';
var numero_temas = 0;
for (var nombreEvento in listaEventos) {
var lh_datos_evento = listaEventos[nombreEvento];
numero_temas++;
descripcion = lh_datos_evento['descripcion'];
nombre = lh_datos_evento['nombre'];
activo = lh_datos_evento['activo'];
tipo_suscripcion = lh_datos_evento['tipo_suscripcion'];
var listaPropietarios = Array();
if (lh_datos_evento['prop']) {
listaPropietarios = lh_datos_evento['prop'];
}
var listaAdministradores = Array();
if (lh_datos_evento['adm']) {
listaAdministradores = lh_datos_evento['adm'];
}
var es_propietario = f_existe_usuario_en_lista(_nickname, listaPropietarios);
var es_administrador = f_existe_usuario_en_lista(_nickname, listaAdministradores);
var path_foto = '';
if (lh_datos_evento['pathfoto']) {
path_foto = lh_datos_evento['pathfoto'];
}
else {
path_foto = _url_imagen_por_defecto;
}
var html_cerrado = '';
var marca_suscripcion = '0';
var html_estilo_activo = ' activo';
var texto_evento_activo = 'Dejar de escribir en el tema';
var js_elemento = 'javascript:f_marca_tema_para_borrar(\'id_' + nombreEvento + '\');';
if (! activo) {
html_cerrado = html_cerrado + 'Tema cerrado ';
texto_evento_activo = 'Pulsa para poder escribir en el tema';
}
if (tipo_suscripcion == 2) {
html_cerrado = html_cerrado + ' Tema de participación restringida ';
marca_suscripcion = '2';
}
if (tipo_suscripcion == '0') {
html_cerrado = html_cerrado + ' Tema sin suscripción ';
marca_suscripcion = '0';
}
if (tipo_suscripcion == '1') {
marca_suscripcion = '1';
}
if (es_propietario == true) {
html_cerrado = html_cerrado + ' Propietario del tema ';
js_elemento = 'javascript:void(0);';
}
if (es_administrador == true) {
html_cerrado = html_cerrado + ' Administrador del tema ';
js_elemento = 'javascript:void(0);';
}
var html_elemento = '';
html_elemento = html_elemento + '';
html_elemento = html_elemento + ' ';
html_elemento = html_elemento + '' + nombreEvento + ' ';
html_elemento = html_elemento + html_cerrado;
html_elemento = html_elemento + ' ';
html_elemento = html_elemento + ' ';
html_elementos = html_elementos + html_elemento;
}
if (numero_temas == 0) {
html = html + ' No tienes ningún tema donde puedes escribir ';
}
else {
html = html + ' Estás apuntado para escribir en ' + numero_temas + ' tema';
if (numero_temas > 1) {
html = html + 's';
}
html = html + ' ';
html = html + ' ';
html = html + '
Haz clic en los temas que quieras eliminar de la lista y pulsa en "Guardar cambios ".
';
html = html + '
';
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + html_elementos;
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + ' ';
html = html + '
Guardar cambios ';
html = html + '
';
html = html + '
';
html = html + '
La operación se ha realizado con éxito.
';
html = html + '
Aceptar ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
Lo sentimos. Ha ocurrido un error. Por favor, inténtalo de nuevo más tarde.
';
html = html + '
Aceptar ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
}
return html;
}
function f_obtener_eventos_para_escribir(idCaja, abrirForzado, marcaTemasSuscritos) {
var cadena_params = "action=list_writers";
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
if (_obtenidosEventosParaEscribir == true) {
f_pinta_caja_donde_publicar(idCaja, abrirForzado, marcaTemasSuscritos);
}
else {
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se han podido obtener los temas para escribir");
_obtenidosEventosParaEscribir = false;
} else {
_obtenidosEventosParaEscribir = true;
var _hashTMP = Array();
var data = httpRequest.responseText;
eval("_hashTMP = " + data);
_hashEventosParaEscribir = _hashTMP.perfilesEventos;
_numeroEventosParaEscribir = _hashTMP.numeroUsuarios;
}
f_pinta_caja_donde_publicar(idCaja, abrirForzado, marcaTemasSuscritos);
}, _urlESKUP + "&" + cadena_params);
}
}
function f_marcar_imagen_para_borrar(idMensaje) {
if (document.getElementById('boton_borrar_adjunto_' + idMensaje)) {
var botonBorrarImagen = document.getElementById('boton_borrar_adjunto_' + idMensaje);
if (botonBorrarImagen.className == 'boton') {
botonBorrarImagen.className = 'boton eliminada';
var campoFormularioBorrarImagen = document.getElementById('rp_' + idMensaje);
campoFormularioBorrarImagen.value = 1;
}
else {
botonBorrarImagen.className = 'boton';
var campoFormularioBorrarImagen = document.getElementById('rp_' + idMensaje);
campoFormularioBorrarImagen.value = 0;
}
}
}
function f_obtener_eventos_para_escribir_en_respuesta(idMensaje, datosTablonesMensajes) {
var cadena_params = "action=list_writers";
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
var lista_eventos_mensaje = Array();
if (datosTablonesMensajes != '') {
lista_eventos_mensaje = datosTablonesMensajes.split(/,/);
}
var noMostrarAviso = false;
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
noMostrarAviso = true;
}
if (typeof _quiensoy != 'undefined' && _quiensoy == 'widget') {
noMostrarAviso = true;
}
if (typeof _enMensajeUnico != 'undefined' && _enMensajeUnico == true) {
noMostrarAviso = true;
}
if (_obtenidosEventosParaEscribir == true) {
f_comprobar_permisos_escritura(idMensaje, _hashEventosParaEscribir, lista_eventos_mensaje, noMostrarAviso);
}
else {
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert("No se han podido obtener los eventos para escribir");
_obtenidosEventosParaEscribir = false;
} else {
_obtenidosEventosParaEscribir = true;
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
_hashEventosParaEscribir = hashTMP.perfilesEventos;
_numeroEventosParaEscribir = hashTMP.numeroUsuarios;
}
f_comprobar_permisos_escritura(idMensaje, _hashEventosParaEscribir, lista_eventos_mensaje, noMostrarAviso);
}, _urlESKUP + "&" + cadena_params);
}
}
function asignarTablonesDestino_DEPRECATED(idMensaje) {
if (document.getElementById("t_" + idMensaje).value != "") {
var avisoPermisosEscritura = false;
var arrayTablonesDestino = document.getElementById("t_" + idMensaje).value.split(/,/);
var strTablonesDestino = "";
for (var contTab = 0; contTab != arrayTablonesDestino.length; contTab++) {
var strTablon = arrayTablonesDestino[contTab].substring(3);
var nombreTablon = arrayTablonesDestino[contTab];
if (typeof _hashEventosParaEscribir[strTablon] != "undefined" &&
arrayTablonesDestino[contTab].search("ev-") != -1) {
strTablonesDestino += "*" + strTablon + "|";
}
else {
if (nombreTablon.search(/t(1|4)-/) != -1) {
}
else {
avisoPermisosEscritura = true;
}
}
}
if (avisoPermisosEscritura == true && document.getElementById("cuidado_" + idMensaje)) {
var iconoAviso = document.getElementById("cuidado_" + idMensaje);
iconoAviso.style.display = '';
}
strTablonesDestino = strTablonesDestino.substr(0, (strTablonesDestino.length-1));
document.getElementById("t_" + idMensaje).value = strTablonesDestino;
}
}
function f_comprobar_permisos_escritura(idMensaje, lista_eventos_para_escribir, lista_eventos_mensaje, forzarNoMostrarAviso) {
if (typeof forzarNoMostrarAviso == "undefined") {
forzarNoMostrarAviso = false;
}
var lista_eventos_sin_permisos = Array();
var avisoPermisosEscritura = false;
var indice_eventos_sin_permisos = 0;
var strEventosSinPermisos = '';
var strEventosSinSuscripcion = '';
var strEventosConSuscripcionCondicionada = '';
var strEventosConPermisos = '';
for (var i = 0; i != lista_eventos_mensaje.length; i++) {
var nombreEvento = lista_eventos_mensaje[i];
if (nombreEvento.search(/t(1|4)-/) != -1) {
}
else {
var idEvento = nombreEvento.substring(3);
if (lista_eventos_para_escribir[idEvento]) {
strEventosConPermisos += idEvento + ',';
}
else {
var tipo_suscripcion_evento = 1;
if (_hashMsgs.perfilesEventos[idEvento]) {
tipo_suscripcion_evento = _hashMsgs.perfilesEventos[idEvento].tipo_suscripcion;
}
if (tipo_suscripcion_evento == 1) {
lista_eventos_sin_permisos[indice_eventos_sin_permisos] = idEvento;
indice_eventos_sin_permisos++;
avisoPermisosEscritura = true;
strEventosSinPermisos += idEvento + ',';
}
else {
if (tipo_suscripcion_evento == 2) {
strEventosConSuscripcionCondicionada += idEvento + ',';
avisoPermisosEscritura = true;
}
else {
strEventosSinSuscripcion += idEvento + ',';
avisoPermisosEscritura = true;
}
}
}
}
}
var html = '';
if (avisoPermisosEscritura == false || forzarNoMostrarAviso == true) {
f_continuar_responder(idMensaje, strEventosConPermisos);
}
else {
if (strEventosSinPermisos != '') {
html = html + '
';
html = html + ' Tu respuesta no aparecerá en los siguientes temas a los que pertenece este mensaje ';
html = html + ' porque no estás apuntado para escribir en ellos. ';
if (typeof _quitaEnlacesEskup == 'undefined' || _quitaEnlacesEskup!='1'){
html = html +'Más información »
';
}
html = html + ' ';
for (var i = 0; i != indice_eventos_sin_permisos; i++) {
var claveTema = lista_eventos_sin_permisos[i];
var nombreTema = _hashMsgs.perfilesEventos[claveTema].nombre;
if (typeof _quitaEnlacesEskup == 'undefined' || _quitaEnlacesEskup!='1'){
html = html + ' ' + nombreTema + ' ';
}else{
html = html + ' '+ nombreTema + ' ';
}
}
html = html + ' ';
html = html + ' ¿ Quieres que te apuntemos automáticamente ?
';
html = html + ' Sí ';
html = html + ' No ';
html = html + '
';
var divInfoEvento = document.getElementById('capainfo_' + idMensaje);
divInfoEvento.className = 'capainfo';
divInfoEvento.innerHTML = html;
divInfoEvento.style.display = '';
}
else {
f_continuar_sin_suscribir(idMensaje, strEventosSinPermisos, strEventosConPermisos, strEventosSinSuscripcion, strEventosConSuscripcionCondicionada);
}
}
}
function f_mostrar_eventos_donde_publicar(idCaja) {
var valor_accion = '';
if (document.getElementById('c_' + idCaja)) {
valor_accion = document.getElementById('c_' + idCaja).value;
}
var marcar_eventos = false;
if (valor_accion == 'reply') {
marcar_eventos = true;
}
else {
marcar_eventos = false;
}
f_obtener_eventos_para_escribir(idCaja, false, marcar_eventos);
}
function f_mostrar_ocultar_panel_eventos_donde_publicar(idMensaje, mostrar_boton) {
var estilo = '';
if (mostrar_boton == true) {
estilo = '';
}
else {
estilo = 'none';
}
if (document.getElementById('boton_donde_publicar_' + idMensaje)) {
document.getElementById('boton_donde_publicar_' + idMensaje).style.display = estilo;
document.getElementById('boton_donde_publicar_' + idMensaje).className = 'boton temas';
}
if (document.getElementById('capaopciones_destino_' + idMensaje)) {
document.getElementById('capaopciones_destino_' + idMensaje).style.display = 'none';
}
}
function f_mostrar_ocultar_panel_avisos_responder(idMensaje, mostrar_panel) {
if (document.getElementById('capainfo_' + idMensaje)) {
var divInfoEvento = document.getElementById('capainfo_' + idMensaje);
if (mostrar_panel == true) {
divInfoEvento.style.display = '';
}
else {
divInfoEvento.style.display = 'none';
}
}
}
function f_obtener_cadena_destino_tablones(str_tablones) {
var cadena_destino = '';
var lista_tablones = Array();
if (str_tablones != '') {
lista_tablones = str_tablones.split(/,/);
}
for (var i = 0; i < lista_tablones.length; i++) {
var claveTablon = lista_tablones[i];
if (claveTablon != '') {
if (i != 0) {
cadena_destino += "|";
}
cadena_destino += "*" + claveTablon;
}
}
return cadena_destino;
}
function f_continuar_responder(idMensaje, str_tablones) {
f_mostrar_ocultar_panel_avisos_responder(idMensaje, false);
document.getElementById("t_" + idMensaje).value = f_obtener_cadena_destino_tablones(str_tablones);
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
divContenedorFormularioMensaje.style.display = '';
}
function f_continuar_sin_suscribir(idMensaje, str_eventos_sin_permisos, str_eventos_con_permisos, str_eventos_sin_suscripcion, str_eventos_suscripcion_condicionada) {
var html = '';
var lista_eventos_suscritos = Array();
if (str_eventos_con_permisos != '') {
lista_eventos_suscritos = str_eventos_con_permisos.split(/,/);
}
html = html + '
';
html = html + ' Tu respuesta sólo aparecerá en los siguientes temas
';
html = html + ' ';
html = html + ' Mis mensajes ';
for (var i = 0; i < lista_eventos_suscritos.length; i++) {
var claveTema = lista_eventos_suscritos[i];
if (claveTema != '') {
var nombreTema = _hashMsgs.perfilesEventos[claveTema].nombre;
html = html + ' ' + nombreTema + ' ';
}
}
html = html + ' ';
if (str_eventos_sin_permisos != '') {
var lista_eventos_sin_permisos = str_eventos_sin_permisos.split(/,/);
html = html + ' No aparecerá en los siguientes temas porque no quieres suscribirte:
';
html = html + ' ';
for (var i = 0; i < lista_eventos_sin_permisos.length; i++) {
var claveTema = lista_eventos_sin_permisos[i];
if (claveTema != '') {
var nombreTema = _hashMsgs.perfilesEventos[claveTema].nombre;
html = html + ' ' + nombreTema + ' ';
}
}
html = html + ' ';
}
if (str_eventos_sin_suscripcion != '') {
var lista_eventos_sin_sucripcion = str_eventos_sin_suscripcion.split(/,/);
html = html + ' No aparecerá en los siguientes temas porque no tienen permitida la suscripción:
';
html = html + ' ';
for (var i = 0; i < lista_eventos_sin_sucripcion.length; i++) {
var claveTema = lista_eventos_sin_sucripcion[i];
if (claveTema != '') {
var nombreTema = _hashMsgs.perfilesEventos[claveTema].nombre;
html = html + ' ' + nombreTema + ' ';
}
}
html = html + ' ';
}
if (str_eventos_suscripcion_condicionada != '') {
var lista_eventos_sucripcion_condicionada = str_eventos_suscripcion_condicionada.split(/,/);
html = html + ' No aparecerá en los siguientes temas porque la suscripción requiere una aprobación
';
html = html + ' ';
for (var i = 0; i < lista_eventos_sucripcion_condicionada.length; i++) {
var claveTema = lista_eventos_sucripcion_condicionada[i];
if (claveTema != '') {
var nombreTema = _hashMsgs.perfilesEventos[claveTema].nombre;
html = html + ' ' + nombreTema + ' ';
}
}
html = html + ' ';
}
html = html + ' Continuar ';
html = html + '
';
var divInfoEvento = document.getElementById('capainfo_' + idMensaje);
divInfoEvento.className = 'capainfo';
divInfoEvento.innerHTML = html;
divInfoEvento.style.display = '';
}
function f_continuar_y_suscribir(idMensaje, str_eventos_sin_permisos, str_eventos_con_permisos, str_eventos_sin_suscripcion, str_eventos_suscripcion_condicionada) {
var html = '';
var estilo_div = '';
var cadena_params = 'action=add_writers&user=' + _nickname + '&data=' + str_eventos_sin_permisos;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
muestra_resultado_suscribir_eventos(0, idMensaje, str_eventos_sin_permisos, str_eventos_con_permisos, str_eventos_sin_suscripcion, str_eventos_suscripcion_condicionada);
}
else {
var data = httpRequest.responseText;
cadena_params = "action=list_writers";
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
EPETUtils_makeHttpRequestGet(function(httpRequest) {
var resultado = 1;
var str_eventos_con_error = '';
var str_eventos_suscritos = str_eventos_con_permisos;
if (httpRequest.status != 200) {
_obtenidosEventosParaEscribir = false;
}
else {
_obtenidosEventosParaEscribir = true;
var _hashTMP = Array();
var data = httpRequest.responseText;
eval("_hashTMP = " + data);
_hashEventosParaEscribir = _hashTMP.perfilesEventos;
_numeroEventosParaEscribir = _hashTMP.numeroUsuarios;
var lista_eventos_para_suscribir = str_eventos_sin_permisos.split(/,/);
for (var i = 0; i < lista_eventos_para_suscribir.length; i++) {
var claveEvento = lista_eventos_para_suscribir[i];
if (claveEvento != '') {
if (! _hashEventosParaEscribir[claveEvento]) {
resultado = 2;
str_eventos_con_error += claveEvento + ',';
}
else {
str_eventos_suscritos += claveEvento + ',';
}
}
}
}
muestra_resultado_suscribir_eventos(resultado, idMensaje, str_eventos_con_error, str_eventos_suscritos, str_eventos_sin_suscripcion, str_eventos_suscripcion_condicionada);
}, _urlESKUP + "&" + cadena_params);
}
}, _urlESKUP + "&" + cadena_params);
}
function muestra_resultado_suscribir_eventos(tipo_resultado_suscripcion, idMensaje, str_eventos_sin_permisos, str_eventos_con_permisos, str_eventos_sin_suscripcion, str_eventos_suscripcion_condicionada) {
var html = '';
var lista_eventos_error = Array();
var lista_eventos_suscritos = Array();
var lista_eventos_para_suscribir = Array();
if (str_eventos_sin_permisos != '') {
lista_eventos_para_suscribir = str_eventos_sin_permisos.split(/,/);
}
if (str_eventos_con_permisos != '') {
lista_eventos_suscritos = str_eventos_con_permisos.split(/,/);
}
var html_sin_suscripcion = '';
if (str_eventos_sin_suscripcion != '') {
var lista_eventos_sin_sucripcion = str_eventos_sin_suscripcion.split(/,/);
html_sin_suscripcion = html_sin_suscripcion + ' Tu respuesta no aparecerá en los siguientes temas porque no tienen permitida la suscripción:
';
html_sin_suscripcion = html_sin_suscripcion + ' ';
for (var i = 0; i < lista_eventos_sin_sucripcion.length; i++) {
var claveTema = lista_eventos_sin_sucripcion[i];
if (claveTema != '') {
var nombreTema = _hashMsgs.perfilesEventos[claveTema].nombre;
html_sin_suscripcion = html_sin_suscripcion + ' ' + nombreTema + ' ';
}
}
html_sin_suscripcion = html_sin_suscripcion + ' ';
}
var html_suscripcion_condicionada = '';
if (str_eventos_suscripcion_condicionada != '') {
var lista_eventos_sucripcion_condicionada = str_eventos_suscripcion_condicionada.split(/,/);
html_suscripcion_condicionada = html_suscripcion_condicionada + ' Tu respuesta no aparecerá en los siguientes temas porque la suscripción requiere una aprobación
';
html_suscripcion_condicionada = html_suscripcion_condicionada + ' ';
for (var i = 0; i < lista_eventos_sucripcion_condicionada.length; i++) {
var claveTema = lista_eventos_sucripcion_condicionada[i];
if (claveTema != '') {
var nombreTema = _hashMsgs.perfilesEventos[claveTema].nombre;
html_suscripcion_condicionada = html_suscripcion_condicionada + ' ' + nombreTema + ' ';
}
}
html_suscripcion_condicionada = html_suscripcion_condicionada + ' ';
}
if (tipo_resultado_suscripcion == 0) {
html = html + ' Se ha producido un error en la petición.
';
html = html + ' Pulsa \'Reintentar\' para intentarlo de nuevo o pulsa \'Continuar\' para responder el mensaje.
';
html = html + ' Reintentar ';
html = html + ' Continuar ';
html = html + '
';
estilo_div = 'capainfo algunerror';
}
else {
if (tipo_resultado_suscripcion == 1) {
html = html + ' Ya estás apuntado para escribir en todos los temas a los que pertenece el mensaje.
';
html = html + html_sin_suscripcion;
html = html + html_suscripcion_condicionada;
html = html + ' Continuar ';
html = html + '
';
estilo_div = 'capainfo todocorrecto';
}
else {
lista_eventos_error = lista_eventos_para_suscribir;
html = html + ' No hemos podido apuntarte en:
';
html = html + ' ';
for (var i = 0; i < lista_eventos_error.length; i++) {
var claveTema = lista_eventos_error[i];
if (claveTema != '') {
var nombreTema =_hashMsgs.perfilesEventos[claveTema].nombre;
html = html + ' ' + nombreTema + ' ';
}
}
html = html + ' ';
html = html + ' Tu respuesta aparecerá en:
';
html = html + ' ';
html = html + ' Mis mensajes ';
for (var i = 0; i < lista_eventos_suscritos.length; i++) {
var claveTema = lista_eventos_suscritos[i];
if (claveTema != '') {
var nombreTema =_hashMsgs.perfilesEventos[claveTema].nombre;
html = html + ' ' + nombreTema + ' ';
}
}
html = html + ' ';
html = html + html_sin_suscripcion;
html = html + html_suscripcion_condicionada;
html = html + ' Continuar ';
html = html + '
';
estilo_div = 'capainfo algunerror';
}
}
var divInfoEvento = document.getElementById('capainfo_' + idMensaje);
divInfoEvento.className = estilo_div;
divInfoEvento.innerHTML = html;
divInfoEvento.style.display = '';
}
function f_marca_elemento(id, idPadre, estiloActivo, estiloNoActivo) {
var campo = document.getElementById('li_' + id);
var padre_campo = campo.parentNode;
if (campo.className == estiloActivo) {
campo.className = estiloNoActivo;
padre_campo.id = idPadre;
}
else {
campo.className = estiloActivo;
padre_campo.id = '';
}
}
function f_pinta_caja_donde_publicar(idCaja, abrirForzado, marcaTemasSuscritos) {
var divCajaAdjuntar = document.getElementById('capaopciones_adjuntar_' + idCaja);
divCajaAdjuntar.style.display = 'none';
var strListaTemasMensaje = '';
if (document.getElementById('tm_' + idCaja)) {
strListaTemasMensaje = document.getElementById('tm_' + idCaja).value;
}
var listaTemasMensaje = Array();
if ( (strListaTemasMensaje != '') && (marcaTemasSuscritos) ) {
var arrayTemasMensaje = strListaTemasMensaje.split(/,/);
for (var i = 0; i < arrayTemasMensaje.length; i++) {
var claveTema = arrayTemasMensaje[i];
listaTemasMensaje[claveTema] = 1;
}
}
var html_lista_eventos = '';
var id_campo_ul = '';
var numero_eventos = 0;
for (var nombreEvento in _hashEventosParaEscribir) {
var lh_datos_evento = _hashEventosParaEscribir[nombreEvento];
numero_eventos++;
descripcion = lh_datos_evento['descripcion'];
nombre = lh_datos_evento['nombre'];
path_foto = lh_datos_evento['path_foto'];
activo = lh_datos_evento['activo'];
var class_tema = 'nombretema';
var idEventoSeleccionado = '';
if (listaTemasMensaje['ev-' + nombreEvento]) {
class_tema = 'nombretema activo';
idEventoSeleccionado = nombreEvento;
}
var id_elemento = idCaja + '_' + nombreEvento;
var html_elemento = '';
if (activo) {
html_elemento = '' + nombre + ' ';
}
else {
html_elemento = '' + nombre + ' ';
}
html_lista_eventos = html_lista_eventos + html_elemento;
}
if (numero_eventos == 0) {
id_campo_ul = 'id_sin_eventos_para_escribir';
html_lista_eventos = 'No tienes ningún tema donde escribir ';
}
else {
id_campo_ul = 'id_eventos_para_escribir_' + idCaja;
}
var html = "";
if (numero_eventos > 0) {
html = html + ' ';
html = html + '
';
html = html + '
Selecciona los temas en los que quieres que aparezca tu mensaje:
';
html = html + '
Estos son los temas a los que te has apuntado para escribir . Si no seleccionas nada, sólo aparecerá en \'Mis mensajes\'.
';
html = html + '
';
html = html + '
Editar mi listado ';
}
html = html + '
';
html = html + '
';
html = html + ' ';
html = html + '
';
html = html + '
' + html_lista_eventos + ' ';
html = html + '
';
html = html + '
';
var boton_donde_publicar = document.getElementById('boton_donde_publicar_' + idCaja);
var divCaja = document.getElementById('capaopciones_destino_' + idCaja);
divCaja.innerHTML = html;
if ( (divCaja.style.display == '') && (abrirForzado == false) ) {
divCaja.style.display = 'none';
boton_donde_publicar.className = 'boton temas';
}
else {
divCaja.style.display = '';
boton_donde_publicar.className = 'boton temas activo';
var divMarco = document.getElementById('cajamarco_' + idCaja);
if (divMarco.clientHeight <= 135) {
var alto_actual = divMarco.clientHeight;
alto_actual = alto_actual + 5;
divMarco.height = alto_actual;
divMarco.className = 'marco';
}
else {
divMarco.className = 'marco';
divMarco.height = 135;
}
}
var boton_adjuntar = document.getElementById('boton_adjuntar_' + idCaja);
boton_adjuntar.className = 'boton imagen';
}
function f_muestra_temas_destacados(listaTemasDestacados, listaTemasDestacadosExtra) {
var html = '';
var numero_temas = 0;
for (var claveTema in listaTemasDestacados) {
var datosTema = listaTemasDestacados[claveTema];
numero_temas++;
html = html + ' ';
html = html + '
';
if ( (datosTema.nombre) && (datosTema.nombre != '') ) {
html = html + '
';
}
if (listaTemasDestacadosExtra[claveTema]) {
var datosExtra = listaTemasDestacadosExtra[claveTema];
if ( (datosExtra.ts_ultimo_mensaje) && (datosExtra.ts_ultimo_mensaje != '') ) {
var ts_ultima_actualizacion = f_obtener_html_ultima_actualizacion_evento( datosExtra.ts_ultimo_mensaje , 1);
texto_ultima_actualizacion = '
Actualizado: ' + ts_ultima_actualizacion;
}
else {
texto_ultima_actualizacion = '
No ha sido actualizado ';
}
html = html + '
' + texto_ultima_actualizacion + '
';
}
html = html + '
';
html = html + '
';
var path_foto = _url_imagen_por_defecto;
if ( (datosTema.pathfoto) && (datosTema.pathfoto != '') ) {
path_foto = datosTema.pathfoto;
}
html = html + '
';
var texto_reclamo = '';
var texto_entradilla = '';
if ( (datosTema.reclamo) && (datosTema.reclamo != '') ) {
texto_reclamo = datosTema.reclamo;
}
if ( (datosTema.entradillatemasdestacados) && (datosTema.entradillatemasdestacados != '') ) {
texto_entradilla = datosTema.entradillatemasdestacados;
}
html = html + '
' + texto_entradilla + '
';
html = html + '
';
html = html + '
';
html = html + '
';
}
var idCaja = '';
if (numero_temas == 0) {
html = html + ' No hay temas destacados
';
idCaja = 'id_cajavacia_destacados';
}
else {
idCaja = 'id_temasdestacados';
}
var divCajaDestacados = document.getElementById(idCaja);
if (divCajaDestacados) {
divCajaDestacados.innerHTML = html;
divCajaDestacados.style.display = '';
var divCajaMarco = document.getElementById('id_marco_destacados');
divCajaMarco.style.display = '';
var altura = divCajaDestacados.clientHeight;
if (divCajaDestacados.clientHeight > 450) {
altura = 450;
}
}
}
function f_muestra_caja_mistemas() {
f_obtener_eventos_seguidos('id_mistemas');
}
function f_pinta_caja_eventos_seguidos_usuario(idCaja) {
var html = '';
var texto_ultima_actualizacion = '';
var divEnlaces = document.getElementById('id_enlaces_mistemas');
var divMarco = document.getElementById('id_marco_mistemas');
var divCajaVacia = document.getElementById('id_cajavacia_mistemas');
if (_numeroEventosSeguidos > 0) {
var numero_eventos_procesados = 0;
for (var claveEvento in _hashEventosSeguidos) {
var lh_datos_evento = _hashEventosSeguidos[claveEvento];
descripcion = '';
nombre = '';
path_foto = '';
idTablon = claveEvento;
descripcion = lh_datos_evento['descripcion'];
nombre = lh_datos_evento['nombre'];
path_foto = lh_datos_evento['path_foto'];
if (lh_datos_evento['ts_ultimo_mensaje']) {
var ts_ultima_actualizacion = f_obtener_html_ultima_actualizacion_evento(lh_datos_evento['ts_ultimo_mensaje'], 1);
texto_ultima_actualizacion = 'Actualizado: ' + ts_ultima_actualizacion;
}
else {
texto_ultima_actualizacion = 'No ha sido actualizado ';
}
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + '
' + texto_ultima_actualizacion + '
';
html = html + '
';
html = html + '
';
numero_eventos_procesados++;
}
divCajaVacia.style.display = 'none';
var divCaja = document.getElementById(idCaja);
if (document.getElementById(idCaja)) {
divCaja.innerHTML = html;
}
divEnlaces.style.display = '';
divMarco.style.display = '';
var altura = divCaja.clientHeight;
if (divCaja.clientHeight > 300) {
altura = 300;
}
}
else {
html = html + ' No estás suscrito a ningún tema
';
html = html + ' Buscar temas
';
divEnlaces.style.display = 'none';
divMarco.style.display = 'none';
divCajaVacia.innerHTML = html;
divCajaVacia.style.display = '';
}
}
function f_pinta_html_numero_seguidores(numero_seguidores) {
var divCaja = document.getElementById('id_numero_seguidores');
divCaja.innerHTML = numero_seguidores;
}
function f_muestra_seguidores(hashDatos) {
var numero_seguidores = 0;
if (hashDatos.numeroUsuarios) {
numero_seguidores = hashDatos.numeroUsuarios;
}
f_pinta_html_numero_seguidores(numero_seguidores);
}
function f_muestra_listado_seguidores(idUsuario, pagina) {
var cadena_params = 'action=list_seguidores&max=' + _numero_maximo_usuarios_a_mostrar + '&user=' + idUsuario + '&pag=' + pagina;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idUsuario, hashTMP, 'id_usuarios', 1, pagina);
}
}, _urlESKUP + "&" + cadena_params);
}
function f_muestra_listado_a_quien_sigo(idUsuario, pagina) {
var cadena_params = 'action=list_usuarios&max=' + _numero_maximo_usuarios_a_mostrar + '&user=' + idUsuario + '&pag=' + pagina;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idUsuario, hashTMP, 'id_usuarios', 2, pagina);
}
}, _urlESKUP + "&" + cadena_params);
}
function f_muestra_listado_seguidores_evento(idEvento, pagina) {
var cadena_params = 'action=list_seguidores&max=' + _numero_maximo_usuarios_a_mostrar + '&event=ev-' + idEvento + '&pag=' + pagina;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idEvento, hashTMP, 'id_usuarios', 3, pagina);
f_pinta_nombre_bonito_evento(idEvento, 'id_titulo_tema_');
}
}, _urlESKUP + "&" + cadena_params);
}
function f_muestra_listado_escritores_evento(idEvento, pagina) {
var cadena_params = 'action=list_writers&max=' + _numero_maximo_usuarios_a_mostrar + '&event=ev-' + idEvento + '&pag=' + pagina;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
f_pinta_html_listado_usuarios(idEvento, hashTMP, 'id_usuarios', 4, pagina);
f_pinta_nombre_bonito_evento(idEvento, 'id_titulo_tema_');
}
}, _urlESKUP + "&" + cadena_params);
}
function f_pinta_nombre_bonito_evento(idEvento, idPrefijoCampo) {
var cadena_params = 'action=info_eventos&event=ev-' + idEvento;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
} else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
if (document.getElementById(idPrefijoCampo + idEvento)) {
var divCajaNombreTema = document.getElementById(idPrefijoCampo + idEvento);
divCajaNombreTema.innerHTML = hashTMP.perfilesEventos[idEvento].nombre;
}
}
}, _urlESKUP + "&" + cadena_params);
}
function f_obtener_html_envoltorio_usuario(idUsuario, datosUsuario, tipoUsuario) {
var html = '';
var es_activo = datosUsuario.activo;
var url_foto = datosUsuario.pathfoto;
if (url_foto == '') {
url_foto = _url_imagen_usuario_por_defecto;
}
url_usuario = "/" + idUsuario;
var alias_bonito = datosUsuario.alias_bonito ? datosUsuario.alias_bonito : idUsuario;
var nombre = '';
if (datosUsuario.nombre) {
nombre = datosUsuario.nombre + ' ' + datosUsuario.apellidos;
}
if (datosUsuario.nombrebonito) {
nombre = datosUsuario.nombrebonito;
}
var usuarioSeguido = false;
var usuarioBloqueado = false;
if (datosUsuario.seguido == 1) {
usuarioSeguido = true;
}
if (datosUsuario.bloqueado == 1) {
usuarioBloqueado = true;
}
var soyyomismo = false;
var html_url_usuario = '';
if (idUsuario == _nickname) {
soyyomismo = true;
html = html + '';
}
id_html_usuario = 'id_envoltoriousuariousuario_' + idUsuario;
html = html + '
';
if (_nickname != '') {
html = html + '
';
if (soyyomismo == false) {
html = html + '
Enviar privado ';
}
else {
html = html + ' ';
}
html = html + '
';
html = html + '
';
}
else {
}
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
' + alias_bonito + ' ';
html = html + ' ';
html = html + ' ';
var html_botones_seguir = '';
var html_botones_bloquear = '';
if (_nickname != '') {
html_botones_seguir = f_componer_html_botones_menu_seguir_usuario(usuarioSeguido, idUsuario);
html = html + ' ';
if (soyyomismo == false) {
html_botones_bloquear = f_componer_html_botones_menu_bloquear(usuarioBloqueado, idUsuario);
html = html + ' ';
}
else {
}
}
else {
}
html = html + ' ';
html = html + '
';
html = html + '
';
if (nombre != '') {
html = html + '
' + nombre + '
';
}
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
if (soyyomismo) {
html = html + '
';
}
return html;
}
function f_obtener_html_envoltorio_evento(idEvento, datosEvento, tipoEvento) {
var html = '';
var datosTema = datosEvento;
var nombreTema = '';
if (datosTema.nombre) {
nombreTema = datosTema.nombre;
}
if (datosTema.nombrebonito) {
nombreTema = datosTema.nombrebonito;
}
var descripcionTema = '';
if (datosTema.descripcion) {
descripcionTema = datosTema.descripcion;
}
var datosExtra = Array();
if (_hashEventosSeguidos[idEvento]) {
datosExtra = _hashEventosSeguidos[idEvento];
}
if (datosTema.pathfoto == '') {
datosTema.pathfoto = _url_imagen_por_defecto;
}
var seguimiento_usuario = false;
if (_hashEventosSeguidos[idEvento]) {
seguimiento_usuario = true;
}
var html_botones_menu_seguir = '';
if (_nickname != '') {
var html_botonera = f_componer_html_botones_menu_seguir_evento(seguimiento_usuario, idEvento);
html_botones_menu_seguir = '';
}
html = html + '';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
' + nombreTema + ' ';
if (html_botones_menu_seguir != '') {
html = html + html_botones_menu_seguir;
}
html = html + '
';
html = html + '
';
html = html + '
' + descripcionTema + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
return html;
}
function f_pinta_html_listado_usuarios(idUsuario, hashDatos, idCajaUsuarios, tipoUsuarios, pagina) {
var html_contenedor_usuario = '';
var html_encabezado = '';
var html = '';
var html_error = '';
var numero_usuarios = 0;
var hashUsuarios = hashDatos.perfilesUsuarios;
var numero_usuarios = hashDatos.numeroUsuarios;
if (tipoUsuarios == 1) {
if (_nickname == idUsuario) {
if (numero_usuarios == 0) {
html_encabezado = 'Usuarios que te siguen';
}
else {
html_encabezado = 'Te siguen ' + numero_usuarios + ' usuario';
if (numero_usuarios > 1) {
html_encabezado = html_encabezado + 's';
}
}
}
else {
if (numero_usuarios == 0) {
html_encabezado = 'Usuarios que siguen a ' + idUsuario + ' ';
}
else {
html_encabezado = '' + numero_usuarios + ' usuario';
if (numero_usuarios > 1) {
html_encabezado = html_encabezado + 's siguen';
}
else {
html_encabezado = html_encabezado + ' sigue';
}
html_encabezado = html_encabezado + ' a ' + idUsuario + ' ';
}
}
}
else {
if (tipoUsuarios == 2) {
if (_nickname == idUsuario) {
if (numero_usuarios == 0) {
html_encabezado = 'Usuarios que sigues';
}
else {
html_encabezado = 'Sigues a ' + numero_usuarios + ' usuario';
if (numero_usuarios > 1) {
html_encabezado = html_encabezado + 's';
}
}
}
else {
if (numero_usuarios == 0) {
html_encabezado = 'Usuarios que sigue ' + idUsuario + ' ';
}
else {
html_encabezado = '' + idUsuario + ' sigue a ' + numero_usuarios + ' usuario';
if (numero_usuarios > 1) {
html_encabezado = html_encabezado + 's';
}
}
}
}
else {
if (tipoUsuarios == 3) {
if (numero_usuarios == 0) {
html_encabezado = 'Usuarios que siguen el tema ' + idUsuario + ' ';
}
else {
html_encabezado = '' + numero_usuarios + ' usuario';
if (numero_usuarios > 1) {
html_encabezado = html_encabezado + 's siguen';
}
else {
html_encabezado = html_encabezado + ' sigue';
}
html_encabezado = html_encabezado + ' el tema ' + idUsuario + ' ';
}
}
else {
if (numero_usuarios == 0) {
html_encabezado = 'Usuarios que pueden escribir en el tema ' + idUsuario + ' ';
}
else {
html_encabezado = '' + numero_usuarios + ' usuario';
if (numero_usuarios > 1) {
html_encabezado = html_encabezado + 's escriben';
}
else {
html_encabezado = html_encabezado + ' escribe ';
}
html_encabezado = html_encabezado + ' en el tema ' + idUsuario + ' ';
}
}
}
}
html_encabezado = '' + html_encabezado + ' ';
if (numero_usuarios == 0) {
if (tipoUsuarios == 1) {
if (_nickname == idUsuario) {
html_error = 'No te sigue ningún usuario';
}
else {
html_error = 'Al usuario ' + idUsuario + ' no le sigue nadie';
}
}
else {
if (tipoUsuarios == 2) {
if (_nickname == idUsuario) {
html_error = 'No sigues a ningún usuario';
}
else {
html_error = 'Al usuario ' + idUsuario + ' no sigue a nadie';
}
}
else {
if (tipoUsuarios == 3) {
html_error = 'El tema ' + idUsuario + ' no lo sigue nadie';
}
else {
html_error = 'Ningún usuario escribe en el tema ' + idUsuario + ' ';
}
}
}
html = '';
html = html + '
' + html_error + '
';
html = html + '
';
}
else {
for (var clave_usuario in hashUsuarios) {
usuario = hashUsuarios[clave_usuario];
html_contenedor_usuario = f_obtener_html_envoltorio_usuario(clave_usuario, usuario, tipoUsuarios);
html = html + html_contenedor_usuario;
}
var html_paginacion = '';
html_paginacion = html_paginacion + '';
html_paginacion = html_paginacion + '
';
html_paginacion = html_paginacion + f_obtener_paginacion_usuarios(idUsuario, tipoUsuarios, numero_usuarios, pagina);
html_paginacion = html_paginacion + '
';
html_paginacion = html_paginacion + '
';
html_paginacion = html_paginacion + '
';
html_paginacion = html_paginacion + '
';
html = '' + html + '
';
}
html = html_encabezado + html;
var divCaja = document.getElementById(idCajaUsuarios);
divCaja.innerHTML = html;
}
function f_pinta_html_listado_resultado_usuarios(cadena_busqueda) {
var html = '';
if (cadena_busqueda == '') {
return false;
}
var cadena_params = "q=" + cadena_busqueda;
EPETUtils_makeHttpRequestGet(function (httpRequest) {
var html_completo = '';
var html = '';
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var hashUsuarios = Array();
var hashDatos = Array();
var numero_usuarios = 0;
eval("hashDatos = " + data);
if (hashDatos.num > 0) {
hashUsuarios = hashDatos.answer;
numero_usuarios = hashDatos.num;
cadena_busqueda = hashDatos.query;
}
if (numero_usuarios > 0) {
var str_lista_usuarios ='';
for (var i=0; i < numero_usuarios; i++) {
if (i != 0) {
str_lista_usuarios = str_lista_usuarios + ',';
}
usuario = hashUsuarios[i];
idUsuario = usuario.nick;
str_lista_usuarios = str_lista_usuarios + idUsuario;
}
var cadena_params = "action=info_usuarios&user=" + str_lista_usuarios;
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
html_completo = html_completo + '';
html_completo = html_completo + '
Se ha producido un error al realizar la búsqueda de usuarios. Por favor, inténtalo más tarde
';
html_completo = html_completo + '
';
}
else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
var listaUsuariosEncontrados = hashTMP.perfilesUsuarios;
for (var clave_usuario in listaUsuariosEncontrados) {
var datosUsuario = listaUsuariosEncontrados[clave_usuario];
var html_contenedor_usuario = f_obtener_html_envoltorio_usuario(clave_usuario, datosUsuario, 1);
html = html + html_contenedor_usuario;
}
var html_resultados = '';
if (numero_usuarios == 1) {
html_resultados = html_resultados + 'Se ha encontrado 1 resultado para ' + cadena_busqueda + ' ';
}
else {
html_resultados = html_resultados + 'Se han encontrado ' + numero_usuarios + ' resultados para ' + cadena_busqueda + ' ';
}
html_completo = '';
html_completo = html_completo + '' + html + '
';
html_completo = html_completo + '';
}
f_pinta_html_buscar(1, cadena_busqueda);
var divCaja = document.getElementById('id_listado');
divCaja.innerHTML = html_completo;
}, _urlESKUP + "&" + cadena_params);
}
else {
html_completo = html_completo + '';
html_completo = html_completo + '
No existen usuarios que cumplan la condición: ' + EPETUtils_filtraFormulario(cadena_busqueda) + '
';
html_completo = html_completo + '
';
f_pinta_html_buscar(1, cadena_busqueda);
var divCaja = document.getElementById('id_listado');
divCaja.innerHTML = html_completo;
}
}
else {
html_completo = html_completo + '';
html_completo = html_completo + '
Se ha producido un error al realizar la consulta. Por favor, inténtalo más tarde
';
html_completo = html_completo + '
';
f_pinta_html_buscar(1, cadena_busqueda);
var divCaja = document.getElementById('id_listado');
divCaja.innerHTML = html_completo;
}
} , _urlBuscarUsuarios + "?" + cadena_params);
}
function f_pinta_html_listado_resultado_temas(cadena_busqueda) {
var html = '';
if (cadena_busqueda == '') {
return false;
}
var cadena_params = "q=" + cadena_busqueda;
EPETUtils_makeHttpRequestGet(function f_procesa_peticion_busqueda_temas(httpRequest) {
var html_completo = '';
var html = '';
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var hashTemas = Array();
var hashDatos = Array();
var numero_temas = 0;
eval("hashDatos = " + data);
if (hashDatos.num > 0) {
hashTemas = hashDatos.answer;
numero_temas = hashDatos.num;
cadena_busqueda = hashDatos.query;
}
if (numero_temas > 0) {
var str_lista_temas ='';
for (var i=0; i < numero_temas; i++) {
if (i != 0) {
str_lista_temas = str_lista_temas + ',';
}
var tema = hashTemas[i];
idTema = tema.nick;
str_lista_temas = str_lista_temas + 'ev-' + idTema;
}
var cadena_params = "action=info_eventos&event=" + str_lista_temas;
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
html_completo = html_completo + '';
html_completo = html_completo + '
Se ha producido un error al realizar la búsqueda de usuarios. Por favor, inténtalo más tarde
';
html_completo = html_completo + '
';
}
else {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
var listaTemasEncontrados = hashTMP.perfilesEventos;
for (var clave_tema in listaTemasEncontrados) {
var datosTema = listaTemasEncontrados[clave_tema];
var html_contenedor_tema = f_obtener_html_envoltorio_evento(clave_tema, datosTema, 1);
html = html + html_contenedor_tema;
}
var html_resultados = '';
if (numero_temas == 1) {
html_resultados = html_resultados + 'Se ha encontrado 1 resultado para ' + cadena_busqueda + ' ';
}
else {
html_resultados = html_resultados + 'Se han encontrado ' + numero_temas + ' resultados para ' + cadena_busqueda + ' ';
}
html_completo = '';
html_completo = html_completo + '';
html_completo = html_completo + html;
html_completo = html_completo + '
';
html_completo = html_completo + '';
}
f_pinta_html_buscar(3, cadena_busqueda);
var divCaja = document.getElementById('id_listado');
divCaja.innerHTML = html_completo;
}, _urlESKUP + "&" + cadena_params);
}
else {
html_completo = html_completo + '';
html_completo = html_completo + '
No existen temas que cumplan la condición: ' + EPETUtils_filtraFormulario(cadena_busqueda) + '
';
html_completo = html_completo + '
';
f_pinta_html_buscar(3, cadena_busqueda);
var divCaja = document.getElementById('id_listado');
divCaja.innerHTML = html_completo;
}
}
else {
html_completo = html_completo + '';
html_completo = html_completo + '
Se ha producido un error al realizar la consulta. Por favor, inténtalo más tarde
';
html_completo = html_completo + '
';
f_pinta_html_buscar(3, cadena_busqueda);
var divCaja = document.getElementById('id_listado');
divCaja.innerHTML = html_completo;
}
} , _urlBuscarTemas + "?" + cadena_params);
}
function f_muestra_informacion_error_busqueda() {
var mensaje_error = '';
mensaje_error = mensaje_error + '
No hemos encontrado ningún usuario con ese nombre.
';
mensaje_error = mensaje_error + '
';
var divCajaResultados = document.getElementById('id_usuarios_buscar');
divCajaResultados.innerHTML = mensaje_error;
divCajaResultados.style.display = '';
}
function f_funcion_maneja_click(lista_seleccion) {
var numero_elementos_seleccionados = lista_seleccion.length;
if (numero_elementos_seleccionados == 1) {
ESKUPautocompleteRemoveAll();
var campo_busqueda = campo_texto = document.getElementById('q_busqueda');
campo_busqueda.value = lista_seleccion[0].nick;
f_peticion_buscar();
}
}
function f_maneja_busqueda(campo, tipo_contenido) {
if (tipo_contenido == 1) {
ESKUPautocompleteInitialize(campo, f_funcion_maneja_click);
}
else {
if (tipo_contenido == 3) {
ESKUPautocompleteInitializeEvents(campo, f_funcion_maneja_click);
}
else {
}
}
}
function f_cambia_campo_busqueda(campo_select, id_campo_tipo_contenido) {
var valor_seleccionado = campo_select.options[campo_select.selectedIndex].value;
var campo_texto = document.getElementById(id_campo_tipo_contenido);
campo_texto.value = valor_seleccionado;
ESKUPautocompleteRemoveAll();
}
function f_peticion_buscar() {
var valor_action = '';
var campo_texto = campo_texto = document.getElementById('q_busqueda');
var valor_campo = trim(campo_texto.value);
if (valor_campo == '') {
return;
}
var campo_tipo_contenido = document.getElementById('id_tipo_contenido');
var tipo_contenido = trim(campo_tipo_contenido.value);
if (tipo_contenido == 1) {
valor_action = '/resultado_buscar_usuarios.html';
}
else if (tipo_contenido == 2) {
valor_action = '/resultado_buscar.html';
}
else {
valor_action = '/resultado_buscar_temas.html';
}
var formulario = document.getElementById('formulario_busquedas');
formulario.action = valor_action;
formulario.submit();
}
function f_peticion_buscar_usuarios(lista_usuarios_seleccionados) {
if (! _hashAnswer) {
return false;
}
var campoUsuario = document.getElementById('id_nombre_usuario_para_buscar');
var cadena_tecleada = campoUsuario.value;
var numero_usuarios = lista_usuarios_seleccionados.length;
if (numero_usuarios == 0) {
return true;
}
var numero_usuarios_busqueda = _hashAnswer.num;
if (numero_usuarios_busqueda == 0) {
f_muestra_informacion_error_busqueda();
}
else {
if (numero_usuarios_busqueda == 1) {
if ( (typeof campoUsuario.eskup_seleccionado != 'undefined') && (campoUsuario.eskup_seleccionado == 1) ) {
campoUsuario.eskup_seleccionado = 0;
nick_usuario = cadena_tecleada;
}
else {
usuario = lista_usuarios_seleccionados[0];
nick_usuario = trim(usuario.nick);
}
f_pinta_html_listado_resultado_usuarios(cadena_tecleada);
}
else {
f_pinta_html_listado_resultado_usuarios(cadena_tecleada);
}
}
}
function f_peticion_buscar_contenido(idCampo, id_formulario_busqueda) {
var campo_texto = document.getElementById(idCampo);
var valor_tecleado = campo_texto.value;
if (f_es_valor_vacio(valor_tecleado) ) {
alert("No has escrito nada para buscar");
return true;
}
var formulario = document.getElementById(id_formulario_busqueda);
formulario.submit();
}
function f_peticion_buscar_temas(lista_temas_seleccionados) {
if (! _hashAnswer) {
return false;
}
var campoTema = document.getElementById('id_nombre_tema_para_buscar');
var cadena_tecleada = campoTema.value;
var numero_temas = lista_temas_seleccionados.length;
if (numero_temas == 0) {
return true;
}
var numero_temas_busqueda = _hashAnswer.num;
if (numero_temas_busqueda == 0) {
f_muestra_informacion_error_busqueda();
}
else {
if (numero_temas_busqueda == 1) {
if ( (typeof campoTema.eskup_seleccionado != 'undefined') && (campoTema.eskup_seleccionado == 1) ) {
campoTema.eskup_seleccionado = 0;
idTema = cadena_tecleada;
}
else {
tema = lista_temas_seleccionados[0];
idTema = trim(tema.nick);
}
f_pinta_html_listado_resultado_temas(cadena_tecleada);
}
else {
f_pinta_html_listado_resultado_temas(cadena_tecleada);
}
}
}
function f_pinta_html_buscar(tipo_contenido, cadena_buscada) {
var html_contenido = '';
var nombre_formulario = '';
var url_nombre_formulario = '';
var html_campo_buscar = '';
var js_boton_buscar = '';
var html_opcion_usuarios = 'disabled="true"';
var html_opcion_contenido = 'disabled="true"';
var html_opcion_temas = 'disabled="true"';
if (tipo_contenido == 1) {
nombre_formulario = 'formulario_usuarios';
url_nombre_formulario = 'resultado_buscar_usuarios.html';
html_campo_buscar = ' ';
js_boton_buscar = 'javascript:f_pinta_html_listado_resultado_usuarios(document.formulario_usuarios.id_nombre_usuario_para_buscar.value);ESKUPautocompleteRemoveAll();';
html_opcion_usuarios = 'selected="selected"';
}
else if (tipo_contenido == 2) {
nombre_formulario = 'formulario_contenido';
url_nombre_formulario = 'resultado_buscar.html';
html_campo_buscar = ' ';
js_boton_buscar = 'javascript:f_peticion_buscar_contenido(\'q_busqueda_form\', \'formulario_contenido\');';
html_opcion_contenido = 'selected="selected"';
}
else {
nombre_formulario = 'formulario_temas';
url_nombre_formulario = 'resultado_buscar_temas.html';
html_campo_buscar = ' ';
js_boton_buscar = 'javascript:f_pinta_html_listado_resultado_temas(document.formulario_temas.id_nombre_tema_para_buscar.value);ESKUPautocompleteRemoveAll();';
html_opcion_temas = 'selected="selected"';
}
html_contenido = 'Buscar ';
html_contenido = html_contenido + '';
html_contenido = html_contenido + '
';
html_contenido = html_contenido + '
';
html_contenido = html_contenido + '
';
var divContenedorBusquedas = document.getElementById('id_busquedas');
divContenedorBusquedas.innerHTML = html_contenido;
}
function f_pinta_html_listado_resultado_mensajes(paginaActual, numeroTotal, numeroMensajes, hashDatos) {
var html_encabezado = '';
var html = '';
var numero_mensajes = numeroTotal;
var cadena_buscada = '';
var descripcion_cadena_buscada = '';
if (_cadenaQ != '') {
cadena_buscada = _cadenaQ;
descripcion_cadena_buscada = 'mensajes encontrados con ' + cadena_buscada + ' ';
}
else {
cadena_buscada = '';
descripcion_cadena_buscada = 'mensajes relacionados';
}
f_pinta_html_buscar(2, cadena_buscada);
if (numero_mensajes > 0) {
var inicioNumeroActual = ((parseInt(paginaActual) - 1) * _numMsgPag) + 1;
var finNumeroActual = parseInt(paginaActual) * _numMsgPag;
if (finNumeroActual > numeroTotal) {
finNumeroActual = numeroTotal
}
var estilo_ordenacion_frescura = '';
var estilo_ordenacion_relevancia = '';
if (_tipoOrdenacionBusquedas == 'r') {
estilo_ordenacion_relevancia = 'class="activo"';
}
else {
estilo_ordenacion_frescura = 'class="activo"';
}
html = html + '';
html = html + ' Ordenar por ';
html = html + ' Frescura ';
html = html + ' Coincidencia ';
html = html + ' ';
html = html + 'Mostrando del ' + inicioNumeroActual + ' al ' + finNumeroActual + ' de ' + numeroTotal + ' ' + descripcion_cadena_buscada + '
';
}
else {
html = html + '';
html = html + '
No se ha encontrado ningún mensaje que cumpla la condición
';
html = html + '
';
}
var divCaja = document.getElementById('id_listado');
divCaja.innerHTML = html;
if (numero_mensajes > 0) {
if (hashDatos.mensajes.length > 0) {
muestraMensajesResultadoBusquedas(paginaActual, numeroTotal, numero_mensajes, hashDatos.mensajes);
}
else {
var html_error = ' Se ha producido un error al realizar la consulta. Por favor, espere y repítalo más tarde.
';
var divContenedor = document.getElementById(_idContenedorErr);
divContenedor.innerHTML = html_error;
divContenedor.style.display = '';
}
}
}
function f_pinta_html_numero_seguidos(numero_seguidos) {
var divCaja = document.getElementById('id_numero_usuarios_que_sigo');
divCaja.innerHTML = numero_seguidos;
}
function f_pinta_html_a_quien_sigo(hashDatos) {
var html ='';
var clave_usuario = '';
var numero_usuarios = 0;
var hashUsuarios = Array();
var lista_ordenacion = Array();
var numero_elementos = 0;
var numero_aquien_sigo = 0;
var divEnlaces = document.getElementById('id_enlaces_usuariosseguidos');
var divCajaUsuarios = document.getElementById('id_usuarios_aquien_sigo');
var divCajaVacia = document.getElementById('id_cajavacia_usuariosseguidos');
if (hashDatos.perfilesUsuarios) {
hashUsuarios = hashDatos.perfilesUsuarios;
lista_ordenacion = hashDatos.ordenPerfilesUsuariosActivos;
numero_elementos = lista_ordenacion.length;
numero_aquien_sigo = hashDatos.numeroUsuarios;
}
if (numero_elementos > 0) {
for (i = 0; i < numero_elementos; i++) {
clave_usuario = lista_ordenacion[i];
usuario = hashUsuarios[clave_usuario];
url_foto = usuario.pathfoto;
if (typeof usuario.pathfoto == 'undefined' || !url_foto || url_foto == '') {
url_foto = _url_imagen_usuario_por_defecto;
}
var nombre = (usuario.nombre?usuario.nombre:'') + ' ' + (usuario.apellidos?usuario.apellidos:'');
if ( trim(nombre) == '') {
nombre = clave_usuario;
}
url_usuario = "/" + clave_usuario;
es_activo = usuario.activo;
var estilo_activo = '';
html = html + ' ';
if (es_activo == 1) {
estilo_activo = 'activo';
}
else {
estilo_activo = 'inactivo';
}
html = html + '
';
html = html + '
';
numero_usuarios++;
}
divCajaUsuarios.innerHTML = html;
divEnlaces.style.display = '';
divCajaUsuarios.style.display = '';
divCajaVacia.style.display = 'none';
}
else {
html = html + ' No sigues a ningún usuario
';
html = html + ' Buscar usuarios
';
divCajaVacia.innerHTML = html;
divCajaVacia.style.display = '';
divEnlaces.style.display = 'none';
divCajaUsuarios.style.display = 'none';
}
f_pinta_html_numero_seguidos(numero_aquien_sigo);
}
function f_muestra_a_quien_sigo(hashDatos) {
f_pinta_html_a_quien_sigo(hashDatos);
}
function f_procesa_a_quien_sigo(httpRequest) {
var numero_aquien_sigo = 0;
if (httpRequest.status != 200) {
} else {
var data = httpRequest.responseText;
try {
eval("hashTMP = " + data);
} catch(e) {
hashTMP = Array();
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
f_pinta_html_a_quien_sigo_movil(hashTMP);
} else {
f_pinta_html_a_quien_sigo(hashTMP);
}
}
}
function f_obtener_quien_sigo() {
var numero_seguidos = 0;
var cadena_params = "action=list_usuarios&max=" + _numero_maximo_usuarios_conectados;
cadena_params += '&sort=1';
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
EPETUtils_makeHttpRequestGet(f_procesa_a_quien_sigo, _urlESKUP + "&" + cadena_params);
}
function f_procesa_denegados(httpRequest) {
var numero_aquien_sigo = 0;
if (httpRequest.status != 200) {
}
else {
var data = httpRequest.responseText;
eval("hashTMP = " + data);
_hashListaDenegados = hashTMP;
f_pinta_denegados_para_listado(hashTMP);
}
}
function f_obtener_denegados(idUsuario) {
var numero_seguidos = 0;
var cadena_params = 'action=list_denegaciones';
if (_idUsuario != '') {
cadena_params += "&user=" + idUsuario;
}
_idUsuario = idUsuario;
if (_ultimaRecargaServidor > 0) {
cadena_params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
EPETUtils_makeHttpRequestGet(f_procesa_denegados, _urlESKUP + "&" + cadena_params);
}
function f_pinta_denegados_para_listado(hashDatos) {
var numero_usuarios = 0;
var hashUsuarios = hashDatos.perfilesUsuarios;
var numero_usuarios = hashDatos.numeroUsuarios;
if (numero_usuarios > 0) {
for (var clave_usuario in hashUsuarios) {
usuario = hashUsuarios[clave_usuario];
var boton_bloquear = document.getElementById('id_boton_bloquear_' + clave_usuario);
var boton_desbloquear = document.getElementById('id_boton_desbloquear_' + clave_usuario);
if (boton_bloquear) {
boton_bloquear.style.display = 'none';
}
if (boton_desbloquear) {
boton_desbloquear.style.display = '';
}
}
}
}
function f_cerrar_detalles() {
var divCaja = document.getElementById('id_detalles_evento');
divCaja.style.display = 'none';
var botonCerrar = document.getElementById('boton_cerrar_detalles');
var botonVer = document.getElementById('boton_ver_detalles');
botonCerrar.style.display = 'none';
botonVer.style.display = '';
_detallesEventoCerrados = true;
}
function f_abrir_detalles() {
var divCaja = document.getElementById('id_detalles_evento');
divCaja.style.display = '';
var botonCerrar = document.getElementById('boton_cerrar_detalles');
var botonVer = document.getElementById('boton_ver_detalles');
botonCerrar.style.display = '';
botonVer.style.display = 'none';
_detallesEventoCerrados = false;
}
function f_cerrar_panel_aviso() {
f_cerrar_panel('id_caja_aviso');
var botonDejar = document.getElementById('boton_dejar_evento');
var botonSeguir = document.getElementById('boton_seguir_evento');
botonDejar.className = '';
botonSeguir.className = '';
}
function f_pinta_html_servicios_externos(idMensaje) {
var html = '';
var class_boton = 'boton publicarfuera desactivado';
var html_twitter = '';
var html_facebook = ' ';
var numero_servicios_externos = _listaServiciosExternos.length;
if (numero_servicios_externos > 0) {
class_boton = 'boton publicarfuera';
for (i = 0; i < numero_servicios_externos; i++) {
var codigo_servicio = _listaServiciosExternos[i];
if (codigo_servicio == _id_servicio_externo_twitter) {
html_twitter = '';
}
else {
if (codigo_servicio == _id_servicio_externo_facebook) {
html_facebook = ' ';
}
}
}
}
html = 'Publicar también en ';
html = html + html_twitter;
html = html + html_facebook;
return html;
}
function f_obtener_html_caja_escribir_evento_falsa() {
var html = '';
html = html + '';
html = html + '
';
return html;
}
function f_pinta_caja_escribir_evento(idEvento, eventoActivo, tipoSuscripcionEvento, estadoEscrituraEvento, tipoEvento) {
var html_caja = '';
var html_escribir = '';
var pintar_botones = 0;
if (_nickname == '') {
html_escribir = html_escribir + ' ';
html_escribir = html_escribir + '
Tienes que identificarte para poder enviar mensajes. Utiliza el formulario de arriba para iniciar sesión o date de alta si no lo has hecho aún
';
html_escribir = html_escribir + '
';
html_caja = f_obtener_html_caja_escribir_evento_falsa();
class_para_div = 'escribirmensajefalsa';
}
else {
if (estadoEscrituraEvento == 0) {
if (tipoSuscripcionEvento == 0) {
}
else if (tipoSuscripcionEvento == 1) {
html_escribir = html_escribir + ' ';
if (tipoEvento >= 100) {
html_escribir = html_escribir + '
';
}
else {
html_escribir = html_escribir + '
';
}
if (tipoEvento >= 100) {
html_escribir = html_escribir + 'La participación en este concurso implica la aceptación de sus bases ';
}
html_escribir = html_escribir + ' Si quieres escribir en este tema pulsa el botón . ¡Gracias!';
html_escribir = html_escribir + '
';
html_escribir = html_escribir + '
Quiero escribir ';
html_escribir = html_escribir + '
';
html_caja = f_obtener_html_caja_escribir_evento_falsa();
class_para_div = 'escribirmensajefalsa';
}
else {
html_escribir = html_escribir + ' ';
html_escribir = html_escribir + '
En este espacio se escribe por invitación. ';
html_escribir = html_escribir + ' Si puedes aportar nuevos argumentos cuéntanos quién eres y por qué quieres participar.
';
html_escribir = html_escribir + '
Quiero escribir ';
html_escribir = html_escribir + '
';
html_caja = f_obtener_html_caja_escribir_evento_falsa();
class_para_div = 'escribirmensajefalsa';
}
}
else {
if (estadoEscrituraEvento == 2) {
html_escribir = html_escribir + ' ';
html_escribir = html_escribir + '
Estamos analizando tu solicitud para escribir. En breve nos pondremos en contacto contigo. ¡Gracias!
';
html_escribir = html_escribir + '
';
html_caja = f_obtener_html_caja_escribir_evento_falsa();
class_para_div = 'escribirmensajefalsa';
}
else {
pintar_botones = 1;
html_caja = '';
class_para_div = 'escribirmensaje';
}
}
}
var html_final = '';
if (html_escribir != '') {
html_final = '';
html_final = html_final + html_escribir;
html_final = html_final + '
';
html_final = html_final + '
';
}
html_final = html_final + html_caja;
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
divCajaEscribir.className = class_para_div;
if (html_final != '') {
divCajaEscribir.innerHTML = html_final;
}
}
function f_pinta_caja_escribir_evento_fin_registro() {
var html_caja = '';
var html_escribir = '';
var pintar_botones = 0;
var html_final = '';
if (_nickname == '') {
html_escribir = html_escribir + ' ';
html_escribir = html_escribir + '
Tienes que haber terminado el registro para poder enviar mensajes.
';
html_escribir = html_escribir + '
';
html_caja = f_obtener_html_caja_escribir_evento_falsa();
class_para_div = 'escribirmensajefalsa';
html_final = '';
html_final = html_final + html_escribir;
html_final = html_final + '
';
html_final = html_final + '
';
html_final = html_final + html_caja;
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
divCajaEscribir.className = class_para_div;
if (html_final != '') {
divCajaEscribir.innerHTML = html_final;
}
}
}
function f_solicitar_permiso_escritura(idEvento) {
if (_hashDatosEvento.tipo_suscripcion == 1) {
f_peticion_eskup_escritura(idEvento);
}
else {
var html_aportacion = '';
html_aportacion = html_aportacion + '
';
html_aportacion = html_aportacion + '
Cuéntanos qué puedes aportar.
';
html_aportacion = html_aportacion + '
';
html_aportacion = html_aportacion + '
';
html_aportacion = html_aportacion + '
';
html_aportacion = html_aportacion + '
';
html_aportacion = html_aportacion + '
';
html_aportacion = html_aportacion + '
';
html_aportacion = html_aportacion + '';
html = f_obtener_html_caja_escribir_evento_falsa();
html_aportacion = html_aportacion + html;
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
divCajaEscribir.className = 'escribirmensajefalsa';
divCajaEscribir.innerHTML = html_aportacion;
f_poner_foco_campo_texto('id_campo_formulario_texto_solicitud');
}
}
function f_pinta_html_informacion_evento(idEvento) {
var html = '';
var nombreEvento = _hashDatosEvento.nombre;
var descripcionEvento = ''
if (typeof _hashDatosEvento.descripcion != 'undefined' && _hashDatosEvento.descripcion) {
descripcionEvento = _hashDatosEvento.descripcion;
}
var pathfotoEvento = _url_imagen_por_defecto;
if (typeof _hashDatosEvento.pathfoto != 'undefined' && _hashDatosEvento.pathfoto && _hashDatosEvento.pathfoto != '') {
pathfotoEvento = _hashDatosEvento.pathfoto;
}
var eventoActivo = _hashDatosEvento.activo;
var tipo_suscripcion = _hashDatosEvento.tipo_suscripcion;
var ts_inicio = _hashDatosEvento.ts_inicio;
var ts_final = _hashDatosEvento.ts_final;
var fecha_actual = new Date();
var ts_actual = Math.round(fecha_actual.getTime() / 1000);
var seguimiento_usuario = false;
if (_hashDatosEvento.estado_seguimiento == 1) {
seguimiento_usuario = true;
}
var mostrar_caja_escritura = false;
if (_hashDatosEvento.estado_escritura == '1') {
mostrar_caja_escritura = true;
}
if (_hashDatosEvento.refresco_automatico == '1') {
_activarRecargaAutomatica = true;
}
var class_estado = '';
var mensaje_estado = '';
var html_estado_evento = '';
var codigo_js_href = '';
var codigo_js_div = '';
if (eventoActivo == 0) {
_activarRecargaAutomatica = false;
if (ts_actual > ts_final ) {
class_estado = 'concluido';
mensaje_estado = 'Tema cerrado »
';
codigo_js_href = 'onmouseover="f_abrir_panel(\'id_aclaracion\');" onmouseout="f_cerrar_panel(\'id_aclaracion\');"';
codigo_js_div = 'onmouseover="f_abrir_panel(\'id_aclaracion\');" onmouseout="f_cerrar_panel(\'id_aclaracion\');"';
}
else {
class_estado = 'noabierto';
fecha_inicio = f_obtener_fecha_visible(ts_inicio, true);
mensaje_estado = 'Este tema no está abierto todavía.
';
codigo_js_href = 'onmouseover="f_abrir_panel(\'id_aclaracion\');" onmouseout="f_cerrar_panel(\'id_aclaracion\');"';
codigo_js_div = 'onmouseover="f_abrir_panel(\'id_aclaracion\');" onmouseout="f_cerrar_panel(\'id_aclaracion\');"';
}
}
else {
if (tipo_suscripcion == 0) {
class_estado = 'bloqueado';
mensaje_estado = 'Tema de participación restringida »
';
codigo_js_href = 'onmouseover="f_abrir_panel(\'id_aclaracion\');f_fija_class(\'id_icono_tema\', \'icono hover\');" onmouseout="f_cerrar_panel(\'id_aclaracion\');f_fija_class(\'id_icono_tema\', \'icono\');"';
codigo_js_div = 'onmouseover="f_abrir_panel(\'id_aclaracion\');f_fija_class(\'id_icono_tema\', \'icono hover\');" onmouseout="f_cerrar_panel(\'id_aclaracion\');f_fija_class(\'id_icono_tema\', \'icono\');"';
}
else if (tipo_suscripcion == 1) {
mostrar_caja_escritura = true;
}
else {
mostrar_caja_escritura = true;
}
}
if (class_estado != '') {
html_estado_evento = html_estado_evento + '';
html_estado_evento = html_estado_evento + '
';
html_estado_evento = html_estado_evento + '
';
html_estado_evento = html_estado_evento + '
';
html_estado_evento = html_estado_evento + mensaje_estado;
html_estado_evento = html_estado_evento + '
';
html_estado_evento = html_estado_evento + '
';
html_estado_evento = html_estado_evento + '
';
html_estado_evento = html_estado_evento + '
';
}
html_botones_menu_seguir = '';
if (_nickname != '') {
html_botones_menu_seguir = f_componer_html_botones_menu_seguir_evento(seguimiento_usuario, idEvento);
}
html = html + '';
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
if ( (_hashDatosEvento.adm) && (_hashDatosEvento.adm!= '') ) {
var texto_html = f_obtener_html_administradores_evento(_hashDatosEvento.adm);
if (texto_html != '') {
html = html + ' Administrado por: ' + texto_html + ' ';
}
}
var nombreparamovil = idEvento;
if ( (_hashDatosEvento.nombreparamovil) && (_hashDatosEvento.nombreparamovil != '') ) {
nombreparamovil = _hashDatosEvento.nombreparamovil;
html = html + ' Clave SMS: *' + nombreparamovil + ' ';
}
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + '';
html = html + '
';
html = html + html_estado_evento;
html = html + ' ';
if (_hashDatosEvento.etiquetas) {
var texto_html = f_obtener_html_etiquetas_evento(_hashDatosEvento.etiquetas);
if (texto_html != '') {
html = html + '
';
html = html + '
Archivado en: ';
html = html + ' ' + texto_html;
html = html + ' ';
}
}
if (_hashDatosEvento.etiquetas) {
html = html + '
' + descripcionEvento + '
';
}
if (_hashDatosEvento.apoyos) {
var texto_html = f_obtener_html_apoyos_evento(_hashDatosEvento.apoyos);
if (texto_html != '') {
html = html + '
';
html = html + '
Más información ';
html = html + '
';
html = html + '
';
}
}
var str_numero_mensajes = _hashDatosEvento.num_mensajes;
if (_hashDatosEvento.num_mensajes >= 10000) {
str_numero_mensajes = str_numero_mensajes + '+';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
Se ha superado el límite de mensajes admitidos por tablón Los mensajes nuevos seguirán siendo visibles desplazando a los mensajes más antiguos.
';
html = html + '
';
html = html + '
';
html = html + '
';
}
html = html + '
';
html = html + '
';
html = html + '
Usuarios ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
Mensajes ';
html = html + '
';
html = html + ' Total: ' + str_numero_mensajes + ' ';
if ( (_hashDatosEvento.ts_ultimo_mensaje) && (_hashDatosEvento.num_mensajes > 0) ) {
var texto_html = f_obtener_html_ultima_actualizacion_evento(_hashDatosEvento.ts_ultimo_mensaje, false);
html = html + 'El último: ' + texto_html + ' ';
}
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + '
';
if (_hashDatosEvento.num_mensajes >= 10000) {
html = html + '
';
}
html = html + '
';
html = html + '
';
var caja = document.getElementById('id_info_usuariotema');
caja.innerHTML = html;
if (mostrar_caja_escritura == true) {
f_pinta_caja_escribir_evento(idEvento, eventoActivo, tipo_suscripcion, _hashDatosEvento.estado_escritura, _hashDatosEvento.tipo_evento);
}
else {
var cajaEscribir = document.getElementById('id_escribir_mensaje');
cajaEscribir.style.display = 'none';
}
if (_activarRecargaAutomatica == true) {
f_cambia_boton_recarga('boton_recarga_pagina','recarga', 'id_letrero', 'letrero');
}
}
function f_obtener_html_etiquetas_evento(lista_etiquetas) {
var html_etiquetas = '';
var numero_etiquetas = lista_etiquetas.length;
for (i = 0; i < numero_etiquetas; i++) {
etiqueta = lista_etiquetas[i];
if (i != 0) {
html_etiquetas = html_etiquetas + ', ';
}
html_etiquetas = html_etiquetas + ' ' + etiqueta + ' ';
}
return html_etiquetas;
}
function f_obtener_html_administradores_evento(lista_administradores) {
var html_administradores = '';
var numero_administradores = lista_administradores.length;
for (i = 0; i < numero_administradores; i++) {
adm = lista_administradores[i];
html_administradores = html_administradores + '' + adm + ' ';
}
return html_administradores;
}
function f_obtener_html_apoyos_evento(lista_apoyos) {
var html = '';
var numero_apoyos = 4;
for (i = 1; i <= numero_apoyos; i++) {
var objeto_apoyo = lista_apoyos[i];
var etiqueta = '';
if (typeof objeto_apoyo.tipo_apoyo != 'undefined' && objeto_apoyo.tipo_apoyo) {
etiqueta = objeto_apoyo.tipo_apoyo;
}
var texto = '';
if (typeof objeto_apoyo.titulo_apoyo != 'undefined' && objeto_apoyo.titulo_apoyo) {
texto = objeto_apoyo.titulo_apoyo;
}
var url = '';
if (typeof objeto_apoyo.enlace_apoyo != 'undefined' && objeto_apoyo.enlace_apoyo) {
url = objeto_apoyo.enlace_apoyo;
}
if (texto != '') {
if (etiqueta != '') {
etiqueta += ': ';
}
html = html + '' + etiqueta;
if (url != '') {
html = html + '' + texto + ' » ';
}
else {
html = html + texto;
}
html = html + ' ';
}
}
return html;
}
function f_obtener_html_ultima_actualizacion_evento(ts_actualizacion, mostrar_horaminutosegundo) {
var ts_actual = '';
if (_tsServidor == 0) {
var date_actual = new Date();
var ts_actual = date_actual.getTime();
ts_actual = Math.round(ts_actual / 1000);
}
else {
ts_actual = _tsServidor;
}
var segundo = 1;
var minuto = 60 * segundo;
var hora = 60 * minuto;
var dia = 24 * hora;
ts_actualizacion = Math.round(ts_actualizacion);
diferencia = ts_actual - ts_actualizacion;
diferencia = Math.round(diferencia);
var tiempo = '';
var cadena = '';
var html = '';
if (diferencia < minuto) {
cadena = _ESKUPhashMsgByLang[LANGESKUP].menos_de_un_minuto.toLowerCase();
}
else if ( (diferencia > minuto) && (diferencia < hora) ) {
tiempo = parseInt(diferencia / minuto);
cadena = _ESKUPhashMsgByLang[LANGESKUP].hace.toLowerCase() + ' ' + tiempo + ' ' + _ESKUPhashMsgByLang[LANGESKUP].minutos;
}
else if ( (diferencia > hora) && (diferencia < dia) ) {
tiempo = parseInt(diferencia / hora);
if (tiempo == 1) {
cadena = _ESKUPhashMsgByLang[LANGESKUP].hace.toLowerCase() + ' ' + tiempo + ' ' + _ESKUPhashMsgByLang[LANGESKUP].hora;
} else {
cadena = _ESKUPhashMsgByLang[LANGESKUP].hace.toLowerCase() + ' ' + tiempo + ' ' + _ESKUPhashMsgByLang[LANGESKUP].horas;
}
}
else {
cadena = 'el día ' + f_obtener_fecha_visible(ts_actualizacion, mostrar_horaminutosegundo);
}
html = '' + cadena + ' ';
return html;
}
function f_obtener_fecha_visible(ts_fecha, mostrar_horaminutosegundo) {
var date_actualizacion = new Date(ts_fecha * 1000);
var dia = date_actualizacion.getDate();
var mes = date_actualizacion.getMonth();
var agno = date_actualizacion.getFullYear();
var hora = date_actualizacion.getHours();
var minuto = date_actualizacion.getMinutes();
var segundo = date_actualizacion.getSeconds();
if (dia <= 9) {
dia = '0' + dia;
}
mes++;
if (mes <= 9) {
mes = '0' + mes;
}
if (hora <= 9) {
hora = '0' + hora;
}
if (minuto <= 9) {
minuto = '0' + minuto;
}
if (segundo <= 9) {
segundo = '0' + segundo;
}
var cadena = dia + '/' + mes + '/' + agno;
var cadena_tiempo = '';
if (mostrar_horaminutosegundo == 1) {
cadena_tiempo = ' ' + _ESKUPhashMsgByLang[LANGESKUP].a_las + ' ' + hora + ':' + minuto + ':' + segundo;
}
cadena = cadena + cadena_tiempo;
return cadena;
}
function f_procesa_informacion_evento(idEvento, datos) {
var _hashTMP = Array();
eval("_hashTMP = " + datos);
if (! _hashTMP.perfilesEventos[idEvento]) {
return false;
}
else {
_hashDatosEvento = _hashTMP.perfilesEventos[idEvento];
}
if (_hashDatosEvento.pathfoto == '') {
_hashDatosEvento.pathfoto = _url_imagen_por_defecto;
}
if (! _hashDatosEvento.activo) {
_hashDatosEvento.activo = 0;
}
if (! _hashDatosEvento.num_mensajes) {
_hashDatosEvento.num_mensajes = '0';
}
if (! _hashDatosEvento.ts_ultimo_mensaje) {
_hashDatosEvento.ts_ultimo_mensaje = '';
}
if (! _hashDatosEvento.adm) {
_hashDatosEvento.adm = new Array();
}
if (! _hashDatosEvento.etiquetas) {
_hashDatosEvento.etiquetas = new Array();
}
if (! _hashDatosEvento.estado_seguimiento) {
_hashDatosEvento.estado_seguimiento = 0;
}
}
function f_pinta_nombre_usuario_en_mensaje(idUsuario, idCampo) {
if (idUsuario == '') {
return false;
}
var cadena_params = "action=info_usuarios&user=" + idUsuario;
var date_actual = new Date();
var ts_actual = date_actual.getTime();
cadena_params += "&ts=" + parseInt(ts_actual);
EPETUtils_makeHttpRequestGet(function(httpRequest) {
document.getElementById('boton_ver_nombre_completo').className = 'oculto';
document.getElementById('ver_nombre_completo_cargando').className = 'alavista';
var cajaNombre = document.getElementById(idCampo);
var nombreCompleto = 'No existe información';
if (httpRequest.status == 200) {
var hashTMP = Array();
var data = httpRequest.responseText;
eval("hashTMP = " + data);
if (hashTMP.perfilesUsuarios[idUsuario]) {
hashDatos = hashTMP.perfilesUsuarios[idUsuario];
var nombreUsuario = hashDatos.nombre;
var apellidosUsuario = hashDatos.apellidos;
if (apellidosUsuario != '') {
nombreCompleto = nombreUsuario + ' ' + apellidosUsuario;
}
else {
if (nombreUsuario != '') {
nombreCompleto = nombreUsuario;
}
}
}
}
if (document.getElementById(idCampo)) {
cajaNombre.innerHTML = '(' + nombreCompleto + ')';
}
document.getElementById('ver_nombre_completo_cargando').className = 'oculto';
}, _urlESKUP + "&" + cadena_params);
}
function f_mostrar_menu_botones(tipoMenu, estadoBotonArriba, id) {
var estilo_boton_arriba = '';
var mostrar_boton_abajo = '';
if (tipoMenu == 'seguir_usuario') {
var opcion_menu_arriba = document.getElementById('opcion_seguir_usuario1_' + id);
var opcion_menu_abajo = document.getElementById('opcion_seguir_usuario2_' + id);
if (opcion_menu_abajo.style.display == 'none') {
mostrar_boton_abajo = '';
if (estadoBotonArriba == 'off') {
estilo_boton_arriba = 'boton seguir1offpulsado';
}
else {
estilo_boton_arriba = 'boton seguir1onpulsado';
}
}
else {
mostrar_boton_abajo = 'none';
if (estadoBotonArriba == 'off') {
estilo_boton_arriba = 'boton seguir1offreposo';
}
else {
estilo_boton_arriba = 'boton seguir1onreposo';
}
}
opcion_menu_arriba.className = estilo_boton_arriba;
opcion_menu_abajo.style.display = mostrar_boton_abajo;
}
else if (tipoMenu == 'bloquear_usuario') {
var opcion_menu_arriba = document.getElementById('opcion_bloquear_usuario1_' + id);
var opcion_menu_abajo = document.getElementById('opcion_bloquear_usuario2_' + id);
if (opcion_menu_abajo.style.display == 'none') {
mostrar_boton_abajo = '';
if (estadoBotonArriba == 'off') {
estilo_boton_arriba = 'boton bloquear1offpulsado';
}
else {
estilo_boton_arriba = 'boton bloquear1onpulsado';
}
}
else {
mostrar_boton_abajo = 'none';
if (estadoBotonArriba == 'off') {
estilo_boton_arriba = 'boton bloquear1offreposo';
}
else {
estilo_boton_arriba = 'boton bloquear1onreposo';
}
}
opcion_menu_arriba.className = estilo_boton_arriba;
opcion_menu_abajo.style.display = mostrar_boton_abajo;
}
else if (tipoMenu == 'seguir_evento') {
var opcion_menu_arriba = document.getElementById('opcion_seguir_evento1_' + id);
var opcion_menu_abajo = document.getElementById('opcion_seguir_evento2_' + id);
if (opcion_menu_abajo.style.display == 'none') {
mostrar_boton_abajo = '';
if (estadoBotonArriba == 'off') {
estilo_boton_arriba = 'boton seguir1offpulsado';
}
else {
estilo_boton_arriba = 'boton seguir1onpulsado';
}
}
else {
mostrar_boton_abajo = 'none';
if (estadoBotonArriba == 'off') {
estilo_boton_arriba = 'boton seguir1offreposo';
}
else {
estilo_boton_arriba = 'boton seguir1onreposo';
}
}
opcion_menu_arriba.className = estilo_boton_arriba;
opcion_menu_abajo.style.display = mostrar_boton_abajo;
}
else if (tipoMenu == 'escribir_evento') {
var opcion_menu_arriba = document.getElementById('opcion_escribir_evento1_' + id);
var opcion_menu_abajo = document.getElementById('opcion_escribir_evento2_' + id);
if (opcion_menu_abajo.style.display == 'none') {
opcion_menu_abajo.style.display = '';
opcion_menu_arriba.className = 'cerrar encima';
}
else {
opcion_menu_abajo.style.display = 'none';
opcion_menu_arriba.className = 'cerrar';
}
}
else {
}
}
function f_seleccionar_opcion_menu(tipoMenu, accion, id) {
if (tipoMenu == 'seguir_usuario') {
f_peticion_eskup_seguir_usuario(accion, id);
}
else if (tipoMenu == 'bloquear_usuario') {
f_peticion_eskup_bloquear_usuario(accion, id);
}
else if (tipoMenu == 'seguir_evento') {
f_peticion_eskup_seguir_evento(accion, id);
}
else {
}
}
function f_componer_html_botones_menu_seguir_evento(eventoSeguido, idEvento) {
var html_menu = '';
if (eventoSeguido == false) {
html_menu = html_menu + ' Quiero seguirlo ';
html_menu = html_menu + ' ' + _ESKUPhashMsgByLang[LANGESKUP].confirmar + ' ';
}
else {
html_menu = html_menu + ' Lo sigues ';
html_menu = html_menu + ' Dejar de seguir ';
}
return html_menu;
}
function f_componer_html_botones_menu_escribir_evento(eventoParaEscribir, idEvento, tipoSuscripcionEvento) {
var html_menu = '';
if (eventoParaEscribir == false) {
html_menu = html_menu + 'Ya no estás apuntado para escribir ';
}
else {
html_menu = html_menu + ' Dejar de escribir ';
html_menu = html_menu + ' ' + _ESKUPhashMsgByLang[LANGESKUP].confirmar + ' ';
}
return html_menu;
}
function f_componer_html_botones_menu_seguir_usuario(usuarioSeguido, idUsuario) {
var html_menu = '';
if (usuarioSeguido == false) {
html_menu = html_menu + ' Quiero seguirle ';
html_menu = html_menu + ' ' + _ESKUPhashMsgByLang[LANGESKUP].confirmar + ' ';
}
else {
html_menu = html_menu + ' Le sigues ';
html_menu = html_menu + ' Dejar de seguir ';
}
return html_menu;
}
function f_componer_html_botones_menu_bloquear(usuarioBloqueado, idUsuario) {
var html_menu = '';
if (usuarioBloqueado == false) {
html_menu = html_menu + ' Bloquear ';
html_menu = html_menu + ' Activar bloqueo ';
}
else {
html_menu = html_menu + ' Bloqueado ';
html_menu = html_menu + ' Desbloquear ';
}
return html_menu;
}
function f_pinta_html_informacion_usuario(idUsuario, hashDatosUsuario) {
var html = '';
var estilo_dejar_usuario = '';
var estilo_seguir_usuario = '';
var estilo_bloquear_usuario = '';
var estilo_desbloquear_usuario = '';
var nombreUsuario = hashDatosUsuario.nombre;
var apellidosUsuario = hashDatosUsuario.apellidos;
var usuarioActivo = hashDatosUsuario.activo;
var pathfotoUsuario = hashDatosUsuario.pathfoto;
var nombreCompleto = nombreUsuario;
if (apellidosUsuario != '') {
nombreCompleto = nombreUsuario + ' ' + apellidosUsuario;
}
if (pathfotoUsuario == '') {
pathfotoUsuario = _url_imagen_usuario_por_defecto;
}
var urlUsuario = '';
var urlTwitter = '';
var urlBlog = '';
var profesionUsuario = '';
var descripcionUsuario = '';
if (hashDatosUsuario.urlwebpersonal) {
urlUsuario = f_comprobar_url_valida(hashDatosUsuario.urlwebpersonal);
}
if (hashDatosUsuario.urlblog) {
urlBlog = f_comprobar_url_valida(hashDatosUsuario.urlblog);
}
if (hashDatosUsuario.urltwitter) {
urlTwitter = f_comprobar_url_valida(hashDatosUsuario.urltwitter);
}
if (hashDatosUsuario.profesion) {
profesionUsuario = hashDatosUsuario.profesion;
}
if (hashDatosUsuario.descripcion) {
descripcionUsuario = hashDatosUsuario.descripcion;
}
var usuarioSeguido = false;
var usuarioBloqueado = false;
if (_nickname != '') {
if (hashDatosUsuario.seguido == 1) {
usuarioSeguido = true;
}
else {
usuarioSeguido = false;
}
if (hashDatosUsuario.bloqueado == 1) {
usuarioBloqueado = true;
}
}
var numeroUsuariosSeguidores = hashDatosUsuario.numero_seguidores;
var numeroUsuariosSeguidos = hashDatosUsuario.numero_usuarios;
var numeroEventosSeguidos = hashDatosUsuario.numero_eventos;
var numeroEventosEscritura = hashDatosUsuario.numero_eventos_escribe;
var numeroMensajes = hashDatosUsuario.numero_mensajes_propios;
var numeroReferencias = hashDatosUsuario.numero_mensajes_referenciados;
var numeroEventosAdministrados = 0;
if (hashDatosUsuario.numero_eventos_administrados) {
numeroEventosAdministrados = hashDatosUsuario.numero_eventos_administrados;
}
var estado_conectado = '';
var descripcion_conectado = '';
if (usuarioActivo == '0') {
estado_conectado = 'noconectado';
descripcion_conectado = 'No conectado';
}
else {
estado_conectado = 'conectado';
descripcion_conectado = 'Conectado';
}
var html_botones_seguir = '';
var html_botones_bloquear = '';
if (_nickname != '') {
html_botones_seguir = f_componer_html_botones_menu_seguir_usuario(usuarioSeguido, idUsuario);
if (idUsuario != _nickname) {
html_botones_bloquear = f_componer_html_botones_menu_bloquear(usuarioBloqueado, idUsuario);
}
else {
}
}
else {
}
var alias_bonito = idUsuario;
if (typeof _hashDatosUsuario['alias_bonito']!='undefined' && _hashDatosUsuario['alias_bonito']!=''){
alias_bonito = _hashDatosUsuario['alias_bonito'];
}
html = html + '';
html = html + ' ';
html = html + ' ';
html = html + '
' + alias_bonito+ ' ';
html = html + ' ';
if ( (_nickname != '') && (idUsuario != _nickname) ) {
html = html + '
Enviar privado ';
}
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '';
html = html + '
';
html = html + '
';
html = html + '
' + descripcion_conectado + '
';
html = html + '
';
html = html + '
';
var muestra_enlaces_externos = 'style=""';
var estilo_columna_derecha = '';
if ( (urlUsuario != '') || (urlTwitter != '') || (urlBlog != '')) {
muestra_enlaces_externos = 'style=""';
estilo_columna_derecha = '';
}
html = html + '';
html = html + '
';
html = html + '
';
html = html + '
';
if (urlUsuario != '') {
html = html + ' web » ';
}
if (urlTwitter != '') {
html = html + ' twitter » ';
}
if (urlBlog != '') {
html = html + ' blog » ';
}
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + '';
if (nombreCompleto != '') {
html = html + '
' + nombreCompleto + '
';
}
if (descripcionUsuario != '') {
html = html + '
' + descripcionUsuario + '
';
}
html = html + '
';
html = html + '
';
html = html + '
Usuarios ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
Mensajes ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
Temas ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
var caja = document.getElementById('id_info_usuariotema');
caja.innerHTML = html;
if (idUsuario == _nickname) {
caja.style.display = 'none';
}
}
function f_detalles_usuario(operacion, idUsuario) {
var boton_mostrar_detalles = document.getElementById('boton_mostrar_detalles');
var boton_ocultar_detalles = document.getElementById('boton_ocultar_detalles');
var caja_detalles = document.getElementById('id_detalles_usuario');
if (operacion == 'abrir') {
_detallesUsuarioCerrados = false;
boton_mostrar_detalles.style.display = 'none';
boton_ocultar_detalles.style.display = '';
caja_detalles.style.display = '';
f_cerrar_panel('id_escribir_mensaje_' + idUsuario);
}
else {
_detallesUsuarioCerrados = true;
boton_mostrar_detalles.style.display = '';
boton_ocultar_detalles.style.display = 'none';
caja_detalles.style.display = 'none';
}
}
function f_descripcion_usuario(operacion, idUsuario) {
var boton_mostrar_detalles = document.getElementById('boton_mostrar_detalles');
var boton_ocultar_detalles = document.getElementById('boton_ocultar_detalles');
var caja_descripcion = document.getElementById('id_descripcion_usuario');
if (operacion == 'abrir') {
boton_mostrar_detalles.style.display = 'none';
boton_ocultar_detalles.style.display = '';
caja_descripcion.style.display = '';
}
else {
_detallesUsuarioCerrados = true;
boton_mostrar_detalles.style.display = '';
boton_ocultar_detalles.style.display = 'none';
caja_descripcion.style.display = 'none';
}
}
function f_detalles_panel_usuario(idDivUsuarioTema) {
var boton_mostrar_detalles = document.getElementById('id_boton_mostrar_detalles_panel_usuario');
var divCajaPerfilUsuario = document.getElementById(idDivUsuarioTema);
if (divCajaPerfilUsuario.style.display == '') {
boton_mostrar_detalles.className = 'enlace ver';
boton_mostrar_detalles.innerHTML = 'Ver mis datos';
divCajaPerfilUsuario.style.display = 'none';
}
else {
boton_mostrar_detalles.className = 'enlace ocultar';
boton_mostrar_detalles.innerHTML = 'Ocultar mis datos';
divCajaPerfilUsuario.style.display = '';
}
}
function f_desactiva_pestana_perfil_usuario() {
if (document.getElementById('opcion_bloquear_usuario')) {
document.getElementById('opcion_bloquear_usuario').className = '';
}
if (document.getElementById('opcion_desbloquear_usuario')) {
document.getElementById('opcion_desbloquear_usuario').className = '';
}
if (document.getElementById('opcion_seguir_usuario')) {
document.getElementById('opcion_seguir_usuario').className = '';
}
if (document.getElementById('opcion_dejar_usuario')) {
document.getElementById('opcion_dejar_usuario').className = '';
}
if (document.getElementById('opcion_envio_privado')) {
document.getElementById('opcion_envio_privado').className = '';
}
}
function f_confirmar_peticion_bloquear(operacion, idUsuario) {
var html = '';
var mensaje = '';
var boton_bloquear = document.getElementById('opcion_bloquear_usuario');
var boton_desbloquear = document.getElementById('opcion_desbloquear_usuario');
if (operacion == 'bloquear') {
mensaje = 'Si bloqueas al usuario evitarás que te mande mensajes privados. ¿Seguro que quieres bloquearlo?';
f_desactiva_pestana_perfil_usuario();
boton_bloquear.className = 'activo';
}
else {
mensaje = '¿Seguro que quieres desbloquear al usuario para que pueda volver a mandarte mensajes privados?';
f_desactiva_pestana_perfil_usuario();
boton_desbloquear.className = 'activo';
}
var html = '';
html = html + '';
html = html + '
';
html = html + '
';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_pinta_caja_confirmacion_seguir_movil(operacion, idUsuario) {
var html = '';
var mensaje = '';
var boton_seguir = document.getElementById('opcion_seguir_usuario');
var boton_dejar = document.getElementById('opcion_dejar_usuario');
if (operacion == 'seguir') {
if (idUsuario != _nickname) {
mensaje = '¿Seguro que quieres seguir al usuario?';
}
else {
mensaje = '¿Seguro que quieres seguirte?';
}
f_desactiva_pestana_perfil_usuario();
boton_seguir.className = 'activo';
}
else {
if (idUsuario != _nickname) {
mensaje = '¿Seguro que quieres dejar de seguir al usuario?';
}
else {
mensaje = '¿Seguro que quieres dejar de seguirte?';
}
f_desactiva_pestana_perfil_usuario();
boton_dejar.className = 'activo';
}
var html = '';
html = html + '';
html = html + '
';
html = html + '
';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_pinta_caja_confirmacion_seguir_evento_movil(operacion, idEvento) {
var html = '';
var mensaje = '';
var boton_seguir = document.getElementById('opcion_seguir_tema');
var boton_dejar = document.getElementById('opcion_yanoseguir_tema');
if (operacion == 'seguir') {
mensaje = '¿Seguro que quieres seguir al evento?';
boton_seguir.className = '';
boton_dejar.className = 'activo';
}
else {
mensaje = '¿Seguro que quieres dejar de seguir al evento?';
boton_seguir.className = 'activo';
boton_dejar.className = '';
}
var html = '';
html = html + '';
html = html + '
';
html = html + '
';
var divCapaConfirmaciones = document.getElementById('id_confirmaciones');
divCapaConfirmaciones.innerHTML = html;
divCapaConfirmaciones.style.display = '';
}
function f_cierra_capa_confirmaciones() {
var divCapaConfirmaciones = document.getElementById('id_confirmaciones')
divCapaConfirmaciones.innerHTML = '';
divCapaConfirmaciones.style.display = 'none';
document.getElementById('opcion_seguir_tema').className = '';
document.getElementById('opcion_yanoseguir_tema').className = '';
}
function f_pinta_caja_envio_privado(idUsuario) {
var html = '';
var mensaje = '';
var divContenedorFormularioMensaje = document.getElementById('contenedor_formulario_' + idUsuario);
var divContenedorBotonPrivado = document.getElementById('boton_privado_' + idUsuario);
if (divContenedorFormularioMensaje.style.display == '') {
f_ocultar_formulario_mensaje(idUsuario);
return;
}
divContenedorBotonPrivado.className = 'boton privado activo';
if (divContenedorFormularioMensaje.childNodes.length != 0) {
}
else {
var divMsgForm = crearFormularioMensaje(idUsuario);
divContenedorFormularioMensaje.appendChild(divMsgForm);
}
document.getElementById("c_" + idUsuario).value = 'add';
document.getElementById("t_" + idUsuario).value = idUsuario;
if (document.getElementById('diviframe_' + idUsuario)) {
document.body.removeChild(document.getElementById('diviframe_' + idUsuario));
}
f_inicia_caja_escribir("m_" + idUsuario, '', 'cajaactiva', 'secundario activo');
var divBotonPublicar = document.getElementById('submitresponder_' + idUsuario);
divBotonPublicar.innerHTML = _ESKUPhashMsgByLang[LANGESKUP].enviar;
crearIframeTargetFormulario(idUsuario, 'privadoperfil');
document.getElementById('form_' + idUsuario).target = 'iframe_' + idUsuario;
f_muestra_servicios_externos(idUsuario, false);
f_mostrar_ocultar_panel_eventos_donde_publicar(idUsuario, false);
divContenedorFormularioMensaje.style.display = '';
}
function f_pinta_caja_envio_privado_bloqueado(idUsuario) {
if (document.getElementById('opcion_envio_privado')) {
var boton_envio = document.getElementById('opcion_envio_privado');
boton_envio.className = 'activo';
}
var html = '';
html = html + '';
html = html + '
El usuario te tiene bloqueado, no quiere recibir mensajes privados tuyos.....
';
html = html + '
';
html = html + '
';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
}
function f_pinta_caja_adjuntar_imagen_privado(idCaja) {
var html = "";
html = html + ' ';
var divCaja = document.getElementById(idCaja);
divCaja.innerHTML = html;
divCaja.style.display = '';
var boton_adjuntar = document.getElementById('id_boton_adjuntar_imagen');
boton_adjuntar.className = 'botonactivo';
}
function f_comprobar_usuario_bloqueado(idUsuario) {
var cadena_params = 'verify=1&text=' + idUsuario;
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var json = httpRequest.responseText;
eval("_hashVerify = " + json);
var data = _hashVerify.value;
if (data != 0) {
f_pinta_caja_envio_privado_bloqueado(idUsuario);
}
}
}, _urlDENEGACIONES + "&" + cadena_params);
}
function f_confirmar_enviar_mensaje_privado(idUsuario) {
var divCajaMensaje = document.getElementById('campo_formulario_texto_mensaje');
var contenido_mensaje = divCajaMensaje.value;
if ( f_es_valor_vacio(contenido_mensaje) || (contenido_mensaje == _texto_inicializacion_textarea) ) {
alert(_ESKUPhashMsgByLang[LANGESKUP].no_has_escrito_nada);
return false;
}
if ( ! f_es_longitud_correcta(contenido_mensaje)) {
alert(_ESKUPhashMsgByLang[LANGESKUP].el_mensaje_no_puede_tener_mas_de + _numero_maximo_caracteres_mensaje + ' ' + _ESKUPhashMsgByLang[LANGESKUP].caracteres);
return false;
}
f_enviar_mensaje_privado(idUsuario);
}
function f_enviar_mensaje_privado(idUsuario) {
document.getElementById('m').value = document.getElementById('campo_formulario_texto_mensaje').value;
var divContenedor = document.getElementById("id_escribir_mensaje_" + idUsuario);
var divTrabajando = document.createElement("DIV");
divTrabajando.id = "trabajando_botones";
divTrabajando.className = "trabajando";
divContenedor.insertBefore(divTrabajando, divContenedor.firstChild);
var formulario = document.getElementById('id_form_mensaje_privado');
formulario.submit();
}
function comprobarPost_mensaje_privado(idMensaje, comando, idUsuario) {
var i = document.getElementById("iframe_"+idMensaje);
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames["iframe_"+idMensaje].document;
}
if (d.location.href == "about:blank") {
return true;
}
if (!d.getElementById("status")) {
alert(_ESKUPhashMsgByLang[LANGESKUP].error_al_enviar_el_mensaje);
f_quitar_div_trabajando('id_escribir_mensaje_' + idUsuario, 'trabajando_botones');
return false;
}
if (d.getElementById("status").innerHTML != "OK") {
msg = d.getElementById("info").innerHTML + " (Error " +d.getElementById("code").innerHTML + ")";
alert(msg);
f_quitar_div_trabajando('id_escribir_mensaje_' + idUsuario, 'trabajando_botones');
return false;
}
var mensaje = _ESKUPhashMsgByLang[LANGESKUP].mensaje_enviado_correctamente;
if (d.getElementById("info").innerHTML != "") {
mensaje = d.getElementById("info").innerHTML;
alert(mensaje);
}
var html = '';
html = html + '';
html = html + '
' + mensaje + '
';
html = html + '
';
html = html + '
';
var divCajaEscribir = document.getElementById('id_escribir_mensaje_' + idUsuario);
divCajaEscribir.innerHTML = html;
divCajaEscribir.style.display = '';
f_limpia_campos_formulario_evento(idMensaje);
i.src = "about:blank";
return true;
}
function f_peticion_eskup_seguir_usuario(operacion, idUsuario) {
var cadena_params = 'user=' + _nickname + '&data=' + idUsuario;
if (operacion == 'seguir') {
cadena_params = cadena_params + '&action=add_usuarios';
}
else {
cadena_params = cadena_params + '&action=del_usuarios';
}
_operacion = operacion;
_idUsuario = idUsuario;
EPETUtils_makeHttpRequestGet(f_procesa_peticion_eskup_seguir_usuario, _urlESKUP + "&" + cadena_params);
}
function f_procesa_peticion_eskup_seguir_usuario(httpRequest) {
if (httpRequest.status != 200) {
var texto_mensaje = _ESKUPhashMsgByLang[LANGESKUP].error_al_realizar_la_operacion;
alert(texto_mensaje);
}
else {
var data = httpRequest.responseText;
f_obtener_quien_sigo();
var num_seguidores = 0;
var num_seguidos = 0;
var valor_usuarios_seguidores = 0;
var valor_usuarios_seguidos = 0;
if (_idUsuario == _nickname) {
var divCajaNumeroUsuariosSeguidores = document.getElementById('id_numero_usuarios_que_me_siguen');
if (divCajaNumeroUsuariosSeguidores) {
valor_usuarios_seguidores = divCajaNumeroUsuariosSeguidores.innerHTML;
}
var divCajaNumeroUsuariosSeguidos = document.getElementById('id_numero_usuarios_que_sigo');
if (divCajaNumeroUsuariosSeguidos) {
valor_usuarios_seguidos = divCajaNumeroUsuariosSeguidos.innerHTML;
}
}
else {
var divCajaNumeroUsuariosSeguidores = document.getElementById('id_numero_usuarios_seguidores_' + _idUsuario);
if (divCajaNumeroUsuariosSeguidores) {
valor_usuarios_seguidores = divCajaNumeroUsuariosSeguidores.innerHTML;
}
var divCajaNumeroUsuariosSeguidos = document.getElementById('id_numero_usuarios_seguidos_' + _idUsuario);
if (divCajaNumeroUsuariosSeguidos) {
valor_usuarios_seguidos = divCajaNumeroUsuariosSeguidos.innerHTML;
}
}
if (_operacion == 'seguir') {
usuarioSeguido = true;
num_seguidores = parseInt(valor_usuarios_seguidores, 10) + 1;
num_seguidos = parseInt(valor_usuarios_seguidos, 10) + 1;
}
else {
usuarioSeguido = false;
num_seguidores = parseInt(valor_usuarios_seguidores, 10) - 1;
num_seguidos = parseInt(valor_usuarios_seguidos, 10) -1;
}
if (divCajaNumeroUsuariosSeguidores) {
divCajaNumeroUsuariosSeguidores.innerHTML = num_seguidores;
}
if (_idUsuario == _nickname) {
if (document.getElementById('id_numero_usuarios_seguidos_' + _idUsuario)) {
var divCaja = document.getElementById('id_numero_usuarios_seguidos_' + _idUsuario);
divCaja.innerHTML = num_seguidos;
}
if (document.getElementById('id_numero_usuarios_seguidores_' + _idUsuario)) {
var divCaja = document.getElementById('id_numero_usuarios_seguidores_' + _idUsuario);
divCaja.innerHTML = num_seguidores;
}
var divCaja = document.getElementById('id_numero_usuarios_que_sigo');
divCaja.innerHTML = num_seguidos;
var divCaja = document.getElementById('id_numero_usuarios_que_me_siguen');
divCaja.innerHTML = num_seguidores;
}
var html_botones_menu_seguir = f_componer_html_botones_menu_seguir_usuario(usuarioSeguido, _idUsuario);
var divMenu = document.getElementById('id_menu_botones_seguir_' + _idUsuario);
divMenu.innerHTML = html_botones_menu_seguir;
}
}
function f_peticion_eskup_bloquear_usuario(operacion, idUsuario) {
var cadena_params = 'data=' + idUsuario;
if (operacion == 'bloquear') {
cadena_params = cadena_params + '&action=add_denegaciones';
}
else {
cadena_params = cadena_params + '&action=del_denegaciones';
}
_operacion = operacion;
_idUsuario = idUsuario;
EPETUtils_makeHttpRequestGet(f_procesa_peticion_eskup_bloquear_usuario, _urlESKUP + "&" + cadena_params);
}
function f_procesa_peticion_eskup_bloquear_usuario(httpRequest) {
if (httpRequest.status != 200) {
var texto_mensaje = _ESKUPhashMsgByLang[LANGESKUP].error_al_realizar_la_operacion;
alert(texto_mensaje);
}
else {
var data = httpRequest.responseText;
if (_operacion == 'bloquear') {
usuarioBloqueado = true;
}
else {
usuarioBloqueado = false;
}
var html_botones_menu_bloquear = f_componer_html_botones_menu_bloquear(usuarioBloqueado, _idUsuario);
var divMenu = document.getElementById('id_menu_botones_bloquear_' + _idUsuario);
divMenu.innerHTML = html_botones_menu_bloquear;
}
}
function f_peticion_eskup_seguir_evento(operacion, idEvento) {
var cadena_params = 'user=' + _nickname + '&data=' + idEvento;
if (operacion == 'seguir') {
cadena_params = cadena_params + '&action=add_eventos';
}
else {
cadena_params = cadena_params + '&action=del_eventos';
}
_operacion = operacion;
_idEvento = idEvento;
EPETUtils_makeHttpRequestGet(f_procesa_peticion_eskup_seguir_evento, _urlESKUP + "&" + cadena_params);
}
function f_procesa_peticion_eskup_seguir_evento(httpRequest) {
var html = '';
var mensaje = '';
if (httpRequest.status != 200) {
html_mensaje = _ESKUPhashMsgByLang[LANGESKUP].error_al_realizar_la_operacion;
alert(html_mensaje);
}
else {
var data = httpRequest.responseText;
_obtenidasSuscripciones = false;
f_obtener_eventos_seguidos('id_mistemas');
var seguimiento_evento = false;
var divCajaUsuariosSeguidores = document.getElementById('id_numero_usuarios_seguidores_' + _idEvento);
var divCajaTemasSeguidos = document.getElementById('id_numero_temas_seguidos');
var num_seguidores = 0;
var num_temas_seguidos = 0;
if (divCajaUsuariosSeguidores) {
num_seguidores = parseInt(divCajaUsuariosSeguidores.innerHTML, 10);
}
if (divCajaTemasSeguidos) {
num_temas_seguidos = parseInt(divCajaTemasSeguidos.innerHTML, 10);
}
if (_operacion == 'seguir') {
seguimiento_evento = true;
num_seguidores = num_seguidores + 1;
num_temas_seguidos = num_temas_seguidos + 1;
_hashDatosEvento.estado_seguimiento = 1;
}
else {
seguimiento_evento = false;
num_seguidores = num_seguidores - 1;
num_temas_seguidos = num_temas_seguidos - 1;
if (num_seguidores < 0) {
num_seguidores = 0;
}
if (num_temas_seguidos < 0) {
num_temas_seguidos = 0;
}
_hashDatosEvento.estado_seguimiento = 0;
}
if (divCajaUsuariosSeguidores) {
divCajaUsuariosSeguidores.innerHTML = num_seguidores;
}
if (divCajaTemasSeguidos) {
divCajaTemasSeguidos.innerHTML = num_temas_seguidos;
}
var html_botones_menu_seguir = f_componer_html_botones_menu_seguir_evento(seguimiento_evento, _idEvento);
var divMenu = document.getElementById('id_menu_botones_seguir_' + _idEvento);
divMenu.innerHTML = html_botones_menu_seguir;
}
}
function seguirUsuario(operacion, idUsuario, callbackSeguirUsuario) {
if (typeof _nickname == "undefined" || _nickname == '') {
alert(_ESKUPhashMsgByLang[LANGESKUP].para_seguir_al_usuario);
return(false);
}
var cadena_params = 'user=' + _nickname + '&data=' + idUsuario;
cadena_params += '&action=' + operacion + '_usuarios';
_operacion = operacion;
_nicknameASeguir = idUsuario;
EPETUtils_makeHttpRequestGet(callbackSeguirUsuario, _urlESKUP + "&" + cadena_params);
}
function f_peticion_eskup_escritura(idEvento) {
var texto_solicitud = '';
if (document.getElementById('id_campo_formulario_texto_solicitud')) {
var divCajaSolicitud = document.getElementById('id_campo_formulario_texto_solicitud');
texto_solicitud = trim(divCajaSolicitud.value);
if (texto_solicitud == '') {
alert('Es necesario que nos envies el texto de solicitud para poder aprobar tu petición');
return false;
}
}
var cadena_params = 'action=add_writers&user=' + _nickname + '&data=' + idEvento;
if (texto_solicitud != '') {
cadena_params = cadena_params + '&msg=' + texto_solicitud;
}
_idEvento = idEvento;
if (typeof _formatoVisualizacion != "undefined" && _formatoVisualizacion == "movil") {
EPETUtils_makeHttpRequestGet(f_procesa_peticion_eskup_escritura_movil, _urlESKUP + "&" + cadena_params);
} else {
EPETUtils_makeHttpRequestGet(f_procesa_peticion_eskup_escritura, _urlESKUP + "&" + cadena_params);
}
}
function f_procesa_peticion_eskup_escritura(httpRequest) {
var html = '';
var html_mensaje = '';
var html_escribir = '';
var clase_div = ''
if (httpRequest.status != 200) {
html_mensaje = html_mensaje + ' ';
html_mensaje = html_mensaje + '
Se ha producido un error en la petición. Por favor, inténtalo más tarde.
';
html_mensaje = html_mensaje + '
';
html_escribir = f_obtener_html_caja_escribir_evento_falsa();
clase_div = 'escribirmensajefalsa';
}
else {
var data = httpRequest.responseText;
if (_hashDatosEvento.tipo_suscripcion == 1) {
_hashDatosEvento.estado_escritura = 1;
if (!(typeof _quiensoy != "undefined" && _quiensoy == "widget")){
var divTemasEscritos = document.getElementById('id_numero_temas_escritos');
divTemasEscritos.innerHTML = parseInt(divTemasEscritos.innerHTML, 10) + 1;
}
}
else {
if (typeof _hashDatosEvento.tipo_evento != 'undefined' &&
_hashDatosEvento.tipo_evento == 200) {
_hashDatosEvento.estado_escritura = 1;
} else {
_hashDatosEvento.estado_escritura = 2;
html_mensaje = html_mensaje + ' ';
html_mensaje = html_mensaje + '
Estamos analizando tu solicitud para escribir. En breve nos pondremos en contacto contigo. ¡Gracias!
';
html_mensaje = html_mensaje + '
';
html_escribir = f_obtener_html_caja_escribir_evento_falsa();
clase_div = 'escribirmensajefalsa';
}
}
}
var html = '';
html = html + html_mensaje;
html = html + '
';
html = html + '
';
html = html + html_escribir;
var divCajaEscribir = document.getElementById('id_escribir_mensaje');
if (divCajaEscribir) {
if (_hashDatosEvento.tipo_suscripcion != 1){
if (typeof _hashDatosEvento.tipo_evento == 'undefined' ||
_hashDatosEvento.tipo_evento != 200) {
divCajaEscribir.innerHTML = html;
divCajaEscribir.className = clase_div;
}
}
divCajaEscribir.style.display = '';
}
}
function muestraMensajesResultadoBusquedas(numPagina, numTotalMensajes, numMensajes, hashDatosMensajes) {
var html = "";
_numPagActual = parseInt(numPagina, 10);
for (var i = 0; i < numMensajes; i++) {
if (hashDatosMensajes[i]) {
html += pintaMensaje(hashDatosMensajes[i]);
}
}
var divContenedor = document.getElementById(_idContenedorMsgs);
divContenedor.innerHTML = html;
pintaPaginacionResultadoBusquedas(numTotalMensajes, numMensajes);
}
function pintaPaginacionResultadoBusquedas(numTotalMensajes, numMensajes) {
if (typeof _pintarPaginacion != "undefined" && _pintarPaginacion == false) {
return(false);
}
if ( ( _numPagActual == 1) && (numTotalMensajes <= _numMsgPag) ) {
return(false);
}
var html = '';
if (_numPagActual == 1) {
html += '<< ';
} else {
html += '<< ';
}
var paginaAnterior = _numPagActual - 1;
var paginaSiguiente = _numPagActual + 1;
if (_numPagActual > 1) {
html += '< ';
} else {
html += '< ';
}
html += '' + _numPagActual + ' ';
if (parseInt(_numPagActual*_numMsgPag) < parseInt(numTotalMensajes)) {
html += '> ';
} else {
html += '> ';
}
html += ' ';
var divContenedorAbajo = document.getElementById(_idContenedorPag + '_abajo');
divContenedorAbajo.innerHTML = html;
divContenedorAbajo.style.display = '';
if (document.getElementById('div_subir_pagina')) {
var divSubir = document.getElementById('div_subir_pagina');
divSubir.style.display = '';
}
}
function f_buscar_contenido(numeroPagina, tipoOrdenacion) {
var cadena = '';
if (_cadenaQ != '') {
cadena = 'q=' + unescape(_cadenaQ);
}
else {
cadena = 'qru=' + _cadenaQRU;
}
location.href='/resultado_buscar.html?r=php&' + cadena + '&p=' + numeroPagina + '&s=' + tipoOrdenacion + '&n=' + _numMsgPag;
}
function f_buscar_contenido_por_relevancia(numeroPagina) {
_tipoOrdenacionBusquedas = 'r';
f_buscar_contenido(numeroPagina, _tipoOrdenacionBusquedas);
}
function f_buscar_contenido_por_frescura(numeroPagina) {
_tipoOrdenacionBusquedas = 'd';
f_buscar_contenido(numeroPagina, _tipoOrdenacionBusquedas);
}
function f_buscar_relacionado(idMensaje) {
location.href='/resultado_buscar.html?r=php&qru=' + idMensaje;
}
function f_muestra_listado_temas_eskup(hashEventosESKUP, hashEventosESKUPExtra, hashEventosSeguidosUsuario) {
var idUsuario = '';
var tipoListado = 0;
f_muestra_listado_temas(hashEventosESKUP, hashEventosSeguidosUsuario, hashEventosESKUPExtra, idUsuario, tipoListado);
}
function f_muestra_listado_temas_destacados_eskup(hashEventosESKUP, hashEventosESKUPExtra, hashEventosSeguidosUsuario) {
var idUsuario = '';
var tipoListado = 3;
f_muestra_listado_temas(hashEventosESKUP, hashEventosSeguidosUsuario, hashEventosESKUPExtra, idUsuario, tipoListado);
}
function f_muestra_listado_temas_usuario(hashEventos, hashEventosSeguidosUsuario, idUsuario, tipoListado) {
f_muestra_listado_temas(hashEventos, hashEventosSeguidosUsuario, hashEventos, idUsuario, tipoListado);
}
function f_muestra_listado_temas(listaTemas, listaEventosSeguidosUsuario, listaDatosTemasExtra, idUsuario, tipo_listado) {
var html = '';
var html_encabezado = '';
var html_sintemas = '';
var numero_temas = 0;
for (var claveTema in listaTemas) {
var idEvento = claveTema;
var datosTema = listaTemas[claveTema];
numero_temas++;
var datosExtra = Array();
if (listaDatosTemasExtra[claveTema]) {
datosExtra = listaDatosTemasExtra[claveTema];
}
if (datosTema.pathfoto == '') {
datosTema.pathfoto = _url_imagen_por_defecto;
}
var listaPropietarios = Array();
if (datosTema.prop) {
listaPropietarios = datosTema.prop;
}
var listaAdministradores = Array();
if (datosTema.adm) {
listaAdministradores = datosTema.adm;
}
var es_propietario = f_existe_usuario_en_lista(_nickname, listaPropietarios);
var es_administrador = f_existe_usuario_en_lista(_nickname, listaAdministradores);
html = html + '';
html = html + '
';
var seguimiento_usuario = false;
if (listaEventosSeguidosUsuario[claveTema]) {
seguimiento_usuario = true;
}
if (datosExtra.estado_seguimiento == 1) {
seguimiento_usuario = true;
}
var tipoSuscripcionEvento = datosTema.tipo_suscripcion;
var html_botones_menu_seguir = '';
if (_nickname != '') {
if ( (tipo_listado == 2) && (idUsuario == _nickname) ) {
var html_botones_menu_escribir = '';
if ( (es_administrador == true) || (es_propietario == true) ) {
if (es_administrador == true) {
html_botones_menu_escribir = '
Eres el administrador ';
}
else {
html_botones_menu_escribir = '
Eres el propietario ';
}
}
else {
html_botones_menu_escribir = f_componer_html_botones_menu_escribir_evento(true, idEvento, tipoSuscripcionEvento);
}
html = html + '
';
html = html + ' ';
html = html + '
';
html = html + '
';
}
else {
html_botones_menu_seguir = f_componer_html_botones_menu_seguir_evento(seguimiento_usuario, idEvento);
html = html + '
';
html = html + ' ';
html = html + '
';
html = html + '
';
}
}
else {
html = html + '
';
html = html + ' ';
html = html + '
';
html = html + '
';
}
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
if ( (datosExtra.adm) && (datosExtra.adm != '') ) {
var texto_html = f_obtener_html_administradores_evento(datosExtra.adm);
if (texto_html != '') {
html = html + ' Administrado por: ' + texto_html + ' ';
}
}
var nombreparamovil = idEvento;
if ( (datosExtra.nombreparamovil) && (datosExtra.nombreparamovil != '') ) {
nombreparamovil = datosExtra.nombreparamovil;
html = html + ' Clave SMS: *' + nombreparamovil + ' ';
}
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
if ( (datosExtra.ts_inicio) && (datosExtra.ts_inicio != '') ) {
var texto_fecha = f_obtener_fecha_visible(datosExtra.ts_inicio, 0);
html = html + '
Creado el: '+ texto_fecha + '
';
}
if (datosExtra.etiquetas) {
var texto_html = f_obtener_html_etiquetas_evento(datosExtra.etiquetas);
if (texto_html != '') {
html = html + '
';
html = html + '
Archivado en: ';
html = html + ' ' + texto_html;
html = html + ' ';
}
}
html = html + '
' + datosTema.descripcion + '
';
var numero_mensajes_evento = 0;
var fecha_ts_ultimo_mensaje = '';
var texto_fecha = '';
if ( (datosExtra.num_mensajes) && (datosExtra.num_mensajes > 0) ) {
numero_mensajes_evento = datosExtra.num_mensajes;
}
else if ( (datosTema.num_mensajes) && (datosTema.num_mensajes > 0) ) {
numero_mensajes_evento = datosTema.num_mensajes;
}
if ( (datosExtra.ts_ultimo_mensaje) && (datosExtra.ts_ultimo_mensaje != '') ) {
fecha_ts_ultimo_mensaje = datosExtra.ts_ultimo_mensaje;
}
else if ( (datosTema.ts_ultimo_mensaje) && (datosTema.ts_ultimo_mensaje != '') ) {
fecha_ts_ultimo_mensaje = datosTema.ts_ultimo_mensaje;
}
var texto_fecha = '';
if (numero_mensajes_evento > 0) {
if (fecha_ts_ultimo_mensaje != '') {
texto_fecha = f_obtener_html_ultima_actualizacion_evento(fecha_ts_ultimo_mensaje, 0);
}
}
var numero_seguidores_evento = 0;
if ( (datosExtra.numero_seguidores_evento) && (datosExtra.numero_seguidores_evento > 0) ) {
numero_seguidores_evento = datosExtra.numero_seguidores_evento;
}
else if (datosTema.numero_seguidores_evento) {
numero_seguidores_evento = datosTema.numero_seguidores_evento;
}
var numero_escritores_evento = 0;
if ( (datosExtra.numero_writers_evento) && (datosExtra.numero_writers_evento > 0) ) {
numero_escritores_evento = datosExtra.numero_writers_evento;
}
else if (datosTema.numero_writers_evento) {
numero_escritores_evento = datosTema.numero_writers_evento;
}
html = html + '
';
html = html + '
';
html = html + '
Usuarios ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
Mensajes ';
html = html + '
';
html = html + ' Total: ' + numero_mensajes_evento + ' ';
if (numero_mensajes_evento > 0) {
html = html + ' El último: ' + texto_fecha + ' ';
}
html = html + ' ';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
html = html + '
';
}
if (idUsuario != '') {
if (tipo_listado == 1) {
if (idUsuario == _nickname) {
if (numero_temas == 0) {
html_encabezado = html_encabezado + 'Temas que sigues ';
}
else {
html_encabezado = html_encabezado + 'Sigues ' + numero_temas + ' tema';
if (numero_temas > 1) {
html_encabezado = html_encabezado + 's';
}
html_encabezado = html_encabezado + ' ';
}
html_sintemas = 'No sigues ningún tema';
}
else {
if (numero_temas == 0) {
html_encabezado = html_encabezado + '';
}
else {
html_encabezado = html_encabezado + '' + idUsuario + ' sigue ' + numero_temas + ' tema';
if (numero_temas > 1) {
html_encabezado = html_encabezado + 's';
}
html_encabezado = html_encabezado + ' ';
}
html_sintemas = 'No sigue ningún tema';
}
}
else {
if (idUsuario == _nickname) {
if (numero_temas == 0) {
html_encabezado = html_encabezado + 'Temas donde puedes escribir ';
}
else {
html_encabezado = html_encabezado + ' Estás apuntado para escribir en ' + numero_temas + ' tema';
if (numero_temas > 1) {
html_encabezado = html_encabezado + 's';
}
html_encabezado = html_encabezado + ' ';
html_encabezado = html_encabezado + ' ';
html_encabezado = html_encabezado + '
Haz clic en los temas que quieras eliminar de la lista y dejarás de estar apuntado para escribir. ';
html_encabezado = html_encabezado + ' Si quieres volver a escribir en ellos, deberás hacerlo desde la página de cada tema.
';
html_encabezado = html_encabezado + '
';
}
html_sintemas = 'No puedes escribir en ningún tema';
}
else {
if (numero_temas == 0) {
html_encabezado = html_encabezado + '';
}
else {
html_encabezado = html_encabezado + '' + idUsuario + ' puede escribir en ' + numero_temas + ' tema';
if (numero_temas > 1) {
html_encabezado = html_encabezado + 's';
}
html_encabezado = html_encabezado + ' ';
}
html_sintemas = 'No puede escribir en ningún tema';
}
}
}
else {
if (tipo_listado == 0) {
html_encabezado = 'Listado completo de temas ';
}
else {
html_encabezado = 'Listado de temas destacados ';
}
html_sintemas = 'No hay temas disponibles';
}
if (numero_temas == 0) {
html = '';
html = html + '
' + html_sintemas + '
';
html = html + '
';
}
else {
html = '' + html + '
';
}
html = html_encabezado + html;
var caja = document.getElementById('id_temas');
caja.innerHTML = html;
}
function f_seguir_evento_desde_listado(operacion, idEvento) {
var cadena_params = 'user=' + _nickname + '&data=' + idEvento;
if (operacion == 'dejar') {
cadena_params = cadena_params + '&action=del_eventos';
}
else {
cadena_params = cadena_params + '&action=add_eventos';
}
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert(_ESKUPhashMsgByLang[LANGESKUP].error_al_realizar_la_operacion);
}
else {
var _hashTMP = Array();
var data = httpRequest.responseText;
var boton_seguir = document.getElementById('id_boton_seguir_' + idEvento);
var boton_dejar = document.getElementById('id_boton_dejar_' + idEvento);
if (operacion == 'seguir') {
boton_seguir.style.display = 'none';
boton_dejar.style.display = '';
}
else {
boton_seguir.style.display = '';
boton_dejar.style.display = 'none';
}
_obtenidasSuscripciones = false;
f_muestra_caja_mistemas();
}
}, _urlESKUP + "&" + cadena_params);
}
function muestraMensajesHilosNiveles(idMsg,numPaginacion,noRecarga) {
if(typeof numPaginacion == 'undefined'){
numPaginacion = 1;
}
if(typeof numMensajesPlusHilo == 'undefined'){
numMensajesPlusHilo = numMensajesPlusHiloDef;
}
if(typeof numMensajesPlusHilo == 'string'){
numMensajesPlusHilo = parseInt(numMensajesPlusHilo);
}
if(typeof _hashMsgs.mensajes != "undefined"){
if(typeof noRecarga == 'undefined'){
recuperarInformacionMensajesHiloPorNiveles(_hashMsgs.mensajes[0].hilo,idMsg,numMensajesPlusHilo,numPaginacion);
return;
}
}
var msgFin = numPaginacion*numMensajesPlusHilo;
var divContenedor = '';
var level = 'hijo';
if(typeof idcontenedormensajes != 'undefined' && idcontenedormensajes != ''){
divContenedor = document.getElementById(idcontenedormensajes);
divHiloTmp = document.getElementById('conversacion_#MSG:IDFATHER#');
if(divHiloTmp != null){
divHiloTmp.id = divHiloTmp.id.replace(/#MSG:IDFATHER#/g, idMsg);
}else{
divContenedor = document.getElementById('mensaje_'+idMsg);
}
}else{
divContenedor = document.getElementById('mensaje_'+idMsg);
}
if(divContenedor != null){
level = ESKUP.getLevel(divContenedor.getAttribute('fatherId'));
}
var html = "";
var msgInicio = 0;
var idsHilo = Array();
if(typeof msgFin == 'undefined' || msgFin == ''){
msgFin = numMensajesPlusHilo;
}
if (msgFin > _hashMsgs.numMensajes) {
msgFin = _hashMsgs.numMensajes;
}
if (typeof _hashMsgs.mensajes != "undefined" && _hashMsgs.mensajes.length > 0) {
for (var num = msgInicio; (num != msgFin && num < _hashMsgs.numMensajes); num++) {
if (_hashMsgs.mensajes[num]) {
idsHilo.push(_hashMsgs.mensajes[num].idMsg+"|"+_hashMsgs.mensajes[num].borrado);
html += pintaMensaje(_hashMsgs.mensajes[num],false,level);
}
}
if (typeof f_pide_publicidad != "undefined") {
f_pide_publicidad();
}
_es_primera_carga = 0;
mostrarError('');
} else if (_hashMsgs.numMensajes == 0) {
return;
}
if (typeof _lazyfy != "undefined" && _lazyfy == true) {
html = lazyfy(html);
}
var divHilo = document.getElementById('conversacion_'+idMsg);
divHilo.innerHTML += html;
if(typeof level != 'undefined'){
if(divHilo.className.indexOf('conversacion') == -1){
divHilo.className += ' conversacion';
}
}
level = 'hijo';
if(divContenedor != null && _quiensoy != "mensajeUnico"){
divContenedor.appendChild(divHilo);
}
pintaPaginacionHilo(idMsg,msgFin,_hashMsgs.numMensajes,numPaginacion);
if (typeof _lazyfy != "undefined" && _lazyfy == true) {
startLazyload(_idContenedorMsgs);
}
ESKUP.triggerEventParam(document.body,"muestraMensajesHilos",{ids:idsHilo});
ESKUP.triggerEvent(document.body,"muestraHilos");
}
function muestraMensajes(numPagina, forzado) {
if (typeof forzado == "undefined") {
forzado = false;
}
if (location.hash && !forzado) {
numPagina = parseInt(location.hash.substring(1));
}
var divContenedor = document.getElementById(_idContenedorMsgs);
var html = "";
var msgInicio = (numPagina-1)*_numMsgPag;
var msgFin = (numPagina*_numMsgPag);
if (msgFin > _hashMsgs.numMensajes) {
msgFin = _hashMsgs.numMensajes;
}
_numPagActual = numPagina;
if (forzado) {
location.href = "#" + _numPagActual;
}
if (typeof _hashMsgs.mensajes != "undefined" && _hashMsgs.mensajes.length > 0) {
if (typeof _hashMsgs.orden != "undefined" && _hashMsgs.orden > 0) {
if (document.getElementById('id_inversion')) {
document.getElementById('id_inversion').style.display = '';
if (_hashMsgs.orden == 1) {
if (document.getElementById('id_recargapagina')) {
document.getElementById('id_recargapagina').style.display = 'none';
}
}
}
}
if ( (msgInicio+1) > (_numPagCache*_numMsgCache) ||
(msgFin-1) < ((_numPagCache-1)*_numMsgCache) ) {
_numPagCache = parseInt(msgInicio/_numMsgCache)+1;
_ultimaRecargaServidor = 0;
if(typeof _tipoConversacion != 'undefined'){
switch(_tipoConversacion){
case 'c':
recuperarInformacionMensajesHiloPorNiveles(_hilo);
break;
case 'r':
recuperarInformacionMensajesValoracion();
break;
case 'o':
recuperarInformacionMensajesInverso();
break;
case 't':
recuperarInformacionMensajes();
break;
}
}else{
recuperarInformacionMensajes();
}
return(false);
}
for (var i = msgInicio; (i != msgFin && i < _hashMsgs.numMensajes); i++) {
var num = i - ((_numPagCache-1)*_numMsgCache);
if (_hashMsgs.mensajes[num]) {
html += pintaMensaje(_hashMsgs.mensajes[num]);
}
}
pintaPaginacion();
if (typeof f_pide_publicidad != "undefined") {
f_pide_publicidad();
}
f_contabiliza_peticion();
_es_primera_carga = 0;
mostrarError('');
} else if (_hashMsgs.numMensajes == 0) {
}
if (typeof _lazyfy != "undefined" && _lazyfy == true) {
html = lazyfy(html);
}
if(typeof verpaginacionplus == "undefined" || typeof numPagina == "undefined" ||numPagina == 1){
divContenedor.innerHTML = html;
}else{
divContenedor.innerHTML += html;
}
if (typeof _lazyfy != "undefined" && _lazyfy == true) {
startLazyload(_idContenedorMsgs);
}
ESKUP.triggerEvent(document.body, "muestraMensajes");
}
function procesarHashMensajesEntrevistaDigital() {
if (typeof _modoED == 'undefined') {
_modoED = 'lector';
}
if (_modoED == 'moderador') {
return true;
}
var i = 0;
_hashMsgs.preguntasPendientes = Array();
if (_modoED == 'lector' &&
typeof _hashMsgs.perfilesEventos != 'undefined' &&
typeof _hashMsgs.perfilesEventos[_tablon] != 'undefined' &&
typeof _hashMsgs.perfilesEventos[_tablon]['orden_visualizacion_mensajes'] != 'undefined' &&
_hashMsgs.perfilesEventos[_tablon]['orden_visualizacion_mensajes'] == 1) {
_hashMsgs.mensajes.reverse();
}
while (i < _hashMsgs.mensajes.length) {
if (!_hashMsgs.mensajes[i].hilo) {
if (_modoED == 'lector') {
var pregPte = _hashMsgs.mensajes[i];
_hashMsgs.preguntasPendientes.push(pregPte);
_hashMsgs.mensajes.splice(i, 1);
} else {
i++;
}
} else {
if (_hashMsgs.mensajes[i].hilo == _hashMsgs.mensajes[i].idMsg) {
_hashMsgs.mensajes.splice(i, 1);
} else {
if (_modoED == 'entrevistado') {
_hashMsgs.mensajes.splice(i, 1);
} else {
i++;
}
}
}
}
if (_modoED == 'lector' &&
typeof _hashMsgs.perfilesEventos != 'undefined' &&
typeof _hashMsgs.perfilesEventos[_tablon] != 'undefined' &&
typeof _hashMsgs.perfilesEventos[_tablon]['orden_visualizacion_mensajes'] != 'undefined' &&
_hashMsgs.perfilesEventos[_tablon]['orden_visualizacion_mensajes'] == 1) {
_hashMsgs.mensajes.reverse();
}
if (_modoED == 'entrevistado') {
_hashMsgs.mensajes.reverse();
}
_hashMsgs.numMensajes = _hashMsgs.mensajes.length;
}
function lazyfy(html) {
var regExp = new RegExp("", "g");
if (isIE && isIE < 8) {
html = html.replace(/()/g, "$1 data-src=\"$2\" src=\"/t.gif\" onload=\"lzld(this)\" onerror=\"lzld(this)\" $3");
} else {
html = html.replace(/()/g, "$1 data-src=\"$2\" src=\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\"$3");
}
return(html);
}
function startLazyload(idContenedor) {
(function(window, document, idContainer){
var iframeAltoVariable = false;
if ( (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) ||
(typeof _quiensoy != "undefined" && _quiensoy == "widget" && typeof _iframeAltoVariable != "undefined" && _iframeAltoVariable == '1') ) {
if (typeof _objIframeContenedor != "undefined" && _objIframeContenedor != null) {
iframeAltoVariable = true;
}
}
var offsetIframeContenedor = 0;
var intervalSaveOffset = null;
var
offset = 200,
lazyAttr = 'data-src',
winH = viewport(),
imgs = [],
pageHasLoaded = false,
unsubscribed = false,
container = document.getElementById(idContainer);
saveViewportT = throttle(saveViewport, 20),
showImagesT = throttle(showImages, 20);
saveOffsetIframeContenedorT = throttle(saveOffsetIframeContenedor, 20);
window['HTMLImageElement'] && overrideGetattribute();
window['lzld'] = onDataSrcImgLoad;
function onDataSrcImgLoad(img) {
if (inArray(img, imgs) === -1) {
if (unsubscribed) {
subscribe();
}
showIfVisible(img, imgs.push(img) - 1);
}
}
function findImages(container) {
var
domreadyImgs = container.getElementsByTagName('img'),
currentImg;
for (var imgIndex = 0, max = domreadyImgs.length; imgIndex < max; imgIndex += 1) {
currentImg = domreadyImgs[imgIndex];
if (currentImg.getAttribute(lazyAttr) && inArray(currentImg, imgs) === -1) {
imgs.push(currentImg);
}
}
showImages();
setTimeout(showImagesT, 25);
}
function onLoad() {
pageHasLoaded = true;
showImagesT();
setTimeout(showImagesT, 25);
}
function throttle(fn, minDelay) {
var lastCall = 0;
return function() {
var now = +new Date();
if (now - lastCall < minDelay) {
return;
}
lastCall = now;
fn.apply(this, arguments);
}
}
function addEvent( el, type, fn ) {
if (el.attachEvent) {
el.attachEvent && el.attachEvent( 'on' + type, fn );
} else {
el.addEventListener( type, fn, false );
}
}
function removeEvent( el, type, fn ) {
if (el.detachEvent) {
el.detachEvent && el.detachEvent( 'on' + type, fn );
} else {
el.removeEventListener( type, fn, false );
}
}
function showIfVisible(img, index) {
if (contains(document.documentElement, img)
&& (img.getBoundingClientRect().top+offsetIframeContenedor) < winH + offset) {
img.onload = null;
img.removeAttribute('onload');
img.onerror = null;
img.removeAttribute('onerror');
img.src = img.getAttribute(lazyAttr);
img.removeAttribute(lazyAttr);
imgs[index] = null;
return true;
} else {
return false;
}
}
function viewport() {
if (iframeAltoVariable && window.parent) {
if (window.parent.document.documentElement.clientHeight >= 0) {
return window.parent.document.documentElement.clientHeight;
} else if (window.parent.document.body && window.parent.document.body.clientHeight >= 0) {
return window.parent.document.body.clientHeight;
} else if (window.parent.innerHeight >= 0) {
return window.parent.innerHeight;
} else {
return 0;
}
} else {
if (document.documentElement.clientHeight >= 0) {
return document.documentElement.clientHeight;
} else if (document.body && document.body.clientHeight >= 0) {
return document.body.clientHeight
} else if (window.innerHeight >= 0) {
return window.innerHeight;
} else {
return 0;
}
}
}
function saveViewport() {
winH = viewport();
}
function showImages() {
var
last = imgs.length,
current,
allImagesDone = true;
for (current = 0; current < last; current++) {
var img = imgs[current];
if(img !== null && !showIfVisible(img, current)) {
allImagesDone = false;
}
}
if (allImagesDone && pageHasLoaded) {
unsubscribe();
}
}
function saveOffsetIframeContenedor() {
if (iframeAltoVariable) {
var offsetIframeContenedorTmp = EPETUtils_calcAbsPositionV2(_objIframeContenedor)[1];
var scrollIframeContenedor = 0;
if( typeof( window.parent.pageYOffset ) == 'number' ) {
scrollIframeContenedor = window.parent.pageYOffset;
} else if( window.parent.document.body && ( window.parent.document.body.scrollLeft || window.parent.document.body.scrollTop ) ) {
scrollIframeContenedor = window.parent.document.body.scrollTop;
} else if( window.parent.document.documentElement && ( window.parent.document.documentElement.scrollLeft || window.parent.document.documentElement.scrollTop ) ) {
scrollIframeContenedor = window.parent.document.documentElement.scrollTop;
}
offsetIframeContenedor = offsetIframeContenedorTmp - scrollIframeContenedor;
}
}
function unsubscribe() {
unsubscribed = true;
removeEvent(window, 'resize', saveViewportT);
removeEvent(window, 'resize', showImagesT);
removeEvent(window, 'scroll', showImagesT);
if (iframeAltoVariable) {
removeEvent(window.parent, 'resize', saveViewportT);
removeEvent(window.parent, 'scroll', showImagesT);
removeEvent(window.parent, 'resize', saveOffsetIframeContenedorT);
removeEvent(window.parent, 'scroll', saveOffsetIframeContenedorT);
removeEvent(window, 'resize', saveOffsetIframeContenedorT);
removeEvent(window, 'scroll', saveOffsetIframeContenedorT);
}
}
function subscribe() {
unsubscribed = false;
if (iframeAltoVariable) {
addEvent(window.parent, 'resize', saveOffsetIframeContenedorT);
addEvent(window.parent, 'scroll', saveOffsetIframeContenedorT);
addEvent(window, 'resize', saveOffsetIframeContenedorT);
addEvent(window, 'scroll', saveOffsetIframeContenedorT);
addEvent(window.parent, 'resize', saveViewportT);
addEvent(window.parent, 'scroll', showImagesT);
}
addEvent(window, 'resize', saveViewportT);
addEvent(window, 'resize', showImagesT);
addEvent(window, 'scroll', showImagesT);
}
function overrideGetattribute() {
var original = HTMLImageElement.prototype.getAttribute;
HTMLImageElement.prototype.getAttribute = function(name) {
if(name === 'src') {
var realSrc = original.call(this, lazyAttr);
return realSrc || original.call(this, name);
} else {
return original.call(this, name);
}
}
}
var contains = document.documentElement.compareDocumentPosition ?
function( a, b ) {
return !!(a.compareDocumentPosition( b ) & 16);
} :
document.documentElement.contains ?
function( a, b ) {
return a !== b && ( a.contains ? a.contains( b ) : false );
} :
function( a, b ) {
while ( (b = b.parentNode) ) {
if ( b === a ) {
return true;
}
}
return false;
};
function inArray(elem, array, i) {
var len;
if ( array ) {
if ( Array.prototype.indexOf ) {
return Array.prototype.indexOf.call( array, elem, i );
}
len = array.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
if ( i in array && array[ i ] === elem ) {
return i;
}
}
}
return -1;
}
if (iframeAltoVariable) {
saveOffsetIframeContenedor();
}
findImages(container);
onLoad();
subscribe();
}(this, document, idContenedor))
}
function muestraMensajesHilo() {
var divContenedor = document.getElementById(_idContenedorHilo);
var html = "";
var idMensajeCompuestoMostrar = "";
if (typeof _hashMsgs.mensajes != "undefined" && _hashMsgs.mensajes.length > 0) {
var arraySubnivelesTransparentes = Array();
var idMensajeCompuesto = "";
for (var i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i]) {
var ultimoSubnivel = "";
var htmlDivSubniveles = "";
var htmlCierreDivSubniveles = "";
var hayEnvoltorio = true;
var visible = true;
arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] = 0;
if (_hashMsgs.mensajes[i].level > _nivelMinVisibleHilo) {
visible = false;
}
for (var contLevel = _hashMsgs.mensajes[i].level; contLevel > 0; contLevel--) {
var htmlUltimo = "";
if (contLevel == _hashMsgs.mensajes[i].level) {
ultimoSubnivel = "subnivel"+contLevel;
if ((i+1) == _hashMsgs.numMensajes ||
_hashMsgs.mensajes[i].level > _hashMsgs.mensajes[i+1].level) {
htmlUltimo = "ultimo";
hayEnvoltorio = false;
} else {
for (var j = (i+1); j != _hashMsgs.numMensajes; j++) {
htmlUltimo = "ultimo";
hayEnvoltorio = false;
arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] = 1;
if (_hashMsgs.mensajes[j].level == _hashMsgs.mensajes[i].level) {
htmlUltimo = "";
hayEnvoltorio = true;
arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] = 0;
break;
}
if (_hashMsgs.mensajes[j].level < _hashMsgs.mensajes[i].level) {
break;
}
}
}
}
var htmlTransparente = "";
if (typeof arraySubnivelesTransparentes[_hashMsgs.mensajes[i].level] != "undefined" &&
arraySubnivelesTransparentes[contLevel] == 1 &&
htmlUltimo == "") {
htmlTransparente = "transparente";
}
var htmlStyle = "";
var htmlIdMensaje = "";
if (contLevel == 1) {
if (typeof _idMsg == "undefined" || _idMsg != _hashMsgs.mensajes[i].idMsg) {
if (!visible) {
htmlStyle = "style='display: none'";
}
htmlIdMensaje = "id='" + idMensajeCompuesto + "|" + _hashMsgs.mensajes[i].idMsg + "'";
} else {
idMensajeCompuestoMostrar = idMensajeCompuesto;
}
}
htmlDivSubniveles = "" + htmlDivSubniveles;
htmlCierreDivSubniveles += "
";
}
if (typeof _idMsg != "undefined" && _idMsg == _hashMsgs.mensajes[i].idMsg) {
html += "";
htmlCierreDivSubniveles += "
";
}
html += htmlDivSubniveles;
if (hayEnvoltorio) {
var idPrimerMensaje = "";
if (_hashMsgs.mensajes[i].level == 0) {
idPrimerMensaje = " id = '|" + _hashMsgs.mensajes[i].idMsg + "' ";
}
html += "";
htmlCierreDivSubniveles += "
";
}
if (_hashMsgs.mensajes[i].borrado == 1) {
html += "";
}
html += pintaMensajeHilo(_hashMsgs.mensajes[i], visible);
html += "
";
if ((i+1) == _hashMsgs.numMensajes ||
_hashMsgs.mensajes[i].level >= _hashMsgs.mensajes[i+1].level) {
} else if (_hashMsgs.mensajes[i].level < _nivelMinVisibleHilo) {
html += "
Cerrar respuestas ";
} else {
numMensajesDebajo = 0;
for (var j = (i+1); j != _hashMsgs.numMensajes; j++) {
if (_hashMsgs.mensajes[j].level <= _hashMsgs.mensajes[i].level) {
break;
}
numMensajesDebajo++;
}
html += "
" + numMensajesDebajo + " respuestas ";
}
html += "
";
if (_hashMsgs.mensajes[i].borrado == 1) {
html += "
";
}
html += htmlCierreDivSubniveles;
if ((i+1) != _hashMsgs.numMensajes) {
if (_hashMsgs.mensajes[i].level < _hashMsgs.mensajes[i+1].level) {
idMensajeCompuesto += "|" + _hashMsgs.mensajes[i].idMsg;
} else if (_hashMsgs.mensajes[i].level > _hashMsgs.mensajes[i+1].level) {
numNiveles = _hashMsgs.mensajes[i].level-_hashMsgs.mensajes[i+1].level;
idMensajeCompuesto = idMensajeCompuesto.substring(0, idMensajeCompuesto.length-((_longIdMensaje+1)*numNiveles));
}
}
}
}
}
divContenedor.innerHTML = html;
mostrarError('');
}
function pintaNombreUsuario(nickname) {
var nombreUsuario = nickname;
if (_hashMsgs.perfilesUsuarios && _hashMsgs.perfilesUsuarios[nickname]) {
if (_hashMsgs.perfilesUsuarios[nickname].nombre) {
nombreUsuario = _hashMsgs.perfilesUsuarios[nickname].nombre;
}
if (_hashMsgs.perfilesUsuarios[nickname].apellidos) {
nombreUsuario += " " + _hashMsgs.perfilesUsuarios[nickname].apellidos;
}
}
if(typeof _nickname != 'undefined'
&& _nickname != ''
&& _nickname == nickname
&& nombreUsuario == nickname
&& typeof _nombreCompleto != 'undefined'
&& _nombreCompleto != ''
){
nombreUsuario = _nombreCompleto;
}
return(nombreUsuario);
}
function getReplacedUrlSecured(url){
if(typeof secure_environment != 'undefined' && secure_environment == true){
url= url.replace("http://skp00.epimg.net", _hostImages);
url= url.replace("http://ep00.epimg.net", _hostImages);
url= url.replace("http://ep01.epimg.net", _hostImages);
url= url.replace("http://ep02.epimg.net", _hostImages);
url= url.replace("http://eskup.des.elpais.int:9090", _hostImages);
url= url.replace("http://eskup.elpais.com", _hostImages);
}
return url;
}
function pintaImagenUsuario(nickname) {
var strImagen = _url_imagen_usuario_por_defecto;
if (typeof _url_imagen_usuario != "undefined" && _url_imagen_usuario != "" && nickname == _nickname) {
strImagen = _url_imagen_usuario;
} else if (_hashMsgs.perfilesUsuarios && _hashMsgs.perfilesUsuarios[nickname]) {
if (_hashMsgs.perfilesUsuarios[nickname].pathfoto) {
strImagen = _hashMsgs.perfilesUsuarios[nickname].pathfoto;
}
}
strImagen=strImagen.replace("http:","");
return(strImagen);
}
function pintaNombreEvento(evento) {
var nombreEvento = evento;
if (_hashMsgs.perfilesEventos && _hashMsgs.perfilesEventos[evento]) {
if (_hashMsgs.perfilesEventos[evento].nombre) {
nombreEvento = _hashMsgs.perfilesEventos[evento].nombre;
}
}
return(nombreEvento);
}
function pintaBotonSeguirUsuario(idMensaje, nickname) {
var htmlBoton = '';
if (typeof _quitaEnlacesEskup == 'undefined' || _quitaEnlacesEskup!='1'){
var usuarioSeguido = false;
if (typeof _arrayListaSeguidos != "undefined" && _arrayListaSeguidos.indexOf(nickname) != -1) {
usuarioSeguido = true;
}
var estiloBoton = 'off seguir_al_usuario';
var estiloConfirmar = 'on confirmar';
var mensajeBoton = _ESKUPhashMsgByLang[LANGESKUP].seguir_al_usuario;
var mensajeConfirmar = _ESKUPhashMsgByLang[LANGESKUP].confirmar;
var accionEskup = 'add';
if (usuarioSeguido) {
estiloBoton = 'on le_estas_siguiendo';
estiloConfirmar = 'off dejar_de_seguirle';
mensajeBoton = _ESKUPhashMsgByLang[LANGESKUP].le_estas_siguiendo;
mensajeConfirmar = _ESKUPhashMsgByLang[LANGESKUP].dejar_de_seguirle;
accionEskup = 'del';
}
htmlBoton += '' + mensajeBoton + ' ';
htmlBoton += '';
}
return(htmlBoton);
}
function callbackSeguirUsuarioComentarios(httpRequest) {
if (httpRequest.status != 200) {
var texto_mensaje = _ESKUPhashMsgByLang[LANGESKUP].error_al_realizar_la_operacion;
alert(texto_mensaje + " (" + httpRequest.data + ")");
}
else {
var data = httpRequest.responseText;
if (typeof _arrayListaSeguidos != "undefined") {
if (_operacion == 'add') {
_arrayListaSeguidos.push(_nicknameASeguir);
} else {
_arrayListaSeguidos = _arrayListaSeguidos.slice((_arrayListaSeguidos.indexOf(_nicknameASeguir)-1), _arrayListaSeguidos.indexOf(_nicknameASeguir));
}
}
if (_hashMsgs.mensajes) {
for (var contMsg = 0; contMsg != _hashMsgs.mensajes.length; contMsg++) {
var hashMsg = _hashMsgs.mensajes[contMsg];
if (hashMsg.usuarioOrigen == _nicknameASeguir &&
document.getElementById('seguirusuario_'+hashMsg.idMsg)) {
document.getElementById('seguirusuario_'+hashMsg.idMsg).innerHTML =
pintaBotonSeguirUsuario(hashMsg.idMsg, _nicknameASeguir);
}
}
}
}
}
function pintaMensaje(hashMensaje, esProvisional,level) {
var html = '';
if (typeof esProvisional == "undefined") {
esProvisional = false;
}
if (typeof _htmlPlantillaPersonalizadaMsg == 'undefined' || _htmlPlantillaPersonalizadaMsg == null) {
html = document.getElementById(_idPlantillaMsg).innerHTML;
html = html.replace(/\n/g, '');
html = html.replace(/\r/g, '');
}
else {
html = _htmlPlantillaPersonalizadaMsg;
}
html = html.replace(_idPlantillaMsg, "mensaje_"+hashMensaje.idMsg);
var ahora = new Date();
var tsAhora = ahora.getTime() / 1000;
if (typeof _tsHoraActual != "undefined" && _tsHoraActual != 0) {
tsAhora = _tsHoraActual;
} else if (typeof _hashMsgs.horaActual != "undefined") {
tsAhora = _hashMsgs.horaActual;
}
var tsMensaje = hashMensaje.tsMensaje;
var fechaMensaje = new Date(hashMensaje.tsMensaje*1000);
var anyo = fechaMensaje.getFullYear();
var mes = fechaMensaje.getMonth() + 1;
if (mes < 10) { mes = "0" + mes; }
var dia = fechaMensaje.getDate();
if (dia < 10) { dia = "0" + dia; }
var hora = fechaMensaje.getHours();
if (hora < 10) { hora = "0" + hora; }
var min = fechaMensaje.getMinutes();
if (min < 10) { min = "0" + min; }
var textoHora = "";
if (tsMensaje+60 > tsAhora) {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].menos_de_un_minuto;
} else if (tsMensaje+3600 > tsAhora) {
var minutosDiff = parseInt((tsAhora-tsMensaje)/60);
if (minutosDiff == 1) {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + minutosDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].minuto;
} else {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + minutosDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].minutos;
}
} else if (tsMensaje+3600*24 > tsAhora) {
var horasDiff = parseInt((tsAhora-tsMensaje)/3600);
if (horasDiff == 1) {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + horasDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].hora;
} else {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + horasDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].horas;
}
} else {
textoHora += dia + '/' + mes + '/' + anyo + ', ' + _ESKUPhashMsgByLang[LANGESKUP].a_las + ' ' + hora + ':' + min;
}
html = html.replace(/#MSG:HORA#/g, textoHora);
html = html.replace(/#MSG:HORASIMPLE#/g, hora+':'+min);
if(typeof hashMensaje.hilo != 'undefined'
&& typeof _hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""] != 'undefined'
&& typeof _hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas != 'undefined'
&& _hashMsgs.perfilesHilos["_" + hashMensaje.hilo + ""].num_respuestas != null
&& typeof _hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas["_"+hashMensaje.idMsg] != 'undefined'){
html = html.replace(/#MSG:INI_BOTON_VERCONVERSACION#/g, '');
html = html.replace(/#MSG:FIN_BOTON_VERCONVERSACION#/g, '');
html = html.replace(/#MSG:IDMSGCONVERSACION#/g, hashMensaje.idMsg);
html = html.replace(/#MSG:IDMSGCONVERSACIONHILO#/g, hashMensaje.hilo);
html = html.replace(/#MSG:IDMSGNUMMSG#/g,_hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas["_"+hashMensaje.idMsg]);
if(typeof _textoRespuestaUnica != 'undefined' && typeof _textoRespuestas != 'undefined'){
if(_hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas["_"+hashMensaje.idMsg] == '1'){
html = html.replace(/#MSG:TXTRESPUESTA#/g,_textoRespuestaUnica);
}else if (_hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas["_"+hashMensaje.idMsg]>1){
html = html.replace(/#MSG:TXTRESPUESTA#/g,_textoRespuestas);
}else{
html = html.replace(/#MSG:TXTRESPUESTA#/g,'');
}
}
html = html.replace(/#MSG:IDMSGPADRE#/g,hashMensaje.idMsgRespuesta);
}else{
html = html.replace(/#MSG:INI_BOTON_VERCONVERSACION#.*?#MSG:FIN_BOTON_VERCONVERSACION#/g, '');
}
var relevancia_mensaje = '';
if ( (_hashExtraMsgs.mensajes) && (_hashExtraMsgs.mensajes[hashMensaje.idMsg]) ) {
var datosExtraMensaje = _hashExtraMsgs.mensajes[hashMensaje.idMsg];
relevancia_mensaje = '';
relevancia_mensaje = relevancia_mensaje + ' ' + datosExtraMensaje.weight + '% de coincidencia
';
relevancia_mensaje = relevancia_mensaje + '
';
html = html.replace(/#MSG:INI_MSG_RELEVANCIA#/g, '');
html = html.replace(/#MSG:FIN_MSG_RELEVANCIA#/g, '');
html = html.replace(/#MSG:RELEVANCIA#/g, relevancia_mensaje);
}
else {
html = html.replace(/#MSG:INI_MSG_RELEVANCIA#.*?#MSG:FIN_MSG_RELEVANCIA#/g, '');
}
if (esProvisional) {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#/g, '');
html = html.replace(/#MSG:FIN_MSG_PROVISIONAL#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#.*?#MSG:FIN_MSG_PROVISIONAL#/g, '');
}
if (!esProvisional && (_tablon == "2" || _tablon == "3")) {
if (typeof _hashMsgs.ultimaVisita != "undefined" &&
typeof _hashMsgs.ultimaVisita[_tablon] != "undefined" &&
tsMensaje > _hashMsgs.ultimaVisita[_tablon] && !esProvisional) {
html = html.replace(/#MSG:INI_MSG_NUEVO#/, '');
html = html.replace(/#MSG:FIN_MSG_NUEVO#/, '');
} else {
html = html.replace(/#MSG:INI_MSG_NUEVO#.*?#MSG:FIN_MSG_NUEVO#/, '');
}
} else {
html = html.replace(/#MSG:INI_MSG_NUEVO#.*?#MSG:FIN_MSG_NUEVO#/, '');
}
if (hashMensaje.borrado == 1) {
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) {
html = html.replace(/#MSG:INI_MSG_BORRADO#/g, '');
html = html.replace(/#MSG:FIN_MSG_BORRADO#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_BORRADO#.*?#MSG:FIN_MSG_BORRADO#/g, '');
}
} else {
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) {
html = html.replace(/#MSG:INI_MSG_BORRADO#.*?#MSG:FIN_MSG_BORRADO#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_BORRADO#/g, '');
html = html.replace(/#MSG:FIN_MSG_BORRADO#/g, '');
}
}
if ( (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) &&
(typeof hashMensaje.opinador != "undefined" && hashMensaje.opinador == 1) ) {
html = html.replace(/#MSG:INI_MSG_OPINADOR#/g, '');
html = html.replace(/#MSG:FIN_MSG_OPINADOR#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_OPINADOR#.*?#MSG:FIN_MSG_OPINADOR#/g, '');
}
if(typeof level != 'undefined' && level != 'primero'){
html = html.replace(/#MSG:HIJO#/g,'hijo');
html = html.replace(/#MSG:BTNRESPUESTAOCULTO#/,'oculto');
}else{
html = html.replace(/#MSG:HIJO#/g,'');
html = html.replace(/#MSG:BTNRESPUESTAOCULTO#/,'');
}
html = html.replace(/#MSG:INI_DIV_FLOTANTE#/g, '');
html = html.replace(/#MSG:FIN_DIV_FLOTANTE#/g, '');
html = html.replace(/#MSG:INI_FLOTANTE#.*?#MSG:FIN_FLOTANTE#/g, '');
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) {
html = html.replace(/#MSG:BOTON_SEGUIR_USUARIO#/, pintaBotonSeguirUsuario(hashMensaje.idMsg, hashMensaje.usuarioOrigen));
}
if (hashMensaje.moderacion != "undefined" && hashMensaje.moderacion == 'pte') {
html = html.replace(/#MSG:INI_MSG_PTE_PREMODERACION#/g, '');
html = html.replace(/#MSG:FIN_MSG_PTE_PREMODERACION#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_PTE_PREMODERACION#.*?#MSG:FIN_MSG_PTE_PREMODERACION#/g, '');
}
html = html.replace(/#MSG:ID#/g, hashMensaje.idMsg);
var urlBrevesComentario = "Comentario";
if (typeof _tipoPost != 'undefined' && _tipoPost == 1){
urlBrevesComentario = "breves";
if (_nombreEvento){
urlBrevesComentario+='/'+_nombreEvento;
}
}
html = html.replace(/#MSG:URL#/g, urlBrevesComentario);
html = html.replace(/#MSG:FOTO_USUARIO#/, pintaImagenUsuario(hashMensaje.usuarioOrigen));
if(pintaImagenUsuario(hashMensaje.usuarioOrigen) == _url_imagen_usuario_por_defecto){
html = html.replace(/#MSG:INI_NO_FOTO_USUARIO#/ig,'');
html = html.replace(/#MSG:FIN_NO_FOTO_USUARIO#/ig,'');
}else{
html = html.replace(/#MSG:INI_NO_FOTO_USUARIO#.*?#MSG:FIN_NO_FOTO_USUARIO#/ig, '');
}
var usuarioNick = hashMensaje.usuarioOrigen;
var nickfeo = usuarioNick;
if (typeof usuarioNick !='undefined' && usuarioNick!='' &&
typeof _hashMsgs.perfilesUsuarios !='undefined' &&
_hashMsgs.perfilesUsuarios !='' &&
typeof _hashMsgs.perfilesUsuarios[usuarioNick] != 'undefined' &&
_hashMsgs.perfilesUsuarios[usuarioNick] != '' &&
typeof _hashMsgs.perfilesUsuarios[usuarioNick]['alias_bonito'] !='undefined'
&& _hashMsgs.perfilesUsuarios[usuarioNick]['alias_bonito']){
usuarioNick = _hashMsgs.perfilesUsuarios[usuarioNick]['alias_bonito'];
}
html = html.replace(/#MSG:NICKNAMEFEO_USUARIO#/g, nickfeo);
html = html.replace(/#MSG:NICKNAME_USUARIO#/g, usuarioNick);
html = html.replace(/#MSG:NOMBRE_USUARIO#/g, pintaNombreUsuario(hashMensaje.usuarioOrigen));
var contenidoMensaje = "";
if (hashMensaje.borrado == 1) {
contenidoMensaje += '(' + _ESKUPhashMsgByLang[LANGESKUP].mensaje_borrado + ')';
} else {
contenidoMensaje = '' + hashMensaje.contenido;
}
if(contenidoMensaje.match(/((https?)?:\/\/(\w+\.)?(elpais.com\/videos\/embed\/eskup\/ifr\.html\?a.[^<\s]+))/i)){
contenidoMensaje = contenidoMensaje.replace(/&/gi,"&");
contenidoMensaje = contenidoMensaje.replace(/amp;/gi,"");
}
if (typeof hashMensaje.hayVideo != "undefined" && hashMensaje.hayVideo == 1) {
contenidoMensaje = pintaVideoEnMensaje(contenidoMensaje, hashMensaje.idMsg);
}
contenidoMensaje = pintaEmbedEnMensaje(contenidoMensaje, hashMensaje.idMsg);
if (typeof _desactivarEnlaces != "undefined" && _desactivarEnlaces == '1') {
contenidoMensaje = contenidoMensaje.replace(/]*>/ig, "");
contenidoMensaje = contenidoMensaje.replace(/<\/a>/ig, "");
} else if (typeof _quiensoy != "undefined" && _quiensoy == "comentarios") {
contenidoMensaje = contenidoMensaje.replace(/ ]*)>/ig, " ");
}
var hashRegExpr = ['(@ (.+?)<\/a>)'];
for(var i=0;i"+myArray[3]+" ",">"+alias_bonito+"");
contenidoMensaje = contenidoMensaje.replace(cad,sust);
}
}
}
}
if (typeof hashMensaje.valoracion_positive != 'undefined' && typeof hashMensaje.valoracion_positive != 'NaN' &&
hashMensaje.valoracion_positive) {
html = html.replace(/#MSG:VALORACION_POSITIVE#/g, hashMensaje.valoracion_positive);
} else {
html = html.replace(/#MSG:VALORACION_POSITIVE#/g, 0);
}
if (typeof hashMensaje.valoracion_negative != 'undefined' && typeof hashMensaje.valoracion_negative != 'NaN' &&
hashMensaje.valoracion_negative) {
html = html.replace(/#MSG:VALORACION_NEGATIVE#/g, hashMensaje.valoracion_negative);
} else {
html = html.replace(/#MSG:VALORACION_NEGATIVE#/g, 0);
}
var mostrar_mensaje_resaltado = false;
var mensaje_propio = false;
if (_nickname != '') {
if (_nickname == hashMensaje.autorMsgRespuesta) {
mostrar_mensaje_resaltado = true;
}
if(_nickname == hashMensaje.usuarioOrigen){
mensaje_propio = true;
}
var regExpRefer = new RegExp("(\s*)@(]*>)(" + _nickname + ")( *)(\s|\.\s|\.\.\.|,\s|:\s|\\?\s|!\s|\.|,|:|\\?$|!$|$)(.*)", "i");
if (regExpRefer.test(contenidoMensaje)) {
mostrar_mensaje_resaltado = true;
}
if ( !(_tablon1 == 't1-ULTIMOSMENSAJES') && !(_tablon1 == '2') && !(_tablon1.match("ev-")) ) {
mostrar_mensaje_resaltado = false;
}
if ( mostrar_mensaje_resaltado == true ) {
html = html.replace(/#MSG:INI_DIV_REFERENCIADO#/g, '');
html = html.replace(/#MSG:FIN_DIV_REFERENCIADO#/g, '');
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
contenidoMensaje = contenidoMensaje.replace(regExpRefer, "$1@$2$3 $4$5$6");
}
}
}
if(mensaje_propio == true){
html = html.replace(/#MSG:INI_MIO#/g,'');
html = html.replace(/#MSG:FIN_MIO#/g,'');
}else{
html = html.replace(/#MSG:INI_MIO#.*?#MSG:FIN_MIO#/g, '');
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
contenidoMensaje = contenidoMensaje.replace(/@]*)>/ig, "@ ");
}
html = html.replace(/#MSG:INI_DIV_REFERENCIADO#.*?#MSG:FIN_DIV_REFERENCIADO#/g, '');
if (_nickname != '') {
if ( (_nickname == hashMensaje.usuarioOrigen) && (_tablon == '3') ) {
html = html.replace(/#MSG:INI_DIV_MIPRIVADO#/g, '');
html = html.replace(/#MSG:FIN_DIV_MIPRIVADO#/g, '');
}
}
html = html.replace(/#MSG:INI_DIV_MIPRIVADO#.*?#MSG:FIN_DIV_MIPRIVADO#/g, '');
html = html.replace(/#MSG:CONTENIDO#/g, contenidoMensaje);
var tituloMensaje = contenidoMensaje;
myRegularExpr = new RegExp('(.*?)<\/h2>',"gi");
myArray = myRegularExpr.exec(contenidoMensaje);
if (myArray !=null){
tituloMensaje = myArray[2];
} else {
myRegularExpr = new RegExp(' (.*?)<\/p>',"gi");
myArray = myRegularExpr.exec(contenidoMensaje);
if (myArray !=null){
tituloMensaje = myArray[1];
}
}
html = html.replace(/#MSG:TITULO#/g, tituloMensaje);
html = html.replace(/#MSG:CONTENIDO_NO_PROCESADO#/g,EPETUtils_fullEncodeURIComponent(hashMensaje.contenido));
html = html.replace(/#MSG:ETIQUETA_INICIO_IMG#/g, ' ');
if (hashMensaje.idMsgRespuesta && hashMensaje.idMsgRespuesta != 0) {
if (typeof _quiensoy != "undefined" && _quiensoy == "comentarios" &&
hashMensaje.idMsgRespuesta == hashMensaje.hilo) {
html = html.replace(/#MSG:INI_DIV_CONVERSACION#.*?#MSG:FIN_DIV_CONVERSACION#/g, '');
} else
if (typeof _quiensoy != "undefined" && _quiensoy == "widget" && hashMensaje.idMsgRespuesta == hashMensaje.hilo &&
typeof _hashMsgs.perfilesHilos != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+hashMensaje.hilo] != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+hashMensaje.hilo].tipo != "undefined" &&
_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].tipo == "comentarios") {
html = html.replace(/#MSG:INI_DIV_CONVERSACION#.*?#MSG:FIN_DIV_CONVERSACION#/g, '');
} else {
if (hashMensaje.idMsgRespuesta != hashMensaje.idMsg) {
html = html.replace(/#MSG:NICKNAME_USUARIO_RESPUESTA#/g, hashMensaje.autorMsgRespuesta);
html = html.replace(/#MSG:NOMBRE_USUARIO_RESPUESTA#/g, pintaNombreUsuario(hashMensaje.autorMsgRespuesta));
} else {
html = html.replace(/#MSG:INI_DIV_RESPUESTA#.*?#MSG:FIN_DIV_RESPUESTA#/, '');
}
html = html.replace(/#MSG:ID_HILO#/g, hashMensaje.hilo);
if (hashMensaje.hilo != hashMensaje.idMsg) {
html = html.replace(/#MSG:ID_MSG_RESPUESTA#/g, hashMensaje.idMsgRespuesta);
}
}
} else {
html = html.replace(/#MSG:INI_DIV_CONVERSACION#.*?#MSG:FIN_DIV_CONVERSACION#/g, '');
}
html = html.replace(/#MSG:INI_DIV_CONVERSACION#/g, '');
html = html.replace(/#MSG:FIN_DIV_CONVERSACION#/g, '');
html = html.replace(/#MSG:INI_DIV_RESPUESTA#/g, '');
html = html.replace(/#MSG:FIN_DIV_RESPUESTA#/g, '');
html = html.replace(/#MSG:ID_HILO#/, '');
html = html.replace(/#MSG:ID_MSG_RESPUESTA#/, '');
var numTablonesAMostrar = 0;
var tablonesAMostrar = Array();
var tablonesRespuesta = Array();
if (hashMensaje.CopiaEnTablones) {
var tablones = hashMensaje.CopiaEnTablones.split(',');
for (var i = 0; i != tablones.length; i++) {
if (_tablon == 3 && tablones[i] != ("t3-"+_nickname)) {
if (tablones[i] != ("t3-"+hashMensaje.usuarioOrigen)) {
tablonesAMostrar[tablones[i].substring(3)] = pintaNombreUsuario(tablones[i].substring(3));
numTablonesAMostrar++;
}
tablonesRespuesta.push(tablones[i].substring(3));
} else if (/^ev-/.test(tablones[i])) {
tablonesAMostrar[tablones[i].substring(3)] = pintaNombreEvento(tablones[i].substring(3));
numTablonesAMostrar++;
tablonesRespuesta.push(tablones[i].substring(3));
}
}
if (numTablonesAMostrar > 0) {
if (_tablon == 3) {
var estilo_msg_privado = '';
var texto_title = '';
if (_nickname == hashMensaje.usuarioOrigen) {
html = html.replace(/#MSG:INI_DIV_DESTACADO#/g, '');
html = html.replace(/#MSG:FIN_DIV_DESTACADO#/g, '');
html = html.replace(/#MSG:INI_DIV_DESTINATARIOS#/, '');
html = html.replace(/#MSG:FIN_DIV_DESTINATARIOS#/, '');
estilo_msg_privado = 'enrespuesta';
texto_title = 'Mensaje enviado a';
} else {
html = html.replace(/#MSG:INI_DIV_OTROS_DESTINATARIOS#/, '');
html = html.replace(/#MSG:FIN_DIV_OTROS_DESTINATARIOS#/, '');
estilo_msg_privado = 'masdestinatarios';
texto_title = 'Enviado también a';
}
var htmlDestinatarios = '';
var styleDisplay = '';
var contDest = 0;
for (var tablonTmp in tablonesAMostrar) {
if (_numUsuariosAMostrar != 0 &&
contDest == _numUsuariosAMostrar &&
numTablonesAMostrar > (_numUsuariosAMostrar+1)) {
styleDisplay = ' style="display: none" ';
htmlDestinatarios += '
';
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
htmlDestinatarios += '' + tablonesAMostrar[tablonTmp] + '
';
} else {
htmlDestinatarios += '' + tablonesAMostrar[tablonTmp] + '
';
}
contDest++;
}
html = html.replace(/#MSG:DESTINATARIOS#/g, htmlDestinatarios);
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
} else {
var contDest = 0;
var htmlMasTemas = "";
for (var tablonTmp in tablonesAMostrar) {
if (contDest == 0) {
html = html.replace(/#MSG:TEMA#/, tablonesAMostrar[tablonTmp]);
html = html.replace(/#MSG:TEMA_NORM#/, tablonTmp);
}
if (numTablonesAMostrar > 1) {
if (contDest == 1) {
htmlMasTemas = "";
}
if (contDest != 0) {
if (typeof _quitaEnlacesEskup != 'undefined' && _quitaEnlacesEskup=='1'){
htmlMasTemas += "" + tablonesAMostrar[tablonTmp] + " ";
}else if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
htmlMasTemas += "" + tablonesAMostrar[tablonTmp] + " ";
} else {
htmlMasTemas += "" + tablonesAMostrar[tablonTmp] + " ";
}
}
}
contDest++;
}
if (numTablonesAMostrar > 1) {
htmlMasTemas += " ";
if (typeof _desactivarEnlaces != "undefined" && _desactivarEnlaces == '1') {
htmlMasTemas = htmlMasTemas.replace(/ ]*>/ig, "");
htmlMasTemas = htmlMasTemas.replace(/<\/a>/ig, "");
}
html = html.replace(/#MSG:MAS_TEMAS#/, htmlMasTemas);
} else {
html = html.replace(/#MSG:INI_MAS_TEMAS#.*?#MSG:FIN_MAS_TEMAS#/, '');
}
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
html = html.replace(/#MSG:INI_DIV_DESTACADO#.*?#MSG:FIN_DIV_DESTACADO#/g, '');
html = html.replace(/#MSG:INI_DIV_DESTINATARIOS#.*?#MSG:FIN_DIV_DESTINATARIOS#/, '');
html = html.replace(/#MSG:INI_DIV_OTROS_DESTINATARIOS#.*?#MSG:FIN_DIV_OTROS_DESTINATARIOS#/g, '');
html = html.replace(/#MSG:INI_DIV_TEMA#/, '');
html = html.replace(/#MSG:FIN_DIV_TEMA#/, '');
html = html.replace(/#MSG:MAS_TEMAS#/, '');
html = html.replace(/#MSG:INI_MAS_TEMAS#/, '');
html = html.replace(/#MSG:FIN_MAS_TEMAS#/, '');
html = parseaFoto(html,hashMensaje);
var htmlEnlaces = "";
var prefijoUrlBase = "";
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "widget" || _quiensoy == "mensajeUnico") &&
typeof _url_servidor != "undefined") {
prefijoUrlBase = _url_servidor;
}
var _hayPremoderacion = false;
if (typeof hashMensaje.hilo != "undefined" && hashMensaje.hilo != 0) {
_hayPremoderacion = esHiloPremoderado(hashMensaje.hilo);
} else
if (esEventoPremoderado(_tablon)) {
_hayPremoderacion = true;
}
if (esProvisional == false) {
html = html.replace(/#MSG:INI_DIV_MENU#/g, '');
html = html.replace(/#MSG:FIN_DIV_MENU#/g, '');
if (_nickname != '') {
var strCopiaEnTablones = '';
if (hashMensaje.CopiaEnTablones) {
strCopiaEnTablones = hashMensaje.CopiaEnTablones;
}
if (typeof _quitaEnlacesEskup == 'undefined' || _quitaEnlacesEskup!='1'){
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].reenviar_mensaje + ' (FWD) ';
}
if (_nickname == hashMensaje.usuarioOrigen) {
if (_hayPremoderacion && (typeof _soyOpinador == "undefined" || _soyOpinador == false)) {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].editar_mensaje + ' ';
} else {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].editar_mensaje + ' ';
}
if (_tablon == 3) {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].borrar_mensaje + ' ';
} else {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].borrar_mensaje +' ';
}
}
if (_nickname != hashMensaje.usuarioOrigen && _tablon == 3) {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].borrar_mensaje +' ';
}
if (_tablon != 3) {
if (typeof _formatoVisualizacion == "undefined" || _formatoVisualizacion != "movil") {
if (typeof _quitaEnlacesEskup == 'undefined' || _quitaEnlacesEskup!='1'){
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].enlace_permanente + ' ';
}
}
}
if (/^ev-/.test(_tablon1) &&
_nickname != "" && _nickname != hashMensaje.usuarioOrigen &&
typeof _hashMsgs.perfilesEventos != "undefined" &&
typeof _hashMsgs.perfilesEventos[_tablon] != "undefined") {
var arrayAdm = _hashMsgs.perfilesEventos[_tablon]["adm"].concat(_hashMsgs.perfilesEventos[_tablon]["prop"]);
var strAdmEvento = "|" + arrayAdm.join("|") + "|";
if (strAdmEvento.indexOf("|"+_nickname+"|") != -1) {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].borrar_mensaje +' ';
}
}
if (_nickname != hashMensaje.usuarioOrigen) {
if (typeof _formatoVisualizacion == "undefined" || _formatoVisualizacion != "movil") {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].notificar_insulto +' ';
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].marcar_como_spam +' ';
}
}
}
else {
if (typeof _formatoVisualizacion == "undefined" || _formatoVisualizacion != "movil") {
if (typeof _quitaEnlacesEskup != 'undefined' && _quitaEnlacesEskup=='1'){
html = html.replace(/#MSG:STYLEID#/g, "display:none");
}else {
htmlEnlaces += '' + _ESKUPhashMsgByLang[LANGESKUP].enlace_permanente + ' ';
}
}
}
}
else {
html = html.replace(/#MSG:INI_DIV_MENU#.*?#MSG:FIN_DIV_MENU#/g, '');
}
html = html.replace(/#MSG:ENLACES#/, htmlEnlaces);
if (hashMensaje.via && hashMensaje.via != "web") {
if (typeof _desactivarEnlaces != "undefined" && _desactivarEnlaces == '1') {
html = html.replace(/#MSG:VIA#/, 'Vía SMS');
} else {
html = html.replace(/#MSG:VIA#/, ' Vía SMS ');
}
}
html = html.replace(/#MSG:VIA#/, "");
var htmlCmdResponder = "";
if (_nickname != '') {
if (_tablon == 3) {
htmlCmdResponder += "crearMensaje('"+hashMensaje.idMsg+"', '" + tablonesRespuesta.join("|") + "')";
} else if (hashMensaje.hilo && hashMensaje.hilo != 0 &&
typeof _hashMsgs.perfilesHilos != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+hashMensaje.hilo] != "undefined" &&
(_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].estado < 0 ||
(_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].caducidad != "" &&
_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].caducidad < tsAhora)
)
) {
htmlCmdResponder += "alert('" + _ESKUPhashMsgByLang[LANGESKUP].no_es_posible_responder_al_mensaje + "')";
} else {
var strCopiaEnTablones = "";
var idHilo = encodeURIComponent(hashMensaje.idMsg);
if (hashMensaje.hilo != 0) {
idHilo = encodeURIComponent(hashMensaje.hilo);
}
if (typeof hashMensaje.CopiaEnTablones != "undefined" &&
hashMensaje.CopiaEnTablones != 0 && hashMensaje.CopiaEnTablones.search("ev-") != -1) {
strCopiaEnTablones = hashMensaje.CopiaEnTablones;
}
htmlCmdResponder += "responderMensaje('"+hashMensaje.idMsg+"', '"+idHilo+"|"+encodeURIComponent(hashMensaje.idMsg)+"', '"+strCopiaEnTablones+"');";
}
}
else {
htmlCmdResponder += "alert('" + _ESKUPhashMsgByLang[LANGESKUP].para_responder_tienes_que_identificarte + "')";
}
html = html.replace(/#MSG:ETIQUETA_INICIO_A#/g, '');
html = html.replace(/#MSG:ETIQUETA_FIN_A#/g, ' ' );
html = html.replace(/#MSG:CMD_RESPONDER#/g, htmlCmdResponder );
if (typeof hashMensaje.origen != 'undefined' && hashMensaje.origen) {
html = html.replace(/#MSG:ORIGEN#/g, hashMensaje.origen);
var origenCSS = hashMensaje.origen;
if (hashMensaje.origen == '5d') {
origenCSS = 'cincodias';
}
html = html.replace(/#MSG:ORIGEN_CSS#/g, origenCSS);
} else {
html = html.replace(/#MSG:ORIGEN#/g, '');
html = html.replace(/#MSG:ORIGEN_CSS#/g, '');
}
divHiloTmp = document.getElementById('conversacion_#MSG:IDFATHER#');
if(divHiloTmp != null){
divHiloTmp.id = divHiloTmp.id.replace(/#MSG:IDFATHER#/g, hashMensaje.idMsgRespuesta);
}
if (typeof _quitaEnlacesEskup != 'undefined' && _quitaEnlacesEskup=='1'){
html = html.replace(/@]*)>([a-z0-9_]+)<\/a>/ig,"@$5");
}
html = html.replace(/#MSG:PREMODERACION#/,_hayPremoderacion);
return (html);
}
function parseaFoto(html,hashMensaje){
if (hashMensaje.cont_adicional && hashMensaje.cont_adicional_tipo == 'IMAGEN') {
var dimX = hashMensaje.cont_adicional_dimx;
var dimY = hashMensaje.cont_adicional_dimy;
var maxAnchoFoto = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
maxAnchoFoto = _maxAnchoFoto;
}
var dimension_maxima_imagen_x = _dimension_maxima_imagen_x;
if (dimX > maxAnchoFoto) {
var porcentajeReduccion = maxAnchoFoto/dimX;
dimX = parseInt(dimX * porcentajeReduccion);
dimY = parseInt(dimY * porcentajeReduccion);
}
var texto_izquierda;
if (dimX > dimension_maxima_imagen_x) {
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#.*?#MSG:FIN_FOTO_IZQUIERDA#/, '');
texto_izquierda=false;
} else {
html = html.replace(/#MSG:INI_FOTO_COMPLETA#.*?#MSG:FIN_FOTO_COMPLETA#/, '');
texto_izquierda=true;
}
var urlImagen = hashMensaje.cont_adicional;
if (typeof _SSL != 'undefined' && _SSL == true) {
urlImagen = urlImagen.replace("http://skp00.epimg.net", "https://seguro.elpais.com");
}
urlImagen = urlImagen.replace("http:", "");
var urlImagenLarge = '';
if (hashMensaje.cont_adicional_large && hashMensaje.cont_adicional_tipo_large == 'IMAGEN') {
urlImagenLarge = hashMensaje.cont_adicional_large;
if (typeof _SSL != 'undefined' && _SSL == true) {
urlImagenLarge = urlImagenLarge.replace("http://skp00.epimg.net", "https://seguro.elpais.com");
}
urlImagenLarge = urlImagenLarge.replace("http:", "");
}
html = html.replace(/#MSG:FOTO#/g, urlImagen);
html = html.replace(/#MSG:FOTO_WIDTH#/g, dimX);
html = html.replace(/#MSG:FOTO_HEIGHT#/g, dimY);
if ((typeof(_formatoVisualizacionReal)!='undefined' && _formatoVisualizacionReal=='m')||_formatoVisualizacion == "movil"||!hashMensaje.cont_adicional_large ||((!ESKUPpuedoAmpliarFoto()&& (typeof _esWidgetJs != 'undefined' && _esWidgetJs==0)))){
html = html.replace(/#MSG:INI_FOTO_COMPLETA_CON_LARGE#.*?#MSG:FIN_FOTO_COMPLETA_CON_LARGE#/, '');
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA_CON_LARGE#.*?#MSG:FIN_FOTO_IZQUIERDA_CON_LARGE#/, '');
} else if (urlImagenLarge) {
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#.*?#MSG:FIN_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA#.*?#MSG:FIN_FOTO_COMPLETA#/, '');
if (texto_izquierda==true){
html = html.replace(/#MSG:INI_FOTO_COMPLETA_CON_LARGE#.*?#MSG:FIN_FOTO_COMPLETA_CON_LARGE#/, '');
}else{
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA_CON_LARGE#.*?#MSG:FIN_FOTO_IZQUIERDA_CON_LARGE#/, '');
}
html = html.replace(/#MSG:FOTO_LARGE#/g, urlImagenLarge);
html = html.replace(/#MSG:FOTO_WIDTH_LARGE#/g, hashMensaje.cont_adicional_dimx_large);
html = html.replace(/#MSG:FOTO_HEIGHT_LARGE#/g, hashMensaje.cont_adicional_dimy_large);
}
} else {
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#.*?#MSG:FIN_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA_CON_LARGE#.*?#MSG:FIN_FOTO_IZQUIERDA_CON_LARGE#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA#.*?#MSG:FIN_FOTO_COMPLETA#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA_CON_LARGE#.*?#MSG:FIN_FOTO_COMPLETA_CON_LARGE#/, '');
}
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:FIN_FOTO_IZQUIERDA#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA#/, '');
html = html.replace(/#MSG:FIN_FOTO_COMPLETA#/, '');
html = html.replace(/#MSG:INI_FOTO_IZQUIERDA_CON_LARGE#/, '');
html = html.replace(/#MSG:FIN_FOTO_IZQUIERDA_CON_LARGE#/, '');
html = html.replace(/#MSG:INI_FOTO_COMPLETA_CON_LARGE#/, '');
html = html.replace(/#MSG:FIN_FOTO_COMPLETA_CON_LARGE#/, '');
return html;
}
function pintaMensajeHilo(hashMensaje, esVisible, esFlotante, esProvisional) {
if (typeof esProvisional == "undefined") {
esProvisional = false;
}
if (typeof esFlotante == "undefined") {
esFlotante = false;
}
var html = document.getElementById(_idPlantillaMsgHilo).innerHTML;
html = html.replace(/\n/g, '');
html = html.replace(/\r/g, '');
html = html.replace(_idPlantillaMsgHilo, "mensaje_"+hashMensaje.idMsg);
var ahora = new Date();
var tsAhora = ahora.getTime() / 1000;
if (typeof _tsHoraActual != "undefined" && _tsHoraActual != 0) {
tsAhora = _tsHoraActual;
} else if (typeof _hashMsgs.horaActual != "undefined") {
tsAhora = _hashMsgs.horaActual;
}
var tsMensaje = hashMensaje.tsMensaje;
var fechaMensaje = new Date(hashMensaje.tsMensaje*1000);
var anyo = fechaMensaje.getFullYear();
var mes = fechaMensaje.getMonth() + 1;
if (mes < 10) { mes = "0" + mes; }
var dia = fechaMensaje.getDate();
if (dia < 10) { dia = "0" + dia; }
var hora = fechaMensaje.getHours();
if (hora < 10) { hora = "0" + hora; }
var min = fechaMensaje.getMinutes();
if (min < 10) { min = "0" + min; }
var textoHora = "";
if (tsMensaje+60 > tsAhora) {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].menos_de_un_minuto;
} else if (tsMensaje+3600 > tsAhora) {
var minutosDiff = parseInt((tsAhora-tsMensaje)/60);
if (minutosDiff == 1) {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + minutosDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].minuto;
} else {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + minutosDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].minutos;
}
} else if (tsMensaje+3600*24 > tsAhora) {
var horasDiff = parseInt((tsAhora-tsMensaje)/3600);
if (horasDiff == 1) {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + horasDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].hora;
} else {
textoHora += _ESKUPhashMsgByLang[LANGESKUP].hace + " " + horasDiff + " " + _ESKUPhashMsgByLang[LANGESKUP].horas;
}
} else {
textoHora += hora + ":" + min + ", " + dia + "-" + mes + "-" + anyo;
}
html = html.replace(/#MSG:HORA#/g, textoHora);
if(typeof hashMensaje.hilo != 'undefined'
&& typeof _hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""] != 'undefined'
&& typeof _hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas != 'undefined'
&& _hashMsgs.perfilesHilos["_" + hashMensaje.hilo + ""].num_respuestas != null
&& typeof _hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas["_"+hashMensaje.idMsg] != 'undefined'){
html = html.replace(/#MSG:INI_BOTON_VERCONVERSACION#/g, '');
html = html.replace(/#MSG:FIN_BOTON_VERCONVERSACION#/g, '');
html = html.replace(/#MSG:IDMSGCONVERSACION#/g, hashMensaje.idMsg);
html = html.replace(/#MSG:IDMSGCONVERSACIONHILO#/g, hashMensaje.hilo);
html = html.replace(/#MSG:IDMSGNUMMSG#/g,_hashMsgs.perfilesHilos["_"+hashMensaje.hilo+""].num_respuestas["_"+hashMensaje.idMsg]);
html = html.replace(/#MSG:IDMSGPADRE#/g,hashMensaje.idMsgRespuesta);
}else{
html = html.replace(/#MSG:INI_BOTON_VERCONVERSACION#.*?#MSG:FIN_BOTON_VERCONVERSACION#/g, '');
}
if (esProvisional) {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#/g, '');
html = html.replace(/#MSG:FIN_MSG_PROVISIONAL#/g, '');
html = html.replace(/#MSG:INI_DIV_MENU#.*?#MSG:FIN_DIV_MENU#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_PROVISIONAL#.*?#MSG:FIN_MSG_PROVISIONAL#/g, '');
html = html.replace(/#MSG:INI_DIV_MENU#/g, '');
html = html.replace(/#MSG:FIN_DIV_MENU#/g, '');
}
if (hashMensaje.borrado == 1) {
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" ||_quiensoy == "mensajeUnico")) {
html = html.replace(/#MSG:INI_MSG_BORRADO#/g, '');
html = html.replace(/#MSG:FIN_MSG_BORRADO#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_BORRADO#.*?#MSG:FIN_MSG_BORRADO#/g, '');
}
} else {
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) {
html = html.replace(/#MSG:INI_MSG_BORRADO#.*?#MSG:FIN_MSG_BORRADO#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_BORRADO#/g, '');
html = html.replace(/#MSG:FIN_MSG_BORRADO#/g, '');
}
}
if ( (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico")) &&
(typeof hashMensaje.opinador != "undefined" && hashMensaje.opinador == 1) ) {
html = html.replace(/#MSG:INI_MSG_OPINADOR#/g, '');
html = html.replace(/#MSG:FIN_MSG_OPINADOR#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_OPINADOR#.*?#MSG:FIN_MSG_OPINADOR#/g, '');
}
if (hashMensaje.moderacion != "undefined" && hashMensaje.moderacion == 'pte') {
html = html.replace(/#MSG:INI_MSG_PTE_PREMODERACION#/g, '');
html = html.replace(/#MSG:FIN_MSG_PTE_PREMODERACION#/g, '');
} else {
html = html.replace(/#MSG:INI_MSG_PTE_PREMODERACION#.*?#MSG:FIN_MSG_PTE_PREMODERACION#/g, '');
}
html = html.replace(/#MSG:ID#/g, hashMensaje.idMsg);
html = html.replace(/#MSG:FOTO_USUARIO#/, pintaImagenUsuario(hashMensaje.usuarioOrigen));
if(pintaImagenUsuario(hashMensaje.usuarioOrigen) == _url_imagen_usuario_por_defecto){
html = html.replace(/#MSG:INI_NO_FOTO_USUARIO#/ig,'');
html = html.replace(/#MSG:FIN_NO_FOTO_USUARIO#/ig,'');
}else{
html = html.replace(/#MSG:INI_NO_FOTO_USUARIO#.*?#MSG:FIN_NO_FOTO_USUARIO#/ig, '');
}
html = html.replace(/#MSG:NICKNAME_USUARIO#/g, hashMensaje.usuarioOrigen);
html = html.replace(/#MSG:NOMBRE_USUARIO#/g, pintaNombreUsuario(hashMensaje.usuarioOrigen));
html = html.replace(/#MSG:ID_MSG_RESPUESTA#/g, hashMensaje.idMsgRespuesta);
var contenidoMensaje = "";
if (hashMensaje.borrado == 1) {
contenidoMensaje += '(' + _ESKUPhashMsgByLang[LANGESKUP].mensaje_borrado + ')';
} else {
contenidoMensaje = '' + hashMensaje.contenido;
}
if(contenidoMensaje.match(/((https?)?:\/\/(\w+\.)?(elpais.com\/videos\/embed\/eskup\/ifr\.html\?a.[^<\s]+))/i)){
contenidoMensaje = contenidoMensaje.replace(/&/gi,"&");
contenidoMensaje = contenidoMensaje.replace(/amp;/gi,"");
}
if (typeof hashMensaje.hayVideo != "undefined" && hashMensaje.hayVideo == 1) {
contenidoMensaje = pintaVideoEnMensaje(contenidoMensaje, hashMensaje.idMsg, true, esFlotante);
}
contenidoMensaje = pintaEmbedEnMensaje(contenidoMensaje, hashMensaje.idMsg, esFlotante);
if (typeof _desactivarEnlaces != "undefined" && _desactivarEnlaces == '1') {
contenidoMensaje = contenidoMensaje.replace(/ ]*>/ig, "");
contenidoMensaje = contenidoMensaje.replace(/<\/a>/ig, "");
} else if (typeof _quiensoy != "undefined" && _quiensoy == "comentarios") {
contenidoMensaje = contenidoMensaje.replace(/ ]*)>/ig, " ");
}
if (typeof hashMensaje.valoracion_positive != 'undefined' &&
hashMensaje.valoracion_positive) {
html = html.replace(/#MSG:VALORACION_POSITIVE#/g, hashMensaje.valoracion_positive);
} else {
html = html.replace(/#MSG:VALORACION_POSITIVE#/g, 0);
}
if (typeof hashMensaje.valoracion_negative != 'undefined' && typeof hashMensaje.valoracion_negative != 'NaN' &&
hashMensaje.valoracion_negative) {
html = html.replace(/#MSG:VALORACION_NEGATIVE#/g, hashMensaje.valoracion_negative);
} else {
html = html.replace(/#MSG:VALORACION_NEGATIVE#/g, 0);
}
html = html.replace(/#MSG:CONTENIDO#/g, contenidoMensaje);
html = html.replace(/#MSG:ETIQUETA_INICIO_IMG#/g, ' ');
if (hashMensaje.idMsgRespuesta && hashMensaje.idMsgRespuesta != 0) {
if (typeof _quiensoy != "undefined" && _quiensoy == "comentarios" &&
hashMensaje.idMsgRespuesta == hashMensaje.hilo) {
html = html.replace(/#MSG:INI_DIV_CONVERSACION#.*?#MSG:FIN_DIV_CONVERSACION#/g, '');
} else {
html = html.replace(/#MSG:INI_DIV_RESPUESTA#.*?#MSG:FIN_DIV_RESPUESTA#/, '');
html = html.replace(/#MSG:ID_HILO#/g, hashMensaje.hilo);
}
} else {
html = html.replace(/#MSG:INI_DIV_CONVERSACION#.*?#MSG:FIN_DIV_CONVERSACION#/g, '');
}
html = html.replace(/#MSG:INI_DIV_CONVERSACION#/g, '');
html = html.replace(/#MSG:FIN_DIV_CONVERSACION#/g, '');
html = html.replace(/#MSG:INI_DIV_RESPUESTA#/, '');
html = html.replace(/#MSG:FIN_DIV_RESPUESTA#/, '');
html = html.replace(/#MSG:ID_HILO#/, '');
if (esFlotante) {
html = html.replace(/#MSG:INI_NO_ES_FLOTANTE#.*?#MSG:FIN_NO_ES_FLOTANTE#/g, '');
html = html.replace(/#MSG:INI_DIV_FLOTANTE#.*?#MSG:FIN_DIV_FLOTANTE#/g, '');
html = html.replace(/#MSG:INI_FLOTANTE#/g,'');
html = html.replace(/#MSG:FIN_FLOTANTE#/g, '');
}
html = html.replace(/#MSG:INI_FLOTANTE#.*?#MSG:FIN_FLOTANTE#/g, '');
html = html.replace(/#MSG:INI_NO_ES_FLOTANTE#/g, '');
html = html.replace(/#MSG:FIN_NO_ES_FLOTANTE#/g, '');
html = html.replace(/#MSG:INI_DIV_FLOTANTE#/g, '');
html = html.replace(/#MSG:FIN_DIV_FLOTANTE#/g, '');
var tablonesAMostrar = Array();
var tablonesRespuesta = Array();
if (hashMensaje.CopiaEnTablones && !esFlotante) {
var tablones = hashMensaje.CopiaEnTablones.split(',');
for (var i = 0; i != tablones.length; i++) {
if (/^ev-/.test(tablones[i])) {
tablonesAMostrar.push(pintaNombreEvento(tablones[i].substring(3)));
tablonesRespuesta.push(tablones[i].substring(3));
}
}
if (tablonesAMostrar.length > 0) {
html = html.replace(/#MSG:TEMA#/, tablonesAMostrar[0]);
html = html.replace(/#MSG:TEMA_NORM#/, tablonesRespuesta[0]);
if (tablonesAMostrar.length > 1) {
var htmlMasTemas = "";
if (typeof _desactivarEnlaces != "undefined" && _desactivarEnlaces == '1') {
htmlMasTemas = htmlMasTemas.replace(/ ]*>/ig, "");
htmlMasTemas = htmlMasTemas.replace(/<\/a>/ig, "");
}
html = html.replace(/#MSG:MAS_TEMAS#/, htmlMasTemas);
} else {
html = html.replace(/#MSG:INI_MAS_TEMAS#.*?#MSG:FIN_MAS_TEMAS#/, '');
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
} else {
html = html.replace(/#MSG:INI_DIV_TEMA#.*?#MSG:FIN_DIV_TEMA#/, '');
}
html = html.replace(/#MSG:INI_DIV_DESTACADO#.*?#MSG:FIN_DIV_DESTACADO#/g, '');
html = html.replace(/#MSG:INI_DIV_TEMA#/, '');
html = html.replace(/#MSG:FIN_DIV_TEMA#/, '');
html = html.replace(/#MSG:MAS_TEMAS#/, '');
html = html.replace(/#MSG:INI_MAS_TEMAS#/, '');
html = html.replace(/#MSG:FIN_MAS_TEMAS#/, '');
html = parseaFoto(html,hashMensaje);
var mensaje_propio = false;
if (!esFlotante) {
var htmlEnlaces = "";
var prefijoUrlBase = "";
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "widget" || _quiensoy == "mensajeUnico") &&
typeof _url_servidor != "undefined") {
prefijoUrlBase = _url_servidor;
}
if (_nickname != '' && _nickname == hashMensaje.usuarioOrigen) {
mensaje_propio = true;
}
if (_nickname != '' && _nickname != hashMensaje.usuarioOrigen) {
htmlEnlaces += "" + _ESKUPhashMsgByLang[LANGESKUP].marcar_como_spam + " ";
htmlEnlaces += "" + _ESKUPhashMsgByLang[LANGESKUP].notificar_insulto + " ";
}
htmlEnlaces += "" + _ESKUPhashMsgByLang[LANGESKUP].enlace_permanente + " ";
html = html.replace(/#MSG:ENLACES#/, htmlEnlaces);
if (hashMensaje.via && hashMensaje.via != "web") {
if (typeof _desactivarEnlaces != "undefined" && _desactivarEnlaces == '1') {
html = html.replace(/#MSG:VIA#/, 'Vía SMS');
} else {
html = html.replace(/#MSG:VIA#/, ' Vía SMS ');
}
}
var htmlCmdResponder = "";
if (_nickname != '') {
if (hashMensaje.hilo && hashMensaje.hilo != 0 &&
typeof _hashMsgs.perfilesHilos != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+hashMensaje.hilo] != "undefined" &&
(
(_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].estado != "" &&
_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].estado < 0)||
(_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].caducidad != "" &&
_hashMsgs.perfilesHilos['_'+hashMensaje.hilo].caducidad < tsAhora)
)
) {
htmlCmdResponder += "alert('" + _ESKUPhashMsgByLang[LANGESKUP].no_es_posible_responder_al_mensaje + "')";
} else {
var strCopiaEnTablones = "";
var idHilo = encodeURIComponent(hashMensaje.idMsg);
if (hashMensaje.hilo != 0) {
idHilo = encodeURIComponent(hashMensaje.hilo);
}
if (typeof hashMensaje.CopiaEnTablones != "undefined" &&
hashMensaje.CopiaEnTablones != 0 && hashMensaje.CopiaEnTablones.search("ev-") != -1) {
strCopiaEnTablones = hashMensaje.CopiaEnTablones;
}
htmlCmdResponder += "responderMensajeHilo('"+hashMensaje.idMsg+"', '"+idHilo+"|"+encodeURIComponent(hashMensaje.idMsg)+"', '"+strCopiaEnTablones+"')";
}
}
else {
htmlCmdResponder += "alert('" + _ESKUPhashMsgByLang[LANGESKUP].para_responder_tienes_que_identificarte + "')";
}
html = html.replace(/#MSG:ETIQUETA_INICIO_A#/g, '');
html = html.replace(/#MSG:ETIQUETA_FIN_A#/g, ' ' );
html = html.replace(/#MSG:CMD_RESPONDER#/g, htmlCmdResponder );
if (hashMensaje.level == 0) {
html = html.replace(/#MSG:INI_ES_PRIMER_MENSAJE#.*?#MSG:FIN_ES_PRIMER_MENSAJE#/, '');
} else {
html = html.replace(/#MSG:INI_ES_PRIMER_MENSAJE#/, '');
html = html.replace(/#MSG:FIN_ES_PRIMER_MENSAJE#/, '');
}
}
if(mensaje_propio == true){
html = html.replace(/#MSG:INI_MIO#/g,'');
html = html.replace(/#MSG:FIN_MIO#/g,'');
}else{
html = html.replace(/#MSG:INI_MIO#.*?#MSG:FIN_MIO#/g, '');
}
html = html.replace(/#MSG:VIA#/g, "");
html = html.replace(/#MSG:HIJO#/g,'');
return (html);
}
var _headESKUP = document.head || document.getElementsByTagName('head')[0];
var _styleESKUP = document.createElement('style');
var _styleBotonVideo = ".boton_video { background-image: url('//ep00.epimg.net/iconos/v1.x/v1.0/varios/boton_video_miniatura.png'); background-position: 0 0; background-repeat: no-repeat; bottom: 15px; display: block; height: 35px; left: 15px; position: absolute; width: 65px;}\n";
_styleESKUP.type = 'text/css';
if (_styleESKUP.styleSheet){
_styleESKUP.styleSheet.cssText = _styleBotonVideo;
} else {
_styleESKUP.appendChild(document.createTextNode(_styleBotonVideo));
}
_headESKUP.appendChild(_styleESKUP);
var VideosEPET_ESKUP = {};
var callbackRedefined = false;
function VDPEP_VideoPlayer_Dinamico(idVideo, ancho, idDiv)
{
if (!callbackRedefined)
{
callbackRedefined = true;
EPET_VideoPlayer_callback = function(datos)
{
if (typeof(VideosEPET_ESKUP[datos.ref_id_video].callback) == 'function')
VideosEPET_ESKUP[datos.ref_id_video].callback(datos);
else
if (MultimediaPEP[id_pidiendoDatos].multimedia)
MultimediaPEP[id_pidiendoDatos].multimedia.cargaDatos(datos);
}
}
var _id_video = idVideo + UN;
VideosEPET_ESKUP[_id_video] = new Object();
VideosEPET_ESKUP[_id_video].id = idVideo;
VideosEPET_ESKUP[_id_video].contenedor = idDiv;
VideosEPET_ESKUP[_id_video].ancho = ancho;
VideosEPET_ESKUP[_id_video].alto = ancho * 9 / 16;
VideosEPET_ESKUP[_id_video].callback = function(datos)
{
if ( datos.status != 100)
{
var caratula = datos.caratula ? datos.caratula : "http://ep00.epimg.net/t.gif";
VideosEPET_ESKUP[datos.ref_id_video].caratula = caratula;
VideosEPET_ESKUP[datos.ref_id_video].cargado = true;
EPET_VideoPlayerBloqueado(datos.id_video, VideosEPET_ESKUP[datos.ref_id_video].ancho, VideosEPET_ESKUP[datos.ref_id_video].alto, caratula , datos.status, VideosEPET_ESKUP[_id_video].contenedor);
}
else
{
var caratula;
caratula = datos.caratula.indexOf("/") == 0 ? url_cache + datos.caratula : datos.caratula;
VideosEPET_ESKUP[datos.ref_id_video].caratula = caratula;
VideosEPET_ESKUP[datos.ref_id_video].cargado = true;
datosVideo = {};
datosVideo.playerEPETParams = {"mediaWidth":VideosEPET_ESKUP[datos.ref_id_video].ancho, "mediaHeight":VideosEPET_ESKUP[datos.ref_id_video].alto, "URLMediaFile":"", "URLMediaStill":caratula, "URLFirstFrame":"", "compactMode": 'false'};
datosVideo.anchoPlayer = VideosEPET_ESKUP[datos.ref_id_video].ancho;
datosVideo.altoPlayer = VideosEPET_ESKUP[datos.ref_id_video].alto;
datosVideo.idRefBrightcove = idVideo;
datosVideo.publiActiva = "true";
datosVideo.keywordsVideo = "eskup";
datosVideo.urlNoticia = "";
datosVideo.tituloVideo = "";
datosVideo.playerVideo = '2';
var video = new EPET_Video(datosVideo, VideosEPET_ESKUP[datos.ref_id_video].contenedor);
}
VideosEPET_ESKUP[datos.ref_id_video].callback = null;
};
pideDatosVideo(_id_video);
}
function visualizaVideo(pepid, divid)
{
var _id_video = pepid + UN;
if (typeof(VideosEPET_ESKUP[_id_video]) != "undefined")
{
var datosVideo = {};
datosVideo.anchoPlayer = VideosEPET_ESKUP[_id_video].ancho;
datosVideo.altoPlayer = VideosEPET_ESKUP[_id_video].alto;
datosVideo.idRefBrightcove = pepid;
datosVideo.publiActiva = "true";
datosVideo.keywordsVideo = "eskup";
datosVideo.urlNoticia = "";
datosVideo.tituloVideo = "";
datosVideo.playerVideo = '2';
if (VideosEPET_ESKUP[_id_video].cargado)
{
var caratula = (VideosEPET_ESKUP[_id_video].caratula.indexOf("/") == 0 ? url_cache + VideosEPET_ESKUP[_id_video].caratula : VideosEPET_ESKUP[_id_video].caratula);
var htmlCaratulaVideo = " ";
document.getElementById(divid).innerHTML = htmlCaratulaVideo;
clearInterval(VideosEPET_ESKUP[_id_video].interval)
}
else
{
VideosEPET_ESKUP[_id_video].reintentos = 5;
VideosEPET_ESKUP[_id_video].interval = setInterval(function()
{
if (VideosEPET_ESKUP[_id_video].cargado)
{
var caratula = (VideosEPET_ESKUP[_id_video].caratula.indexOf("/") == 0 ? url_cache + VideosEPET_ESKUP[_id_video].caratula : VideosEPET_ESKUP[_id_video].caratula);
var htmlCaratulaVideo = " ";
document.getElementById(divid).innerHTML = htmlCaratulaVideo;
clearInterval(VideosEPET_ESKUP[_id_video].interval)
}
else
if ( --VideosEPET_ESKUP[_id_video].reintentos <= 0 )
clearInterval(VideosEPET_ESKUP[_id_video].interval)
},500);
}
return;
}
var dimX = _maxAnchoFotoDefecto;
var anchoVideo = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
anchoVideo = _maxAnchoFoto;
}
if (_maxAnchoFotoDefecto > anchoVideo) {
var porcentajeReduccion = anchoVideo/_maxAnchoFotoDefecto;
dimX = parseInt(dimX * porcentajeReduccion);
}
VDPEP_VideoPlayer_Dinamico(pepid, dimX, divid);
}
function posicionarEnVideoRepetido(contenedor) {
if (document.getElementById(contenedor)) {
EPETUtils_posicionarScrollEnPagina( (EPETUtils_calcAbsPositionV2(document.getElementById(contenedor))[1])-50);
}
}
function pintaVideoEnMensaje(contenidoMensaje, idMensaje, enHilo, esFlotante) {
if (typeof _mostrarVideosEnMensaje != "undefined" && _mostrarVideosEnMensaje == false) {
return contenidoMensaje;
}
if (typeof enHilo == "undefined") {
enHilo = false;
}
if (typeof esFlotante == "undefined" ) {
esFlotante = false;
}
var htmlVideo = '';
var enlaceVideo = '';
var resMatch = '';
var urlVideo = '';
if(typeof classvideos == 'undefined'){ classvideos = '';}
var patron = '(]*href=\"(http(s)?:\/\/(\w+\.)?(youtube\.com\/|youtu\.be\/|metacafe\.com\/|dailymotion\.com\/|dai\.ly\/|vimeo\.com\/|current\.com\/|video\.google\.com\/|video\.google\.es\/|vids\.myspace\.com\/|elpais\.com\/videos\/|instanceplayer\.prisasd\.com\/widget\/v1\/player\/((?!\/audio\/).)+?\/video\/)([^\"]+))"[^>]*>[^<]+<\/a>)';
var reg1 = new RegExp(patron,"i");
var reg2 = new RegExp(patron,"ig");
if (contenidoMensaje.match(reg1)) {
enlaceVideo = RegExp.$1;
urlVideo = RegExp.$2;
if ((typeof _hilo != "undefined" && _hilo != "" )|| (typeof mostrarBotonVideo != 'undefined' && mostrarBotonVideo == 'mostrar')) {
var result = contenidoMensaje.match(reg2);
var objVideo = '';
htmlVideo = [];
for (var match = 0; match < result.length; match ++) {
objVideo = new Object();
result[match].match(patron);
enlaceVideo = RegExp.$1
urlVideo = RegExp.$2;
objVideo.html = "";
objVideo.enlaceVideo = enlaceVideo;
objVideo.urlVideo = urlVideo;
htmlVideo.push(objVideo);
}
} else {
contenidoMensaje = pintaEmbedVideoEnMensaje(contenidoMensaje,idMensaje,esFlotante);
}
for (var z = 0; z < htmlVideo.length; z ++) {
if (htmlVideo[z].html != htmlVideo[z].urlVideo) {
contenidoMensaje = contenidoMensaje.replace(htmlVideo[z].enlaceVideo, htmlVideo[z].html);
}
}
if (typeof _formatoVisualizacion != "undefined" && _formatoVisualizacion == "movil") {
contenidoMensaje += " " + _ESKUPhashMsgByLang[LANGESKUP].ver_video + " ";
}
}
else
{
if (contenidoMensaje.match(/(]*href=\"https?:\/\/.*\?videoid=([^\"]+)"[^>]*>[^<]+<\/a>)/i)) {
enlaceVideo = RegExp.$1
var idvideo = RegExp.$2;
var idDivVideo = "contenedorvideo_epet_" + idMensaje;
var imgCacheServer = "//skp00.epimg.net";
if (typeof _SSL != 'undefined' && _SSL == true) {
imgCacheServer = "https://seguro.elpais.com";
}
htmlVideo = '
';
contenidoMensaje = contenidoMensaje.replace(enlaceVideo, htmlVideo);
}
}
return contenidoMensaje;
}
function obtenerHtmlEmbedVideo(urlPaginaVideo,idMensaje,enHilo,esFlotante){
var prefijoId = '';
if (typeof esFlotante == "undefined" ) {
esFlotante = false;
}
if(esFlotante){
prefijoId = 'flot_';
}
if (typeof _mostrarEmbedsEnMensaje != "undefined" && _mostrarEmbedsEnMensaje == false) {
return contenidoMensaje;
}
var enlaceEmbed = '';
var params = ' allowfullscreen';
var idEmbebido = prefijoId+"id_embebido_mensaje_"+idMensaje;
if (urlPaginaVideo.match(/((https?)?:\/\/(\w+\.)?(youtube.com\/)([\w_=\?&]+v=)(.*))/i)){
enlaceEmbed = "https://"+RegExp.$3+RegExp.$4+"/embed/"+RegExp.$6;
}else if (urlPaginaVideo.match(/((https?)?:\/\/(\w+\.)?(youtu.be\/)(.*))/i)){
enlaceEmbed = "https://www.youtube.com/embed/"+RegExp.$5;
}else if (urlPaginaVideo.match(/((https?)?:\/\/(\w+\.)?(metacafe.com\/)(watch\/)([0-9]*)(.*))/i)){
enlaceEmbed = RegExp.$2+"://"+RegExp.$3+RegExp.$4+"/embed/"+RegExp.$6+"/"+RegExp.$7;
params+= " frameborder=0";
}else if (urlPaginaVideo.match(/((https?)?:\/\/(\w+\.)?(vimeo.com\/)([a-zA-Z\/]*)([0-9]*)(.*))/i)){
enlaceEmbed="https://player.vimeo.com/video/"+RegExp.$6;
params+= " webkitallowfullscreen mozallowfullscreen";
}else if (urlPaginaVideo.match(/((https?)?:\/\/(\w+\.)?(dailymotion.com\/video\/|dai.ly\/)(.*))/i)){
enlaceEmbed = "http://www.dailymotion.com/embed/video/"+RegExp.$5;
}else if (urlPaginaVideo.match(/((https?)?:\/\/(\w+\.)?(instanceplayer.prisasd.com\/)([a-zA-Z\/]*)([0-9]*)(.*))/i)){
enlaceEmbed = urlPaginaVideo;
}else if (urlPaginaVideo.match(/((https?)?:\/\/(\w+\.)?(elpais.com\/videos\/embed\/eskup\/ifr\.html\?a.[^<\s]+))/i)){
enlaceEmbed = urlPaginaVideo.replace(/&/gi,"&");
enlaceEmbed = urlPaginaVideo.replace(/amp;/gi,"");
}
var imgCacheServer = "//skp00.epimg.net";
if (typeof _SSL != 'undefined' && _SSL == true) {imgCacheServer = "https://seguro.elpais.com";}
var htmlVideo =' ';
return htmlVideo;
}
function pintaEmbedVideoEnMensaje(contenidoMensaje,idMensaje,esFlotante){
var prefijoId = '';
if (typeof esFlotante == "undefined" ) {
esFlotante = false;
}
if(esFlotante){
prefijoId = 'flot_';
}
if (typeof _mostrarEmbedsEnMensaje != "undefined" && _mostrarEmbedsEnMensaje == false) {
return contenidoMensaje;
}
var hashDatosEmbedArray = obtenerInfoVideo(contenidoMensaje);
for (var iter=0;iter ';
contenidoMensaje = contenidoMensaje.replace(hashDatosEmbed['enlaceCompleto'], htmlEmbed);
}
return contenidoMensaje;
}
function obtenerInfoVideo(contenidoMensaje) {
var hashRegExpr = [
'((]*href=\")?((http)?(s)?:\/\/(\w+\.)?(youtube.com){1}?(\/watch[\?]v=){1}?([^\"\ \,\&]+)[&]?([^\"\ \,]+)?)("[^>]*>[^<]+<\/a>)?)',
'(( ]*href=\")?((http)?(s)?:\/\/(\w+\.)?(youtu.(be)){1}?([^\"\ \,\&]+)[&]?([^\"\ \,]+)?)("[^>]*>[^<]+<\/a>)?)',
];
var hashDatosEmbed = Array(); var iteracion=0; var a_tmp;
for(var i=0;i]*?href=\")?((http)?(s)?:\/\/(\w+\.)?(vimeo.com\/){1}?([0-9]*)?)("[^>]*>[^<]+<\/a>)?)' ,"g");
while ((a_tmp= myRe.exec(contenidoMensaje)) !== null) {
hashDatosEmbed[iteracion] = Array();
hashDatosEmbed[iteracion].enlaceCompleto = a_tmp[1];
hashDatosEmbed[iteracion].urlEmbebido= "https://player.vimeo.com/video/"+a_tmp[8]+"?portrait=0";
iteracion++;
}
myRe = new RegExp('((]*href=\")?((http)?(s)?:\/\/(\w+\.)?(dailymotion.com\/|dai.ly\/){1}?(video\/)?([a-z0-9_\-]*[^\"])+?)("[^>]*>[^<]+<\/a>)?)',"g");
while ((a_tmp= myRe.exec(contenidoMensaje)) !== null) {
hashDatosEmbed[iteracion] = Array();
hashDatosEmbed[iteracion].enlaceCompleto = a_tmp[1];
hashDatosEmbed[iteracion].urlEmbebido= "https://www.dailymotion.com/embed/video/"+a_tmp[9];
iteracion++;
}
myRe = new RegExp('(( ]*href=\")?((http)?(s)?:\/\/(\w+\.)?(instanceplayer.prisasd.com\/{1}widget\/v1\/player\/((?!\/audio\/).)+?\/video\/?[0-9]+\/?([0-9 a-z A-Z]+)))([^>]*>[^<]+<\/a>)?)',"g");
while ((a_tmp = myRe.exec(contenidoMensaje)) !== null) {
hashDatosEmbed[iteracion] = Array();
hashDatosEmbed[iteracion].enlaceCompleto = a_tmp[1];
hashDatosEmbed[iteracion].urlEmbebido= a_tmp[3];
iteracion++;
}
myRe = new RegExp('(( ]*href=\")?((http)?(s)?:\/\/(\w+\.)?(elpais.com\/videos\/embed\/eskup\/ifr\.html\?.[^
]*>[^<]+<\/a>)?)',"g");
contenidoMensaje = contenidoMensaje.replace(/&/gi,"&");
while ((a_tmp = myRe.exec(contenidoMensaje)) !== null) {
hashDatosEmbed[iteracion] = Array();
hashDatosEmbed[iteracion].enlaceCompleto = a_tmp[1];
hashDatosEmbed[iteracion].urlEmbebido= a_tmp[1].match(/http.[^"<>]+/);
iteracion++;
}
return hashDatosEmbed;
}
function visualizaVideoEmbed(id,src,params){
var div_contenedor = document.getElementById(id);
if (typeof div_contenedor !='undefined'){
var dimX = div_contenedor.offsetWidth;
}else{
var dimX = _maxAnchoFotoDefecto;
}
if(src.match(/^http:\/\//) && src.match(/instanceplayer/)){
src = src.replace('http://','//');
}
if(src.match(/((https?)?:\/\/(\w+\.)?(elpais.com\/videos\/embed\/eskup\/ifr\.html\?a.[^<\s]+))/i)){
var numC = src.indexOf('&')-(3+src.indexOf('?'));
var percent = (src.substr(src.indexOf('?')+3, numC))*100;
percent = percent.toFixed(3);
document.getElementById(id).innerHTML="
";
}else{
var dimY = Math.round(dimX*9/16);
document.getElementById(id).innerHTML="";
}
}
function obtenerInfoEmbed(contenidoMensaje) {
var hashRegExpr = [
'((]*href=\")?(http(s)?:\/\/(\w+\.)?(twitter.com\/)([^\"\ \,<]+))("[^>]*>[^<]+<\/a>)?)',
'(( ]*href=\")?(http(s)?:\/\/(\w+\.)?(facebook.com\/)([^\"\ \,<]+))("[^>]*>[^<]+<\/a>)?)',
'(( ]*href=\")?(http(s)?:\/\/(\w+\.)?(instagram.com\/)([^\"\ \,<]+))("[^>]*>[^<]+<\/a>)?)',
'(( ]*href=\")?(http(s)?:\/\/(\w+\.)?(vine.co\/)([^\"\ \,<]+))("[^>]*>[^<]+<\/a>)?)',
'(( ]*href=\")?(http(s)?:\/\/(\w+\.)?(instanceplayer.prisasd.com\/){1}widget\/v1\/player\/((?!\/video\/).)+?\/audio\/?[0-9]+\/?([0-9 a-z A-Z _ -]+))([^>]*>[^<]+<\/a>)?)',
'(( ]*href=\")?((http)?(s)?:\/\/(\w+\.)?(elpais.com\/videos\/embed\/eskup\/ifr\.html\?.[^]*>[^<]+<\/a>)?)'
];
var hashDatosEmbed = Array(); var iteracion=0; var myArray;
for(var i=0;i]*href=\"((http(s)?:\/\/)(play.cadenaser.com\/audio\/)(.*?)[\/]?"[^>]*>[^<]+<\/a>))',"gi");
while ((myArray = myRe.exec(contenidoMensaje)) !== null) {
hashDatosEmbed[iteracion] = Array();
hashDatosEmbed[iteracion].valido = true;
hashDatosEmbed[iteracion].enlaceCompleto = myArray[1];
console.log(myArray[6]);
hashDatosEmbed[iteracion].urlEmbebido = "//instanceplayer.prisasd.com/widget/v1/player/playser/audio/81/"+myArray[6];
hashDatosEmbed[iteracion].origen = 'playser.com';
iteracion++;
}
myRe = new RegExp('(]*href=\"((http(s)?:\/\/)(play.cadenaser.com\/)([^\"]+))"[^>]*>[^<]+<\/a>)',"gi");
while ((myArray = myRe.exec(contenidoMensaje)) !== null) {
hashDatosEmbed[iteracion] = Array();
hashDatosEmbed[iteracion].valido = true;
hashDatosEmbed[iteracion].enlaceCompleto = myArray[1];
hashDatosEmbed[iteracion].urlEmbebido = myArray[3]+myArray[5]+""+myArray[6];
hashDatosEmbed[iteracion].origen = 'playser.com';
iteracion++;
}
return (hashDatosEmbed);
}
function pintaEmbedEnMensaje(contenidoMensaje, idMensaje, esFlotante) {
var prefijoId = '';
if (typeof _mostrarEmbedsEnMensaje != "undefined" && _mostrarEmbedsEnMensaje == false) {
return contenidoMensaje;
}
if (typeof esFlotante == "undefined") {
esFlotante = false;
}
if(esFlotante){
prefijoId = 'flot_';
}
var hashDatosEmbedArray = obtenerInfoEmbed(contenidoMensaje);
for (var iter=0;iter';
if ((typeof _hilo != "undefined" && _hilo != "" ) || (typeof mostrarBotonEmbebido != 'undefined' && mostrarBotonEmbebido == 'mostrar')) {
htmlEmbed += '' + _ESKUPhashMsgByLang[LANGESKUP].ver_contenido_externo + ' ';
} else {
var imgCacheServer = "//skp00.epimg.net";
if (typeof _SSL != 'undefined' && _SSL == true) {
imgCacheServer = "https://seguro.elpais.com";
}
htmlEmbed += ' ';
}
htmlEmbed += '';
contenidoMensaje = contenidoMensaje.replace(hashDatosEmbed.enlaceCompleto, htmlEmbed);
}
}
return contenidoMensaje;
}
function visualizaComentario(urlComentario, idDiv) {
var dominio = urlComentario.substr(0,urlComentario.indexOf("/Comentario"));
var codigo = urlComentario.substr(urlComentario.lastIndexOf("/")+1);
document.getElementById(idDiv).innerHTML = '';
}
function visualizaTweet(urlTweet, idDiv) {
document.getElementById(idDiv).innerHTML = "";
var twitterJS = document.createElement("script");
twitterJS.async = true;
twitterJS.src = "//platform.twitter.com/widgets.js";
document.getElementById(idDiv).parentNode.appendChild(twitterJS);
}
function visualizaPostFB(urlPost, idDiv) {
if (!document.getElementById('fb-root')) {
var divFBroot = document.createElement('div');
divFBroot.id = 'fb-root';
document.getElementById(_idContenedorMsgs).parentNode.insertBefore(divFBroot, document.getElementById(_idContenedorMsgs));
var facebookJS = document.createElement("script");
facebookJS.id = "facebook-jssdk";
facebookJS.src = "//connect.facebook.net/es_LA/all.js#xfbml=1";
document.getElementById(_idContenedorMsgs).parentNode.insertBefore(facebookJS, document.getElementById(_idContenedorMsgs));
}
urlPost = urlPost.replace("http://", "https://");
var anchoEmbed = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
anchoEmbed = _maxAnchoFoto;
}
document.getElementById(idDiv).innerHTML = "
";
if (typeof FB != 'undefined' && typeof FB.XFBML != 'undefined') {
FB.XFBML.parse();
}
}
function visualizaInstagram(urlFoto, idDiv) {
var anchoEmbed = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
anchoEmbed = _maxAnchoFoto;
}
var altoEmbed = parseInt( ((710/612)+0.1) * anchoEmbed);
if (urlFoto.substr(urlFoto.length-1) != '/') {
urlFoto += '/';
}
urlFoto = urlFoto.replace("http://", "https://");
document.getElementById(idDiv).innerHTML = "";
}
function visualizaVine(urlVideo, idDiv) {
var anchoEmbed = _maxAnchoFotoDefecto;
if (typeof _maxAnchoFoto != "undefined") {
anchoEmbed = _maxAnchoFoto;
}
if (urlVideo.substr(urlVideo.length-1) != '/') {
urlVideo += '/';
}
urlVideo = urlVideo.replace("http://", "https://");
document.getElementById(idDiv).innerHTML = "";
var vineJS = document.createElement("script");
vineJS.async = true;
vineJS.src = "//platform.vine.co/static/scripts/embed.js";
document.getElementById(idDiv).parentNode.appendChild(vineJS);
}
function visualizaPlaySER(urlAudio, idDiv) {
document.getElementById(idDiv).innerHTML = "";
}
function visualizaPlayerTOP(urlAudio, idDiv) {
var clase = '';
if (((typeof medio != "undefined")&& (medio=='cadenaser'))||((typeof _medioOrigen!='undefined') && (_medioOrigen =='cs'))){
clase = ' class="player-audio"';
}
document.getElementById(idDiv).innerHTML = "";
}
function mostrarOcultarVideoInfo(idMsg, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
capaInfo = document.getElementById("videocapainfo_" + idMsg);
if (capaInfo.style.display == "none") {
var spanBoton = document.getElementById("videoboton_" + idMsg);
var posBoton = EPETUtils_calcAbsPositionV2(spanBoton);
var extraLeft = -2;
var extraTop = -1;
capaInfo.style.display = "block";
capaInfo.style.left = parseInt(posBoton[0] - capaInfo.clientWidth + spanBoton.clientWidth + extraLeft) + "px";
capaInfo.style.top = parseInt(posBoton[1] - capaInfo.clientHeight + extraTop) + "px";
} else {
capaInfo.style.display = "none";
}
}
function pintaRecarga() {
var enRecarga = false;
if (_es_primera_carga || typeof _intRecarga != "undefined") {
enRecarga = true;
}
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (typeof _hashMsgs.mensajes[i]["hayVideo"] != "undefined" &&
_hashMsgs.mensajes[i]["hayVideo"] == 1) {
if (document.getElementById("videocapainfo_" + _hashMsgs.mensajes[i]["idMsg"])) {
if (enRecarga) {
document.getElementById("videocapainfo_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Puedes parar la recarga automática de la página pulsando el botón de pausa para que no te interrumpa mientras ves el vídeo.";
} else {
document.getElementById("videocapainfo_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Puedes reanudar la recarga pulsando el botón de play para que los nuevos mensajes aparezcan automáticamente.";
}
}
if (document.getElementById("videoboton_" + _hashMsgs.mensajes[i]["idMsg"])) {
if (enRecarga) {
document.getElementById("videoboton_" + _hashMsgs.mensajes[i]["idMsg"]).className = "botonpausa";
} else {
document.getElementById("videoboton_" + _hashMsgs.mensajes[i]["idMsg"]).className = "botonplay";
}
}
if (document.getElementById("videoenlaceexplicacion_" + _hashMsgs.mensajes[i]["idMsg"])) {
if (enRecarga) {
document.getElementById("videoenlaceexplicacion_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Pausar recarga de página";
} else {
document.getElementById("videoenlaceexplicacion_" + _hashMsgs.mensajes[i]["idMsg"]).innerHTML =
"Reanudar la recarga";
}
}
}
}
}
function irAPagina(numPagina) {
if (location.search) {
location.href = location.pathname + location.search + "&p=" + numPagina;
} else {
location.href = location.pathname + "?p=" + numPagina;
}
}
function pintaPaginacion() {
if (typeof _pintarPaginacion != "undefined" && _pintarPaginacion == false) {
return(false);
}
if ( ( _numPagActual == 1) && (parseInt(_hashMsgs.numMensajes) <= _numMsgPag) ) {
return(false);
}
var html = '';
forzarLocation = true;
if (isIOsNavigator()=='ios|webview'){
forzarLocation = false;
}
if (typeof callBackPintaPaginacion != 'undefined') {
html += callBackPintaPaginacion();
} else {
html += '';
if (_numPagActual == 1) {
html += '<< ';
} else {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html += '<< ';
} else {
html += '<< ';
}
}
if (_numPagActual > 1) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html += '< ';
} else {
html += '< ';
}
} else {
html += '< ';
}
html += '' + _numPagActual + ' ';
if (parseInt(_numPagActual*_numMsgPag) < parseInt(_hashMsgs.numMensajes)) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
html += '> ';
} else {
html += '> ';
}
} else {
html += '> ';
}
html += ' ';
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
var divContenedorPaginacion = document.getElementById(_idContenedorPag);
divContenedorPaginacion.innerHTML = html;
divContenedorPaginacion.style.display = '';
} else {
var divContenedorAbajo = document.getElementById(_idContenedorPag + '_abajo');
divContenedorAbajo.innerHTML = html;
divContenedorAbajo.style.display = '';
var divContenedorArriba = document.getElementById(_idContenedorPag + '_arriba');
if(divContenedorArriba != null){
divContenedorArriba.innerHTML = html;
divContenedorArriba.style.display = '';
}
if (document.getElementById('div_subir_pagina')) {
var divSubir = document.getElementById('div_subir_pagina');
divSubir.style.display = '';
}
}
}
function ESKUPisMobile(){
var mobile = false;
var userAgent = window.navigator.userAgent.toLowerCase();
if (userAgent.indexOf("mobile")>0){
mobile = true;
}
return mobile;
}
function isIOsNavigator(){
var standalone = window.navigator.standalone,
userAgent = window.navigator.userAgent.toLowerCase(),
safari = /safari/.test( userAgent ),
ios = /iphone|ipod|ipad/.test( userAgent );
var typeNavigator = '';
if( ios ) {
typeNavigator = 'ios';
if ( !standalone && safari ) {
typeNavigator+='|browser';
} else if ( standalone && !safari ) {
typeNavigator+='|standalone';
} else if ( !standalone && !safari ) {
typeNavigator+='|webview';
};
} else {
typeNavigator = 'notios';
};
return typeNavigator;
}
function pintaPaginacionHilo(idConversacion,msgFin,numMensajes,numPagina) {
if(typeof numPagina == "undefined"){numPagina = 1;}
if (typeof _pintarPaginacion != "undefined" && _pintarPaginacion == false) {
return(false);
}
var msgFinMin = msgFin-numMensajesPlusHilo;
var html = '';
numPagina++;
if ( numMensajes > msgFin) {
html += 'Mostrar más ';
}
var divConversacion = document.getElementById('conversacion_'+idConversacion);
if(divConversacion != null){
var divPaginacionHilo = document.getElementById('contenedorpaginacion_'+idConversacion);
if(typeof divPaginacionHilo == 'undefined' || divPaginacionHilo == null){
divPaginacionHilo = document.createElement('div');
divPaginacionHilo.id = 'contenedorpaginacion_'+idConversacion;
}
divPaginacionHilo.innerHTML = html;
divPaginacionHilo.style.display = '';
divPaginacionHilo.className += ' mostrar-mas';
divConversacion.appendChild(divPaginacionHilo);
}
}
function comprobarDispNuevosMensajes() {
var host = _hostCDNporDefecto;
if (typeof _hostCDNtsUpdate != 'undefined') {
host = _hostCDNtsUpdate;
}
var url = _urlTSUpdate;
var params = "";
params += 'c=callbackComprobarDispNuevosMensajes';
if (host.indexOf('epimg.net') == -1) {
params += "&rnd=" + Math.random();
}
if (typeof _tablon1 != "undefined" && _tablon1 != "" && _tablon1 != "2" && _tablon1 != "3") {
params += "&t=" + _tablon1;
} else if (typeof _hilo != "undefined" && _hilo != "") {
params += "&m=" + _hilo;
}
if ( (typeof _quiensoy != 'undefined') && _quiensoy == 'widget') {
params += '&u=1';
if ( (typeof _evento_actual_cerrado != 'undefined') && (_evento_actual_cerrado == 1) && !(_es_primera_carga) ){
paraEventosRecarga();
return;
}
} else if ( typeof _hilo != "undefined" && _hilo != "" ) {
if ( typeof _comentariosActivos != 'undefined' && !_comentariosActivos && !_es_primera_carga ) {
paraEventosRecarga();
}
}
ESKUP.peticionJSONP(host + url + params);
}
function callbackComprobarDispNuevosMensajes(data) {
var _hashPeticionUpdate = data;
if (typeof _hashPeticionUpdate != 'object') {
_hashPeticionUpdate = Array();
}
if (typeof _tsHoraActual != "undefined" ) {
_tsHoraActual = _hashPeticionUpdate.horaActual;
}
if (_es_primera_carga ||
typeof _hashPeticionUpdate.status == "undefined" ||
typeof _hashPeticionUpdate.ultimaActualizacion == "undefined" ||
_hashPeticionUpdate.status != 1) {
if (_hashPeticionUpdate.status == -3) {
mostrarError("Error al comprobar actualizaciones de mensajes.");
paraEventosRecarga();
}
else {
recuperarInformacionMensajes();
}
} else {
var hayNuevaInformacion = false;
if ((typeof _hashPeticionUpdate.ultimaActualizacion[_tablon1] != "undefined") &&
(parseInt(_hashPeticionUpdate.ultimaActualizacion[_tablon1]) == -1 ||
parseInt(_hashPeticionUpdate.ultimaActualizacion[_tablon1]) > parseInt(_tsTablon1))) {
hayNuevaInformacion = true;
_tsTablon1 = _hashPeticionUpdate.ultimaActualizacion[_tablon1];
} else if (typeof _hilo != "undefined" && _hilo != "") {
var strTsHilo = _hilo;
if (typeof _tipoHilo != "undefined") {
if (_tipoHilo == "o") {
strTsHilo = 'opinadores';
} else if (_tipoHilo == "2") {
strTsHilo = 't2';
}
}
if (typeof _hashPeticionUpdate.ultimaActualizacion[strTsHilo] != "undefined" &&
parseInt(_hashPeticionUpdate.ultimaActualizacion[strTsHilo]) > parseInt(_tsTablon1)) {
hayNuevaInformacion = true;
_tsTablon1 = _hashPeticionUpdate.ultimaActualizacion[strTsHilo];
if (typeof _tipoHilo != "undefined") {
if (_tipoHilo == "o") {
_tsTablonOp = _tsTablon1;
} else if (_tipoHilo == "2") {
_tsTablonSeg = _tsTablon1;
} else {
_tsTablonTodos = _tsTablon1;
}
}
}
}
if (_nickname != '') {
if ( (typeof _quiensoy != 'undefined') && _quiensoy == 'web') {
var t1_evento = -1;
var mi_t2 = -1;
var mi_t3 = -1;
if (typeof _hashPeticionUpdate.ultimaActualizacion != "undefined" ) {
if ( typeof _hashPeticionUpdate.ultimaActualizacion['t2-' + _nickname] != "undefined" ) {
mi_t2 = _hashPeticionUpdate.ultimaActualizacion['t2-' + _nickname];
}
if ( typeof _hashPeticionUpdate.ultimaActualizacion['t3-' + _nickname] != "undefined" ) {
mi_t3 = _hashPeticionUpdate.ultimaActualizacion['t3-' + _nickname];
}
if ( typeof _hashPeticionUpdate.ultimaActualizacion[_tablon1] != "undefined" ) {
t1_evento = _hashPeticionUpdate.ultimaActualizacion[_tablon1];
}
}
if ( (mi_t2 == -1) && (mi_t3 == -1) ) {
var url_recarga = '';
if ( _tablon1.match("ev-") ) {
url_recarga = '/' + '*' + _tablon;
}
else {
if ( (_tablon1.match("t1-")) && !(_tablon1 == "t1-ULTIMOSMENSAJES") ) {
var id_usuario = _tablon1.substring(3);
url_recarga = '/' + id_usuario;
}
else {
url_recarga = '/todos.html';
}
}
location.href = url_recarga;
return;
}
}
if (typeof _hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname] != "undefined") {
if ((parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) == -1) ||
(parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) > parseInt(_tsTablon2))) {
if (parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) == -1) {
if (_tablon == "2") {
hayNuevaInformacion = true;
}
} else if (_tablon != "2" && _tsTablon2 != 0) {
cambiaAspectoPestana('1', true);
_tsTablon2 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]);
}
if (_tablon == "2" && parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]) != -1) {
hayNuevaInformacion = true;
_tsTablon2 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t2-"+_nickname]);
}
}
}
if (typeof _hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname] != "undefined") {
if ((parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) == -1) ||
(parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) > parseInt(_tsTablon3))) {
if (parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) == -1) {
if (_tablon == "3") {
hayNuevaInformacion = true;
}
} else if (_tablon != "3" && _tsTablon3 != 0) {
cambiaAspectoPestana('5', true);
_tsTablon3 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]);
}
if (_tablon == "3" && parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]) != -1) {
hayNuevaInformacion = true;
_tsTablon3 = parseInt(_hashPeticionUpdate.ultimaActualizacion["t3-"+_nickname]);
}
}
}
}
if (typeof _tipoHilo != "undefined") {
if (typeof _hilo != "undefined" && typeof _hashPeticionUpdate.ultimaActualizacion[_hilo] != "undefined" &&
parseInt(_hashPeticionUpdate.ultimaActualizacion[_hilo]) > parseInt(_tsTablonTodos)) {
if (_tipoHilo != '') {
if (document.getElementById('flecha_num_comentarios_pestana')) {
document.getElementById('flecha_num_comentarios_pestana').style.display = 'block';
document.getElementById('flecha_num_comentarios_pestana').className = 'nuevos';
}
if (document.getElementById('aviso_nuevos_comentarios_pestana')) {
document.getElementById('aviso_nuevos_comentarios_pestana').style.display = 'block';
}
}
}
if (typeof _hashPeticionUpdate.ultimaActualizacion['opinadores'] != "undefined" &&
parseInt(_hashPeticionUpdate.ultimaActualizacion['opinadores']) > parseInt(_tsTablonOp)) {
if (_tipoHilo != 'o') {
if (document.getElementById('flecha_num_comentarios_pestana_opinadores')) {
document.getElementById('flecha_num_comentarios_pestana_opinadores').style.display = 'block';
document.getElementById('flecha_num_comentarios_pestana_opinadores').className = 'nuevos';
}
if (document.getElementById('aviso_nuevos_comentarios_pestana_opinadores')) {
document.getElementById('aviso_nuevos_comentarios_pestana_opinadores').style.display = 'block';
}
}
}
if (typeof _hashPeticionUpdate.ultimaActualizacion['t2'] != "undefined" &&
parseInt(_hashPeticionUpdate.ultimaActualizacion['t2']) > parseInt(_tsTablonSeg)) {
if (_tipoHilo != '2') {
if (document.getElementById('flecha_num_comentarios_pestana_loquesigo')) {
document.getElementById('flecha_num_comentarios_pestana_loquesigo').style.display = 'block';
document.getElementById('flecha_num_comentarios_pestana_loquesigo').className = 'nuevos';
}
if (document.getElementById('aviso_nuevos_comentarios_pestana_loquesigo')) {
document.getElementById('aviso_nuevos_comentarios_pestana_loquesigo').style.display = 'block';
}
}
}
}
if (hayNuevaInformacion) {
if (_activarRecargaAutomatica != 'undefined' && _activarRecargaAutomatica == true) {
f_forzar_recarga_mensajes();
} else if (document.getElementById(_idContenedorMsgs).firstChild &&
document.getElementById(_idContenedorMsgs).firstChild.id == "provisional") {
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico") &&
typeof _tipoHilo != "undefined" && _tipoHilo == "o" &&
typeof _soyOpinador != "undefined" && _soyOpinador == true) {
f_forzar_recarga_mensajes();
} else {
_hayInformacionPendiente = true;
if (document.getElementById(_idContenedorRefr)) {
document.getElementById(_idContenedorRefr).style.display = 'block';
}
}
if (typeof _quiensoy != "undefined" && _quiensoy == "widget") {
f_forzar_recarga_mensajes();
}
} else {
_hayInformacionPendiente = true;
if (document.getElementById(_idContenedorRefr)) {
document.getElementById(_idContenedorRefr).style.display = 'block';
}
}
}
}
}
function recuperarInformacionMensajes() {
var url = _urlOuteskup;
if ( (typeof _quiensoy != 'undefined') && (_quiensoy == 'widget' || _quiensoy == 'movil') ) {
url = _urlOuteskupSimple;
}
if ( (typeof _tablon1 != 'undefined') && (_tablon1 != '') ) {
if ( (_tablon1.match("ev-")) || (_tablon1.match("t1-")) ) {
url = _urlOuteskupSimple;
}
}
else if ( (typeof _hilo != 'undefined') && (_hilo != '') ) {
url = _urlOuteskupSimple;
}else if ( (typeof _idMsg != 'undefined') && (_idMsg != '') ) {
url = _urlOuteskupSimple;
} else {
return false;
}
var params = "rnd=" + Math.random() + "&";
if (typeof _tablon1 != "undefined" && _tablon1 != "") {
params += "t=" + _tablon1 + "&p=" + _numPagCache + "&nummsg=" + _numMsgCache;
} else if ( typeof _hilo != 'undefined' && _hilo != '' ) {
params += "th=2&msg=" + _hilo + "&p=" + _numPagCache + "&nummsg=" + _numMsgCache;
if (typeof _tipoHilo != "undefined" && _tipoHilo != "") {
params += "&tt=" + _tipoHilo;
}
} else if ( (typeof _idMsg != 'undefined') && (_idMsg != '') ) {
params +="msg="+_idMsg;
} else {
params += "t=info";
}
if (_ultimaRecargaServidor > 0) {
params += "&ts=" + parseInt(_tsTablon1);
}
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var _hashPeticion = Array();
try {
eval("_hashPeticion = " + data);
} catch(e) {
_hashPeticion = Array();
mostrarError(_ESKUPhashMsgByLang[LANGESKUP].no_es_posible_recuperar_los_mensajes);
}
if (_nickname != '') {
if (typeof _hashPeticion.updated != "undefined") {
if ((typeof _hashPeticion.updated["t2-"+_nickname] != "undefined") &&
(parseInt(_hashPeticion.updated["t2-"+_nickname]) > parseInt(_tsTablon2)) &&
_tablon != "2" && _tsTablon2 != 0) {
cambiaAspectoPestana('1', true);
}
if ((typeof _hashPeticion.updated["t3-"+_nickname] != "undefined") &&
(parseInt(_hashPeticion.updated["t3-"+_nickname]) > parseInt(_tsTablon3)) &&
_tablon != "3" && _tsTablon3 != 0) {
cambiaAspectoPestana('5', true);
}
if (_ultimaRecargaServidor == 0 &&
typeof _hashPeticion.ultimaVisita != "undefined") {
if (typeof _hashPeticion.ultimaVisita["2"] != "undefined" &&
typeof _hashPeticion.updated["t2-"+_nickname] != "undefined" &&
_hashPeticion.updated["t2-"+_nickname] > _hashPeticion.ultimaVisita["2"] &&
_tablon != "2") {
cambiaAspectoPestana('1', true);
}
if (typeof _hashPeticion.ultimaVisita["3"] != "undefined" &&
typeof _hashPeticion.updated["t3-"+_nickname] != "undefined" &&
_hashPeticion.updated["t3-"+_nickname] > _hashPeticion.ultimaVisita["3"] &&
_tablon != "3") {
cambiaAspectoPestana('5', true);
}
}
}
}
if ((typeof _hashPeticion.mensajes == "undefined" || _hashPeticion.mensajes.length <= 0) && _ultimaRecargaServidor == 0) {
if (typeof _tablon1 != "undefined" && _tablon1 != "") {
mostrarError(_ESKUPhashMsgByLang[LANGESKUP].no_hay_mensajes_disponibles);
}
}
if (typeof _tsHoraActual != "undefined") {
_ultimaRecargaServidor = _tsHoraActual;
}
else {
if (typeof _hashPeticion.horaActual != "undefined") {
_ultimaRecargaServidor = _hashPeticion.horaActual;
}
}
if (_es_primera_carga) {
_tsTablon1 = _ultimaRecargaServidor;
_tsTablon2 = _ultimaRecargaServidor;
_tsTablon3 = _ultimaRecargaServidor;
if (typeof _hilo != "undefined" && _hilo != "") {
_tsTablonOp = _ultimaRecargaServidor;
_tsTablonSeg = _ultimaRecargaServidor;
_tsTablonTodos = _ultimaRecargaServidor;
}
}
if (typeof _hashPeticion.mensajes != "undefined" && _hashPeticion.mensajes.length >= 0) {
if (typeof _hashMsgs.mensajes != "undefined") {
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[i]["idMsg"])) {
if (document.getElementById(_idContenedorRefr)) {
document.getElementById(_idContenedorRefr).style.display = 'block';
}
return(false);
}
if (document.getElementById("capa_confirmacion_"+_hashMsgs.mensajes[i]["idMsg"])) {
if (document.getElementById("capa_confirmacion_"+_hashMsgs.mensajes[i]["idMsg"]).className.indexOf(' visible') != -1) {
if (document.getElementById(_idContenedorRefr)) {
document.getElementById(_idContenedorRefr).style.display = 'block';
}
return(false);
}
}
}
}
_hashMsgs = _hashPeticion;
if (typeof _hashMsgs.mensajes[0] != "undefined") {
if (typeof _hashMsgs.orden == "undefined" || _hashMsgs.orden != 1) {
if (_hashMsgs.mensajes[0].tsMensaje > _ultimaRecargaServidor) {
_tsTablon1 = _hashMsgs.mensajes[0].tsMensaje;
_ultimaRecargaServidor = _tsTablon1;
}
if ( typeof _hilo != 'undefined' && _hilo != '' ) {
_tsTablon1 = _ultimaRecargaServidor;
_tsTablonOp = _ultimaRecargaServidor;
_tsTablonSeg = _ultimaRecargaServidor;
_tsTablonTodos = _ultimaRecargaServidor;
}
}
}
if (typeof _hashMsgs.perfilesEventos != 'undefined' &&
typeof _hashMsgs.perfilesEventos[_tablon] != 'undefined' &&
typeof _hashMsgs.perfilesEventos[_tablon]['tipo_evento'] != 'undefined' &&
_hashMsgs.perfilesEventos[_tablon]['tipo_evento'] == 200) {
procesarHashMensajesEntrevistaDigital();
}
muestraMensajes(_numPagActual);
}
}
else {
mostrarError(_ESKUPhashMsgByLang[LANGESKUP].no_es_posible_recuperar_los_mensajes);
}
if (_es_primera_carga == 1) {
_es_primera_carga = 0;
}
if ( typeof _hilo != 'undefined' && _hilo != '' ) {
comprobarHiloAbierto();
}
}, url + "&" + params);
}
function recuperarInformacionMensajesHiloPorNiveles(_Hilo,_idMsg,msgFin,numPagina) {
if(typeof msgFin == 'undefined'){
if(typeof numMensajesPlusHilo == 'undefined'){
var msgFin = numMensajesPlusHiloDef;
}else{
var msgFin = numMensajesPlusHilo;
}
}
if(typeof numPagina == 'undefined'){var numPagina = 1;}
_idMsg = typeof _idMsg !== 'undefined' ? _idMsg : _Hilo;
var url = _urlOuteskupSimple;
var params = "th=2&msg=" + _Hilo + "&fromMsg="+_idMsg+"&nummsg="+msgFin+"&p="+numPagina+"&rnd=" + Math.random();
if (_Hilo != "") {
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var _hashPeticion = Array();
try {
eval("_hashPeticion = " + data);
} catch(e) {
_hashPeticion = Array();
}
if (typeof _hashPeticion.mensajes != "undefined" &&_hashPeticion.mensajes.length > 0) {
if( typeof _hashMsgs != 'undefined' && _hashMsgs != null && typeof _hashMsgs.perfilesHilos != 'undefined'){
var control = true;
for( keyNew in _hashPeticion.perfilesHilos['_'+_Hilo].msgs_respuesta){
control = true;
for( key in _hashMsgs.perfilesHilos['_'+_Hilo].msgs_respuesta){
if(key == keyNew){control = false;}
}
if(control){
_hashMsgs.perfilesHilos['_'+_Hilo].msgs_respuesta[keyNew] = _hashPeticion.perfilesHilos['_'+_Hilo].msgs_respuesta[keyNew];
}
}
_hashPeticion.perfilesHilos['_'+_Hilo].msgs_respuesta = _hashMsgs.perfilesHilos['_'+_Hilo].msgs_respuesta;
}
_hashMsgs = _hashPeticion;
muestraMensajesHilosNiveles(_idMsg,numPagina,true);
}
}
if ( typeof _hilo != 'undefined' && _hilo != '' ) {
comprobarHiloAbierto();
}
}, url + "&" + params);
}
}
function recuperarInformacionMensajesHilo() {
var url = _urlOuteskup;
if ( (typeof _quiensoy != 'undefined') && (_quiensoy == 'widget' || _quiensoy == 'movil') ) {
url = _urlOuteskupSimple;
}
var params = "th=1&msg=" + _idHilo + "&rnd=" + Math.random();
if (_ultimaRecargaServidor > 0) {
params += "&ts=" + parseInt(_ultimaRecargaServidor);
}
if (_idHilo != "") {
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var _hashPeticion = Array();
try {
eval("_hashPeticion = " + data);
} catch(e) {
_hashPeticion = Array();
}
if (typeof _hashPeticion.horaActual != "undefined") {
_ultimaRecargaServidor = _hashPeticion.horaActual;
}
if (typeof _hashPeticion.mensajes != "undefined" &&_hashPeticion.mensajes.length > 0) {
if (typeof _hashMsgs.mensajes != "undefined") {
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[i]["idMsg"])) {
return(false);
}
}
}
_hashMsgs = _hashPeticion;
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
muestraMensajesHilo_movil();
} else {
muestraMensajesHilo();
}
}
}
}, url + "&" + params);
}
}
function recuperarInformacionMensajesInverso() {
var params = "rnd=" + Math.random() + "&th=2&msg=" + _hilo + "&p=" + _numPagCache + "&nummsg=" + _numMsgCache+"&tt=oc";
recuperarInformacionMensajesBase(params);
}
function recuperarInformacionMensajesValoracion() {
var params = "rnd=" + Math.random() + "&th=2&msg=" + _hilo + "&p=" + _numPagCache + "&nummsg=" + _numMsgCache+"&tt=mv";
recuperarInformacionMensajesBase(params);
}
function recuperarInformacionMensajesBase(params) {
var url = _urlOuteskup;
if ( (typeof _quiensoy != 'undefined') && (_quiensoy == 'widget' || _quiensoy == 'movil') ) {
url = _urlOuteskupSimple;
}
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
var _hashPeticion = Array();
try {
eval("_hashPeticion = " + data);
} catch(e) {
_hashPeticion = Array();
mostrarError(_ESKUPhashMsgByLang[LANGESKUP].no_es_posible_recuperar_los_mensajes);
}
if ((typeof _hashPeticion.mensajes == "undefined" || _hashPeticion.mensajes.length <= 0) && _ultimaRecargaServidor == 0) {
if (typeof _tablon1 != "undefined" && _tablon1 != "") {
mostrarError(_ESKUPhashMsgByLang[LANGESKUP].no_hay_mensajes_disponibles);
}
}
if (typeof _hashPeticion.mensajes != "undefined" && _hashPeticion.mensajes.length >= 0) {
_hashMsgs = _hashPeticion;
muestraMensajes(_numPagActual);
}
}
else {
mostrarError(_ESKUPhashMsgByLang[LANGESKUP].no_es_posible_recuperar_los_mensajes);
}
if (_es_primera_carga == 1) {
}
if ( typeof _hilo != 'undefined' && _hilo != '' ) {
comprobarHiloAbierto();
}
}, url + "&" + params);
}
function lanzaEventosRecarga() {
if (window.attachEvent) {
window.attachEvent('onfocus', recargaRapida);
window.attachEvent('onblur', recargaLenta);
} else if (window.addEventListener) {
window.addEventListener('focus', recargaRapida, false);
window.addEventListener('blur', recargaLenta, false);
} else if (document.addEventListener) {
document.addEventListener('focus', recargaRapida, false);
document.addEventListener('blur', recargaLenta, false);
}
}
function paraEventosRecarga() {
if (window.detachEvent) {
window.detachEvent('onfocus', recargaRapida);
window.detachEvent('onblur', recargaLenta);
} else if (window.removeEventListener) {
window.removeEventListener('focus', recargaRapida, false);
window.removeEventListener('blur', recargaLenta, false);
} else if (document.addEventListener) {
document.removeEventListener('focus', recargaRapida, false);
document.removeEventListener('blur', recargaLenta, false);
}
clearInterval(_intRecarga);
_intRecarga = undefined;
}
function f_lanza_eventos_carga_mensajes() {
lanzaEventosRecarga();
if (_ultimaRecargaProteccion == 0) {
recargaRapida();
}
recarga();
}
function recarga() {
var f = new Date();
if ((_ultimaRecargaProteccion+(_segsMinEntreRecargas*1000))>f.getTime()) {
return(false);
}
comprobarDispNuevosMensajes();
_ultimaRecargaProteccion = f.getTime();
}
function recargaRapida() {
recarga();
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recarga, _segsRecRapida * 1000);
}
function recargaLenta() {
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recarga, _segsRecLenta * 1000);
}
function recargaHilo() {
var f = new Date();
if ((_ultimaRecargaProteccion+(_segsMinEntreRecargas*1000))>f.getTime()) {
return(false);
}
recuperarInformacionMensajesHilo();
if (_tsHilo == 0) {
_tsHilo = _ultimaRecargaServidor;
}
_ultimaRecargaProteccion = f.getTime();
}
function recargaRapidaHilo() {
recargaHilo();
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recargaHilo, _segsRecRapida * 1000);
}
function recargaLentaHilo() {
if (typeof _intRecarga != "undefined") {
clearInterval(_intRecarga);
}
_intRecarga = setInterval(recargaHilo, _segsRecLenta * 1000);
}
function cambiaAspectoPestana(idPestana, hayNuevo) {
var idEnlacePestana = "enlace_pestana_" + idPestana;
if (document.getElementById(idEnlacePestana)) {
var divEnlacePestana = document.getElementById(idEnlacePestana);
if (hayNuevo) {
divEnlacePestana.className = "nuevosmensajes";
divEnlacePestana.title = _ESKUPhashMsgByLang[LANGESKUP].tienes_nuevos_mensajes;
} else {
divEnlacePestana.className = "";
divEnlacePestana.title = "";
}
}
}
function pintaHtmlNumComentarios() {
if (typeof _hashMsgs != "undefined" && typeof _hashMsgs.numMensajes != "undefined" &&
typeof _idNumMensajesHilo != "undefined" && document.getElementById(_idNumMensajesHilo) != "undefined") {
document.getElementById(_idNumMensajesHilo).style.display = "block";
document.getElementById(_idNumMensajesHilo).innerHTML = _hashMsgs.numMensajes + " comentarios";
}
}
function gestionarHtmlHilo(estado) {
pintaHtmlNumComentarios();
if (estado == "activo") {
if (typeof document.getElementById(_idContenedorEscribeMsg) != "undefined" &&
document.getElementById(_idContenedorEscribeMsg) != null) {
document.getElementById(_idContenedorEscribeMsg).style.display = "block";
}
if (typeof document.getElementById(_idContenedorHiloCerrado) != "undefined") {
document.getElementById(_idContenedorHiloCerrado).style.display = "none";
}
_comentariosActivos = true;
} else {
if (typeof document.getElementById(_idContenedorEscribeMsg) != "undefined" &&
document.getElementById(_idContenedorEscribeMsg) != null) {
document.getElementById(_idContenedorEscribeMsg).style.display = "none";
}
if (typeof document.getElementById(_idContenedorHiloCerrado) != "undefined") {
document.getElementById(_idContenedorHiloCerrado).style.display = "block";
}
_comentariosActivos = false;
}
}
function comprobarHiloAbierto() {
if (typeof _hashMsgs.perfilesHilos != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+_hilo] != "undefined" &&
(typeof _hashMsgs.perfilesHilos['_'+_hilo].estado == "undefined" ||
_hashMsgs.perfilesHilos['_'+_hilo].estado == 0) &&
(typeof _hashMsgs.perfilesHilos['_'+_hilo].caducidad == "undefined" ||
_hashMsgs.perfilesHilos['_'+_hilo].caducidad == "" ||
_hashMsgs.perfilesHilos['_'+_hilo].caducidad > _ultimaRecargaServidor)
) {
gestionarHtmlHilo("activo");
} else if (typeof _hashMsgs.perfilesHilos == "undefined") {
gestionarHtmlHilo("activo");
} else {
gestionarHtmlHilo("cerrado");
}
}
function esHiloPremoderado(idHilo) {
var hiloPremoderado = false;
if (typeof idHilo != "undefined" &&
typeof _hashMsgs != "undefined" &&
typeof _hashMsgs.perfilesHilos != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+idHilo] != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+idHilo].premoderacion != "undefined" &&
_hashMsgs.perfilesHilos['_'+idHilo].premoderacion == 1) {
hiloPremoderado = true;
}
return hiloPremoderado;
}
function esEventoPremoderado(idEvento) {
var eventoPremoderado = false;
if (typeof _hashMsgs != "undefined" &&
typeof _hashMsgs.perfilesEventos != "undefined" &&
typeof _hashMsgs.perfilesEventos[idEvento] != "undefined" &&
typeof _hashMsgs.perfilesEventos[idEvento].premoderacion != "undefined" &&
_hashMsgs.perfilesEventos[idEvento].premoderacion == 1) {
eventoPremoderado = true;
}
return eventoPremoderado;
}
function marcarMensajePendienteModeracion(idMensaje) {
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
_hashMsgs.mensajes[i].moderacion = 'pte';
}
}
}
function esMensajePendienteModeracion(idMensaje) {
for (var i = 0; i != _hashMsgs.mensajes.length; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
if (_hashMsgs.mensajes[i].moderacion == 'pte') {
return true;
} else {
return false;
}
}
}
return false;
}
function mostrarOcultarMasTemas(idMensaje, estilo) {
var capaTemas = document.getElementById("capatemas_"+idMensaje);
var iconoMasTemas = document.getElementById("botondesplegartemas_"+idMensaje);
if (capaTemas.style.display == "none") {
capaTemas.style.display = "block";
iconoMasTemas.innerHTML = '-';
iconoMasTemas.className = estilo + ' abierto';
} else {
capaTemas.style.display = "none";
iconoMasTemas.innerHTML = '+';
iconoMasTemas.className = estilo;
}
}
function mostrarTodosDestinatarios(idCajaDestinatarios) {
if (!document.getElementById(idCajaDestinatarios)) {
return false;
}
var caja_destinarios_ocultos = document.getElementById(idCajaDestinatarios);
for (var contChild = 0; contChild != caja_destinarios_ocultos.childNodes.length; contChild++) {
if (caja_destinarios_ocultos.childNodes[contChild].nodeName == 'P') {
caja_destinarios_ocultos.childNodes[contChild].style.display = 'block';
}
}
if (document.getElementById(idCajaDestinatarios + '_desplegar')) {
document.getElementById(idCajaDestinatarios + '_desplegar').style.display = 'none';
}
if (document.getElementById(idCajaDestinatarios + '_ocultar')) {
document.getElementById(idCajaDestinatarios + '_ocultar').style.display = '';
}
else {
caja_destinarios_ocultos.innerHTML += '
';
}
}
function ocultarDestinatarios(idUlDestinatarios) {
if (!document.getElementById(idUlDestinatarios)) {
return false;
}
var UlDestinatarios = document.getElementById(idUlDestinatarios);
var contLI = 0;
for (var contChild = 0; contChild != UlDestinatarios.childNodes.length; contChild++) {
if (UlDestinatarios.childNodes[contChild].nodeName == "P") {
if (_numUsuariosAMostrar != 0 && contLI >= _numUsuariosAMostrar) {
UlDestinatarios.childNodes[contChild].style.display = "none";
}
contLI++;
}
}
if (document.getElementById(idUlDestinatarios + "_ocultar")) {
document.getElementById(idUlDestinatarios + "_ocultar").style.display = 'none';
document.getElementById(idUlDestinatarios + "_desplegar").style.display = '';
}
}
function borrarMensaje(idMensaje, tablon) {
ocultarEnlaces(idMensaje, true);
if (confirm(_ESKUPhashMsgByLang[LANGESKUP].estas_seguro_de_borrar_el_mensaje)) {
borrarMensajeComun(idMensaje,tablon);
}
}
function borrarMensajeComun(idMensaje,tablon){
var params = "c=delete&x=" + encodeURIComponent(idMensaje);
if (typeof tablon != "undefined") {
params += "&t=" + tablon;
}
params += "&s=" + _s;
params += "&f=json";
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status == 200) {
var data = httpRequest.responseText;
eval("hashResultado = " + data);
if ( hashResultado.status != 'ok') {
alert(_ESKUPhashMsgByLang[LANGESKUP].error_al_borrar_el_mensaje);
}
else {
if (document.getElementById("mensaje_"+idMensaje)) {
if (document.getElementById("mensaje_"+idMensaje).parentNode.className == "menombran" ||
document.getElementById("mensaje_"+idMensaje).parentNode.className == "mio") {
document.getElementById(_idContenedorMsgs).removeChild(document.getElementById("mensaje_"+idMensaje).parentNode);
} else {
try{
document.getElementById(_idContenedorMsgs).removeChild(document.getElementById("mensaje_"+idMensaje));
}catch(e){
document.getElementById("mensaje_"+idMensaje).classList.add('oculto');
}
}
} else {
alert("Mensaje borrado correctamente");
}
}
} else {
alert(_ESKUPhashMsgByLang[LANGESKUP].error_al_borrar_el_mensaje);
}
}, _urlIneskup + "?" + params);
}
function crearFormularioMensaje(idMensaje) {
var divTplForm = document.getElementById(_idContenedorForm);
var htmlForm = divTplForm.innerHTML.replace(/#ID#/g, idMensaje);
htmlForm = htmlForm.replace(/#NUMERO_CARACTERES_MENSAJE#/g, _numero_maximo_caracteres_mensaje);
var divMsgForm = document.createElement('DIV');
divMsgForm.id = 'divform_' + idMensaje;
divMsgForm.innerHTML = htmlForm;
return divMsgForm;
}
function crearIframeTargetFormulario(idMensaje, accion, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
var divIFrameTarget = document.createElement('DIV');
divIFrameTarget.id = "diviframe_"+idMensaje;
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
divIFrameTarget.innerHTML = "";
} else {
if (!enHilo) {
if (accion == 'privadoperfil') {
divIFrameTarget.innerHTML = "";
}
else {
divIFrameTarget.innerHTML = "";
}
} else {
divIFrameTarget.innerHTML = "";
}
}
document.body.appendChild(divIFrameTarget);
}
function crearMensaje(idMensaje, destinoMensaje) {
if (typeof destinoMensaje == "undefined") {
destinoMensaje = '';
}
var divBotonResponder = document.getElementById("linkresponder_" + idMensaje);
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
divBotonResponder.innerHTML = _ESKUPhashMsgByLang[LANGESKUP].cancelar;
} else {
divBotonResponder.className = 'boton responder activo';
}
if (document.getElementById("tipos_" + idMensaje)) {
f_cerrar_panel("tipos_" + idMensaje);
}
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
if (divContenedorFormularioMensaje.childNodes.length != 0) {
if (document.getElementById("linkresponder_" + idMensaje).innerHTML == _ESKUPhashMsgByLang[LANGESKUP].cancelar) {
document.getElementById("linkresponder_" + idMensaje).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].responder;
divContenedorFormularioMensaje.innerHTML = "";
return;
}
}
else {
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
}
f_muestra_servicios_externos(idMensaje, false);
if (document.getElementById("id_recipientes_" + idMensaje)) {
var divDestinatarios = document.getElementById("id_recipientes_" + idMensaje);
var listaDestinatarios = null;
var numeroDestinarios = 0;
if (destinoMensaje != '') {
listaDestinatarios = destinoMensaje.split('|');
numeroDestinarios = listaDestinatarios.length;
var html = 'Para:
';
html = html + '';
html = html + '
';
var divEleccionDestinatarios = document.getElementById("id_recipientes_" + idMensaje);
divEleccionDestinatarios.innerHTML = html;
}
if (numeroDestinarios > 1) {
divDestinatarios.style.display = '';
}
else {
divDestinatarios.style.display = 'none';
}
}
document.getElementById("c_" + idMensaje).value = 'add';
document.getElementById("t_" + idMensaje).value = destinoMensaje;
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
if (typeof _texto_inicializacion_textarea_responder != "undefined" &&
document.getElementById(_texto_inicializacion_textarea_responder)) {
f_inicia_caja_escribir("m_" + idMensaje, _texto_inicializacion_textarea_responder, 'cajareposo', 'secundario');
}
var divBotonPublicar = document.getElementById("submitresponder_" + idMensaje);
divBotonPublicar.innerHTML = _ESKUPhashMsgByLang[LANGESKUP].responder;
crearIframeTargetFormulario(idMensaje, 'add');
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
divContenedorFormularioMensaje.style.display = '';
}
function preEditarMensaje(idMensaje, contenido) {
ocultarEnlaces(idMensaje, true);
var pteModeracion = esMensajePendienteModeracion(idMensaje);
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
var divAvisoModeracion = document.createElement('div');
divAvisoModeracion.className = 'editar_mensaje_moderado';
if (pteModeracion) {
divAvisoModeracion.innerHTML = ''+_ESKUPhashMsgByLang[LANGESKUP].no_editar+'
';
} else {
divAvisoModeracion.innerHTML = ''+_ESKUPhashMsgByLang[LANGESKUP].edicion_mensaje+'
';
}
var pBotonesModeracion = document.createElement('p');
pBotonesModeracion.className = 'botones_aceptar_moderacion';
if (!pteModeracion) {
var botonContinuar = document.createElement('a');
botonContinuar.href = 'javascript:void(0);';
botonContinuar.className = 'boton_aceptar_moderacion';
botonContinuar.innerHTML = _ESKUPhashMsgByLang[LANGESKUP].continuar;
botonContinuar.onclick = function() {
document.getElementById('contenedor_formulario_' + idMensaje).innerHTML = '';
editarMensaje(idMensaje, contenido);
}
pBotonesModeracion.appendChild(botonContinuar);
}
var botonCancelar = document.createElement('a');
botonCancelar.href = 'javascript:void(0);';
botonCancelar.className = 'boton_cancelar_moderacion';
botonCancelar.innerHTML = _ESKUPhashMsgByLang[LANGESKUP].cancelar;
botonCancelar.onclick = function() {
document.getElementById('contenedor_formulario_' + idMensaje).innerHTML = '';
document.getElementById('contenedor_formulario_' + idMensaje).style.display = 'none';
}
pBotonesModeracion.appendChild(botonCancelar);
divAvisoModeracion.appendChild(pBotonesModeracion);
divContenedorFormularioMensaje.innerHTML = '';
divContenedorFormularioMensaje.appendChild(divAvisoModeracion);
divContenedorFormularioMensaje.style.display = '';
}
function editarMensaje(idMensaje,contenido){
contenido = contenido.replace(/%3Cp%3E/g, '');
contenido = contenido.replace(/%3C%2Fp%3E/g, '\n');
editarMensajeComun(idMensaje,contenido,false);
}
function editarMensajeEnriquecido(idMensaje,contenido){
editarMensajeComun(idMensaje,contenido,true);
}
function editarMensajeComun(idMensaje, contenido, enriquecido) {
ocultarEnlaces(idMensaje, true);
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
if (divContenedorFormularioMensaje.childNodes.length == 0) {
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
}
if (document.getElementById("boton_adjuntar_"+idMensaje)) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
document.getElementById("boton_adjuntar_"+idMensaje).innerHTML = "Imagen";
}
else {
document.getElementById("boton_adjuntar_"+idMensaje).innerHTML = "Imagen";
}
}
if (document.getElementById("submitresponder_"+idMensaje)) {
document.getElementById("submitresponder_"+idMensaje).innerHTML = "Actualizar";
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
document.getElementById("linkresponder_"+idMensaje).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].cancelar;
}
document.getElementById("c_" + idMensaje).value = "edit";
document.getElementById("x_" + idMensaje).value = idMensaje;
if (document.getElementById("id_recipientes_" + idMensaje)) {
document.getElementById("id_recipientes_" + idMensaje).style.display = 'none';
}
contenido = ESKUPdecodeURIComponent(contenido);
if (typeof enriquecido != 'undefined' && enriquecido){
var hashDatosEmbed = obtenerInfoEmbed(contenido);
if (hashDatosEmbed.valido) {
contenido = contenido.replace(hashDatosEmbed.enlaceCompleto, hashDatosEmbed.urlEmbebido);
}
} else {
contenido = contenido.replace(//g, '');
contenido = contenido.replace(/<\/a>/g, '');
}
contenido = contenido.replace(/</g, '<');
contenido = contenido.replace(/>/g, '>');
contenido = contenido.replace(/'/g, '\'');
contenido = contenido.replace(/&/g, '&');
f_inicia_caja_escribir("m_" + idMensaje, contenido, 'cajaactiva', 'secundario activo','edicion');
f_tecleando('', 'm_' + idMensaje, 'etiqueta_numero_maximo_caracteres_' + idMensaje);
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
crearIframeTargetFormulario(idMensaje, 'edit');
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
f_mostrar_ocultar_panel_eventos_donde_publicar(idMensaje, false);
if (document.getElementById('boton_borrar_adjunto_' + idMensaje)) {
var tieneImagen = false;
for (var i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
if (_hashMsgs.mensajes[i].cont_adicional != '0') {
tieneImagen = true;
}
break;
}
}
if (tieneImagen) {
document.getElementById('boton_borrar_adjunto_' + idMensaje).style.display = '';
}
}
if (document.getElementById('rp_' + idMensaje)) {
document.getElementById('rp_' + idMensaje).value = 0;
}
f_muestra_servicios_externos(idMensaje, false);
f_mostrar_ocultar_panel_avisos_responder(idMensaje, false);
divContenedorFormularioMensaje.style.display = '';
}
function reenviarMensaje(idMensaje, usuarioOrigen, strCopiaEnTablones, contenido) {
ocultarEnlaces(idMensaje, true);
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
if (divContenedorFormularioMensaje.childNodes.length == 0) {
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
}
if (document.getElementById("boton_adjuntar_"+idMensaje)) {
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
document.getElementById("boton_adjuntar_"+idMensaje).innerHTML = "Imagen";
}
else {
document.getElementById("boton_adjuntar_"+idMensaje).innerHTML = "Imagen";
}
}
if (document.getElementById("submitresponder_"+idMensaje)) {
document.getElementById("submitresponder_"+idMensaje).innerHTML = "Reenviar";
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
document.getElementById("linkresponder_"+idMensaje).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].cancelar;
}
document.getElementById("c_" + idMensaje).value = "add";
document.getElementById("x_" + idMensaje).value = idMensaje;
if (document.getElementById("id_recipientes_" + idMensaje)) {
document.getElementById("id_recipientes_" + idMensaje).style.display = 'none';
}
contenido = ESKUPdecodeURIComponent(contenido);
contenido = contenido.replace(//g, '');
contenido = contenido.replace(/<\/a>/g, '');
contenido = contenido.replace(/</g, '<');
contenido = contenido.replace(/>/g, '>');
contenido = contenido.replace(/'/g, '\'');
contenido = contenido.replace(/&/g, '&');
contenido = "fwd @" + usuarioOrigen + ": " + contenido;
f_inicia_caja_escribir("m_" + idMensaje, contenido, 'cajaactiva', 'secundario activo','reenviar');
f_tecleando('', 'm_' + idMensaje, 'etiqueta_numero_maximo_caracteres_' + idMensaje)
if (document.getElementById("tm_" + idMensaje)) {
document.getElementById("tm_" + idMensaje).value = strCopiaEnTablones;
}
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
crearIframeTargetFormulario(idMensaje, 'add');
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
f_mostrar_ocultar_panel_eventos_donde_publicar(idMensaje, true);
if (document.getElementById('boton_borrar_adjunto_' + idMensaje)) {
document.getElementById('boton_borrar_adjunto_' + idMensaje).style.display = 'none';
}
if (document.getElementById('rp_' + idMensaje)) {
document.getElementById('rp_' + idMensaje).value = 0;
}
f_muestra_servicios_externos(idMensaje, true);
f_mostrar_ocultar_panel_avisos_responder(idMensaje, false);
divContenedorFormularioMensaje.style.display = '';
}
function responderMensajeHilo(idMensaje, idsHilo, strCopiaEnTablones) {
cerrarMensajesFlotantes();
var enHilo = true;
responderMensaje(idMensaje, idsHilo, strCopiaEnTablones, enHilo, 1);
}
function f_ocultar_formulario_mensaje(idMensaje) {
var divLinkSegundo = document.getElementById('linksegundo_' + idMensaje);
if (divLinkSegundo) {
divLinkSegundo.className = 'boton opciones';
}
var divTipos = document.getElementById("tipos_"+idMensaje);
if (divTipos) {
divTipos.style.display = 'none';
}
var divBotonResponder = document.getElementById('linkresponder_' + idMensaje);
if (divBotonResponder) {
divBotonResponder.className = 'boton responder';
}
var divBotonPrivado = document.getElementById('boton_privado_' + idMensaje);
if (divBotonPrivado) {
divBotonPrivado.className = 'boton privado';
}
var divContenedorFormularioMensaje = document.getElementById('contenedor_formulario_' + idMensaje);
if (divContenedorFormularioMensaje) {
if (divContenedorFormularioMensaje.childNodes.length != 0) {
divContenedorFormularioMensaje.innerHTML = '';
divContenedorFormularioMensaje.style.display = 'none';
}
}
var divBotonEditar = document.getElementById('boton_editar_' + idMensaje);
if (divBotonEditar) {
if (divBotonEditar.className.indexOf(' pulsado') != -1) {
divBotonEditar.className = divBotonEditar.className.substr(0, divBotonEditar.className.indexOf(' pulsado'));
}
}
cerrarMensajesFlotantes();
}
function responderMensaje(idMensaje, idsHilo, strCopiaEnTablones, enHilo) {
if (typeof enHilo == "undefined") {
enHilo = false;
}
if (document.getElementById("tipos_" + idMensaje)) {
f_cerrar_panel("tipos_" + idMensaje);
}
if (document.getElementById("linksegundo_"+idMensaje)) {
var divLinkSegundo = document.getElementById("linksegundo_"+idMensaje);
divLinkSegundo.className = 'boton opciones';
}
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
var boton_responder = document.getElementById("linkresponder_" + idMensaje)
if (divContenedorFormularioMensaje.childNodes.length == 0) {
var divMsgForm = crearFormularioMensaje(idMensaje);
divContenedorFormularioMensaje.appendChild(divMsgForm);
} else {
if (document.getElementById("linkresponder_" + idMensaje).innerHTML == _ESKUPhashMsgByLang[LANGESKUP].cancelar) {
document.getElementById("linkresponder_" + idMensaje).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].responder;
divContenedorFormularioMensaje.innerHTML = "";
return;
}
}
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
boton_responder.innerHTML = _ESKUPhashMsgByLang[LANGESKUP].cancelar;
} else {
boton_responder.className = 'boton responder activo';
}
if (document.getElementById("submitresponder_" + idMensaje)) {
var divBotonPublicar = document.getElementById("submitresponder_" + idMensaje);
divBotonPublicar.innerHTML = _ESKUPhashMsgByLang[LANGESKUP].enviar;
}
document.getElementById("c_" + idMensaje).value = 'reply';
document.getElementById("x_" + idMensaje).value = idsHilo;
document.getElementById("t_" + idMensaje).value = strCopiaEnTablones;
if (document.getElementById("tm_"+idMensaje)) {
document.getElementById("tm_"+idMensaje).value = strCopiaEnTablones;
}
if (typeof _texto_inicializacion_textarea_responder != "undefined") {
f_inicia_caja_escribir("m_" + idMensaje, _texto_inicializacion_textarea_responder, 'cajareposo', 'secundario');
}
var etiqueta = document.getElementById('etiqueta_numero_maximo_caracteres_' + idMensaje);
etiqueta.innerHTML = _numero_maximo_caracteres_mensaje;
if (document.getElementById("diviframe_"+idMensaje)) {
document.body.removeChild(document.getElementById("diviframe_"+idMensaje));
}
crearIframeTargetFormulario(idMensaje, 'reply', enHilo);
document.getElementById("form_" + idMensaje).target = "iframe_"+idMensaje;
f_mostrar_ocultar_panel_eventos_donde_publicar(idMensaje, true);
if (document.getElementById('boton_borrar_adjunto_' + idMensaje)) {
document.getElementById('boton_borrar_adjunto_' + idMensaje).style.display = 'none';
}
if (document.getElementById('rp_' + idMensaje)) {
document.getElementById('rp_' + idMensaje).value = 0;
}
f_muestra_servicios_externos(idMensaje, true);
if (strCopiaEnTablones != '') {
divContenedorFormularioMensaje.style.display = 'none';
f_obtener_eventos_para_escribir_en_respuesta(idMensaje, strCopiaEnTablones);
}
else {
f_mostrar_ocultar_panel_avisos_responder(idMensaje, false);
divContenedorFormularioMensaje.style.display = '';
}
}
function crearMensajeTemporal(idMensaje) {
var comando = '';
var idsHilo = '';
var destino = '';
var contenido = '';
if (typeof idMensaje == 'undefined') {
comando = document.getElementById("c").value;
idsHilo = document.getElementById("x").value;
destino = document.getElementById("t").value;
contenido = document.getElementById("m").value;
}
else {
comando = document.getElementById("c_" + idMensaje).value;
idsHilo = document.getElementById("x_" + idMensaje).value;
destino = document.getElementById("t_" + idMensaje).value;
contenido = document.getElementById("m_" + idMensaje).value;
}
contenido = contenido.replace(/\n/g, '');
contenido = contenido.replace(/\r/g, '');
var permitir_html_extra=0;
if (typeof _tablon != "undefined" && _tablon !='' && typeof _hashMsgs['perfilesEventos']!='undefined' && _hashMsgs['perfilesEventos']!='undefined' && typeof _hashMsgs['perfilesEventos'][_tablon]!="undefined" && _hashMsgs['perfilesEventos'][_tablon]!="undefined"){
permitir_html_extra = _hashMsgs['perfilesEventos'][_tablon]['permitir_html_extra'];
}
if (permitir_html_extra==0){
contenido = contenido.replace(//gi, "[b]");
contenido = contenido.replace(/<\/b>/gi, "[/b]");
contenido = contenido.replace(//gi, "[i]");
contenido = contenido.replace(/<\/i>/gi, "[/i]");
contenido = contenido.replace(//g, ">");
contenido = contenido.replace(/\'/g, "'");
contenido = contenido.replace(/&/g, "&");
contenido = contenido.replace(/\[b\]/gi, "");
contenido = contenido.replace(/\[\/b\]/gi, " ");
contenido = contenido.replace(/\[i\]/gi, "");
contenido = contenido.replace(/\[\/i\]/gi, " ");
}
var hashMensaje = Array();
var ahora = new Date();
var tsAhora = ahora.getTime() / 1000;
if (typeof _tsHoraActual != "undefined" && _tsHoraActual != 0) {
tsAhora = _tsHoraActual;
} else if (typeof _hashMsgs.horaActual != "undefined") {
tsAhora = _hashMsgs.horaActual;
}
hashMensaje["idMsg"] = tsAhora + "-temporal";
hashMensaje["tsMensaje"] = tsAhora;
hashMensaje["usuarioOrigen"] = _nickname;
hashMensaje["contenido"] = contenido;
return hashMensaje;
}
function cancelarMensaje(idMensaje) {
if (confirm(_ESKUPhashMsgByLang[LANGESKUP].estas_seguro_de_cancelar_el_mensaje)) {
var divIFrameTarget = document.getElementById("diviframe_"+idMensaje);
document.body.removeChild(divIFrameTarget);
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
var divMsgForm = document.getElementById("divform_"+idMensaje);
divContenedorFormularioMensaje.removeChild(divMsgForm);
}
}
function comprobarCargaIframeFormulario(idMensaje) {
var i = document.getElementById("iframe_"+idMensaje);
if (i.contentDocument) {
var d = i.contentDocument;
} else if (i.contentWindow) {
var d = i.contentWindow.document;
} else {
var d = window.frames["iframe_"+idMensaje].document;
}
if (d.location.href == "about:blank") {
return true;
}
if (!d.getElementById("status")) {
errorResponderMensajes(idMensaje, _ESKUPhashMsgByLang[LANGESKUP].ha_ocurrido_un_error);
return false;
}
if (d.getElementById("status").innerHTML != "OK") {
errorResponderMensajes(idMensaje, d.getElementById("info").innerHTML + " (Error "+d.getElementById("code").innerHTML+")");
return false;
}
return d;
}
function comprobarPost(idMensaje, comando) {
var htmlMensajeTemporal = '';
var hashMensajeTemporal = '';
var d = comprobarCargaIframeFormulario(idMensaje);
if (d == true || d == false) {
f_restablecer_boton_publicar("submitresponder_" + idMensaje);
return d;
}
if (comando == 'privadoperfil') {
htmlMensajeTemporal = htmlMensajeTemporal + '';
htmlMensajeTemporal = htmlMensajeTemporal + '
' + _ESKUPhashMsgByLang[LANGESKUP].mensaje_enviado_correctamente + '
';
var retorno_mensaje = d.getElementById("info").innerHTML;
if (retorno_mensaje != "") {
htmlMensajeTemporal = htmlMensajeTemporal + '
(' + aviso + ')
';
}
htmlMensajeTemporal = htmlMensajeTemporal + '
' + _ESKUPhashMsgByLang[LANGESKUP].cerrar + ' ';
htmlMensajeTemporal = htmlMensajeTemporal + '
';
htmlMensajeTemporal = htmlMensajeTemporal + '
';
var divContenedorFormularioMensaje = document.getElementById('contenedor_formulario_' + idMensaje);
divContenedorFormularioMensaje.innerHTML = htmlMensajeTemporal;
return true;
}
var _hayPremoderacion = false;
if ( (typeof _hilo != "undefined" && esHiloPremoderado(_hilo)) ||
(typeof _tablon != "undefined" && esEventoPremoderado(_tablon)) ) {
_hayPremoderacion = true;
}
avisoResponderMensajes(idMensaje, d.getElementById("info").innerHTML, _hayPremoderacion);
if (document.getElementById("linkresponder_" + idMensaje) && typeof mantenerBtnResponder == 'undefined') {
document.getElementById("linkresponder_" + idMensaje).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].responder;
}
if ((_tipoTablon == '1' || _tipoTablon == '2' ||_tipoTablon == '3' ||_tipoTablon == '4') ||
(_tipoTablon == '5' &&
typeof _hashDatosEvento != "undefined" &&
typeof _hashDatosEvento.estado_seguimiento != "undefined" &&
_hashDatosEvento.estado_seguimiento == 1) ||
( _tipoTablon == '5' && comando == "edit" )
) {
hashMensajeTemporal = crearMensajeTemporal(idMensaje);
htmlMensajeTemporal = pintaMensaje(hashMensajeTemporal, true);
if (typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') {
if (document.getElementById("procesando")) {
document.getElementById("procesando").className = "procesando";
document.getElementById("procesando").innerHTML = "" + _ESKUPhashMsgByLang[LANGESKUP].mensaje_disponible_en_unos_segundos + "
";
document.getElementById("procesando").style.display = "block";
setTimeout(function() {
document.getElementById("procesando").className = "recargar";
document.getElementById("procesando").innerHTML = "Recargar ahora
";
if (document.getElementById("boton_publicar")) {
var botonPublicar = document.getElementById("boton_publicar");
botonPublicar.style.visibility = "visible";
}
}, 5000);
}
}
}
if (comando == "edit") {
if (document.getElementById("mensaje_" + idMensaje)) {
var divTmpMensaje = document.createElement("DIV");
divTmpMensaje.innerHTML = htmlMensajeTemporal;
var divMensaje = document.getElementById("mensaje_" + idMensaje);
if (divMensaje.parentNode.className == "menombran" || divMensaje.parentNode.className == "mio") {
divMensaje = divMensaje.parentNode;
}
divMensaje.parentNode.insertBefore(divTmpMensaje, divMensaje);
divMensaje.parentNode.removeChild(divMensaje);
} else {
if (document.getElementById("divform_" + idMensaje) && document.getElementById("contenedor_formulario_" + idMensaje)) {
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
divContenedorFormularioMensaje.removeChild(document.getElementById("divform_" + idMensaje));
}
}
var htmlRecarga = '';
if (_hayPremoderacion && (typeof _soyOpinador == "undefined" || _soyOpinador == false)) {
marcarMensajePendienteModeracion(idMensaje);
htmlRecarga = _ESKUPhashMsgByLang[LANGESKUP].mensaje_pendiente_moderacion;
} else {
htmlRecarga = "" + _ESKUPhashMsgByLang[LANGESKUP].recargar_la_pagina + " ";
}
if ( document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]) ) {
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].estamos_procesando_tu_mensaje;
setTimeout ( function() {
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).innerHTML = htmlRecarga;
}, 5000);
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).style.display = '';
} else if (document.getElementById("avisoresponder_"+idMensaje)) {
setTimeout ( function() {
document.getElementById("avisoresponder_" + idMensaje).innerHTML = htmlRecarga;
}, 5000);
}
} else {
for (var contMsg = 0; contMsg != _hashMsgs.mensajes.length; contMsg++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg)) {
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + _hashMsgs.mensajes[contMsg].idMsg);
divContenedorFormularioMensaje.removeChild(document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg));
}
}
if(document.getElementById("divform_"+idMensaje)){
divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + idMensaje);
divContenedorFormularioMensaje.removeChild(document.getElementById("divform_"+idMensaje));
}
if (typeof _idContenedorMsgs != "undefined" && document.getElementById(_idContenedorMsgs) &&
(typeof _quiensoy == "undefined" || _quiensoy != "mensajeUnico")
) {
var divContenedor = document.getElementById(_idContenedorMsgs);
var divMensajeTemporal = document.createElement('div');
divMensajeTemporal.innerHTML = htmlMensajeTemporal;
divContenedor.insertBefore(divMensajeTemporal.firstChild, divContenedor.firstChild);
}
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico") &&
typeof _tipoHilo != "undefined" && _tipoHilo == "o" &&
typeof _soyOpinador != "undefined" && _soyOpinador == false) {
if ( document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]) ) {
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].no_perteneces_al_foro + " \"" + _ESKUPhashMsgByLang[LANGESKUP].todos_los_comentarios + "\" ";
}
}
}
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy == "mensajeUnico") && (comando == "reply" || comando == "add")) {
f_contabiliza_publicacion_comentario();
}
return true;
}
function comprobarPostHilo(idMensaje, comando) {
var d = comprobarCargaIframeFormulario(idMensaje);
if (d == true || d == false) {
f_restablecer_boton_publicar("submitresponder_" + idMensaje);
return d;
}
var _hayPremoderacion = false;
if (typeof _hilo != "undefined" && esHiloPremoderado(_hilo)) {
_hayPremoderacion = true;
}
if (d.getElementById("info").innerHTML != "") {
avisoResponderMensajes(idMensaje, d.getElementById("info").innerHTML, _hayPremoderacion);
}
document.getElementById("linkresponder_" + idMensaje).innerHTML = _ESKUPhashMsgByLang[LANGESKUP].responder;
var htmlMensajeTemporal = "";
var hashMensajeTemporal = crearMensajeTemporal(idMensaje);
htmlMensajeTemporal = pintaMensajeHilo(hashMensajeTemporal, true, false, true);
htmlMensajeTemporal += "
";
var divMensaje = document.getElementById("mensaje_" + idMensaje);
if (comando == "edit") {
var divTmpMensaje = document.createElement("DIV");
divTmpMensaje.innerHTML = htmlMensajeTemporal;
document.getElementById(_idContenedorHilo).insertBefore(divTmpMensaje, divMensaje);
document.getElementById(_idContenedorHilo).removeChild(divMensaje);
} else {
for (var contMsg = 0; contMsg != _hashMsgs.mensajes.length; contMsg++) {
if (document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg)) {
var divContenedorFormularioMensaje = document.getElementById("contenedor_formulario_" + _hashMsgs.mensajes[contMsg].idMsg);
divContenedorFormularioMensaje.removeChild(document.getElementById("divform_"+_hashMsgs.mensajes[contMsg].idMsg));
}
}
var divContenedor = document.getElementById(_idContenedorHilo);
var divMensaje = null;
for (var contElem = 0; contElem != divContenedor.childNodes.length; contElem++) {
divMensaje = divContenedor.childNodes[contElem];
if (divMensaje.id.search(idMensaje) != -1) {
break;
}
}
var fechaMsgTemporal = new Date();
var tsMensajeTemporal = Math.round(fechaMsgTemporal.getTime() / 1000);
var idMensajeTemporal = " id='" + divMensaje.id + "|" + tsMensajeTemporal + "-00000000000000000000000000000tmp' ";
var divTmp = divMensaje;
var nivel = 0;
var htmlInicioEnvoltorio = "";
var htmlFinEnvoltorio = "";
if (divTmp.firstChild.id != ("mensaje_"+idMensaje)) {
if (divTmp.className.search("entrada") == -1) {
nivel++;
}
htmlInicioEnvoltorio = "";
htmlFinEnvoltorio = "
";
while (divTmp.firstChild && divTmp.firstChild.id != ("mensaje_"+idMensaje)) {
divTmp = divTmp.firstChild;
if (divTmp.className.search("envoltorio") == -1) {
nivel++;
if (divTmp.className.search("ultimo") != -1) {
htmlInicioEnvoltorio += "";
} else {
htmlInicioEnvoltorio += "
";
}
htmlFinEnvoltorio += "
";
}
}
idMensajeTemporal = "";
}
var esUltimo = false;
for (var contMsg = 0; contMsg != _hashMsgs.mensajes.length; contMsg++) {
if (_hashMsgs.mensajes[contMsg].idMsg == idMensaje) {
if ((contMsg+1) == _hashMsgs.mensajes.length) {
esUltimo = true;
break;
} else if ((_hashMsgs.mensajes[contMsg].level+1) != _hashMsgs.mensajes[contMsg+1].level) {
esUltimo = true;
break;
}
}
}
nivel++;
if (esUltimo) {
if (divTmp == divContenedor.firstChild) {
htmlInicioEnvoltorio += "
";
htmlFinEnvoltorio += "
";
} else if (nivel == 1) {
htmlInicioEnvoltorio += "
";
htmlFinEnvoltorio += "
";
} else {
if (divTmp.className.search("envoltorio") != -1) {
divTmp = divTmp.parentNode;
}
htmlInicioEnvoltorio += "
";
htmlFinEnvoltorio += "
";
}
} else {
if (nivel == 1 && divTmp != divContenedor.firstChild) {
htmlInicioEnvoltorio += "
";
htmlFinEnvoltorio += "
";
idMensajeTemporal = "";
nivel++;
}
htmlInicioEnvoltorio += "
";
htmlFinEnvoltorio += "
";
}
var divMensajeTemporal = document.createElement("DIV");
divMensajeTemporal.innerHTML = htmlInicioEnvoltorio + htmlMensajeTemporal + htmlFinEnvoltorio;
divContenedor.insertBefore(divMensajeTemporal.firstChild, divMensaje.nextSibling);
if (!document.getElementById("linkrespuestas_"+idMensaje)) {
if (document.getElementById("enlacesconversacion_"+idMensaje)) {
document.getElementById("enlacesconversacion_"+idMensaje).innerHTML = "
Cerrar respuestas ";
}
}
if (document.getElementById("linkrespuestas_"+idMensaje) &&
document.getElementById("linkrespuestas_"+idMensaje).className == "primero1") {
mostrarRespuestas(idMensaje, (nivel-1));
}
}
setTimeout ( function() {
document.getElementById("explicacion_" + hashMensajeTemporal["idMsg"]).innerHTML = "
" + _ESKUPhashMsgByLang[LANGESKUP].recargar_la_pagina + " ";
}, 5000);
return true;
}
function submitFormularioMensaje(idMensaje) {
cerrarMensajesFlotantes();
var valor_campo = document.getElementById("m_"+idMensaje).value;
if (/^\s*$/.test(valor_campo)) {
errorResponderMensajes(idMensaje, _ESKUPhashMsgByLang[LANGESKUP].el_contenido_del_mensaje_no_puede_ser_vacio);
return false;
}
if (typeof _texto_inicializacion_textarea_responder != "undefined" &&
valor_campo == _texto_inicializacion_textarea_responder) {
errorResponderMensajes(idMensaje, _ESKUPhashMsgByLang[LANGESKUP].el_contenido_del_mensaje_no_puede_ser_vacio);
return false;
}
if ( document.getElementById('id_lista_usuarios_privado_' + idMensaje) ) {
var divUL = document.getElementById('id_lista_usuarios_privado_' + idMensaje);
var numeroUsuarios = divUL.childNodes.length;
if (numeroUsuarios == 0) {
alert('No hay seleccionado ningún usuario para enviar el privado.');
return false;
}
var hayErrores = false;
var lista_usuarios = '';
for (var i = 0; i < numeroUsuarios; i++) {
li_usuario = divUL.childNodes[i];
valor_id = li_usuario.id;
if (valor_id != '') {
lista_usuarios = lista_usuarios + valor_id + '|';
}
}
if (lista_usuarios == '') {
alert('No has seleccionado ningún usuario para enviar el privado');
return false;
}
var campo_usuarios = document.getElementById('t_' + idMensaje);
campo_usuarios.value = lista_usuarios;
document.getElementById('d_' + idMensaje).value = '';
}
else {
var lista_servicios_externos = f_obtener_lista_servicios_externos_seleccionado(idMensaje);
document.getElementById('d_' + idMensaje).value = lista_servicios_externos;
}
if ( document.getElementById('id_eventos_para_escribir_' + idMensaje) ) {
var panelEventos = document.getElementById('id_eventos_para_escribir_' + idMensaje);
var numero_li = panelEventos.childNodes.length;
var lista_eventos = '';
var numero_temas_seleccionados = 0;
for (var i = 0; i < numero_li; i++) {
campo = panelEventos.childNodes[i];
var estaSeleccionado = false;
id_evento = campo.id;
if (id_evento != '') {
estaSeleccionado = true;
}
if (estaSeleccionado) {
lista_eventos = lista_eventos + '*' + id_evento + '|';
_arrayEventosSeleccionadosParaEscribir[numero_temas_seleccionados] = id_evento;
numero_temas_seleccionados++;
}
}
document.getElementById("t_" + idMensaje).value = lista_eventos;
}
if (document.getElementById("capaopciones_adjuntar_"+idMensaje)) {
document.getElementById("capaopciones_adjuntar_"+idMensaje).style.display = "none";
}
var divContenedorEscribirMensaje = document.getElementById("escribirmensaje_" + idMensaje);
if (document.getElementById("errorresponder_"+idMensaje)) {
divContenedorEscribirMensaje.removeChild(document.getElementById("errorresponder_"+idMensaje));
}
if (document.getElementById("submitresponder_"+idMensaje)) {
document.getElementById("submitresponder_"+idMensaje).className = "trabajando";
}
var objFormulario = document.getElementById("form_"+idMensaje);
objFormulario.submit();
}
function mostrarOcultarElemento(idElemento) {
var divElemento = document.getElementById(idElemento);
if (divElemento.style.display != "none") {
divElemento.style.display = "none";
} else {
divElemento.style.display = "block";
}
}
function mostrarOcultarAdjuntarImagen(idMensaje) {
cerrarMensajesFlotantes();
if (document.getElementById('boton_adjuntar_' + idMensaje)) {
var boton_adjuntar = document.getElementById('boton_adjuntar_' + idMensaje);
if (boton_adjuntar.className == 'boton imagen') {
boton_adjuntar.className = 'boton imagen activo';
}
else {
boton_adjuntar.className = 'boton imagen';
}
}
if (document.getElementById('capaopciones_adjuntar_' + idMensaje)) {
mostrarOcultarElemento('capaopciones_adjuntar_' + idMensaje);
}
if (document.getElementById('capaopciones_destino_' + idMensaje)) {
var divCajaDestino = document.getElementById('capaopciones_destino_' + idMensaje);
divCajaDestino.style.display = 'none';
}
var boton_donde_publicar = document.getElementById('boton_donde_publicar_' + idMensaje);
if (boton_donde_publicar != null) {
boton_donde_publicar.className = 'boton temas';
}
var boton_destinatarios = document.getElementById('boton_destinatario_' + idMensaje);
if (boton_destinatarios != null) {
boton_destinatarios.className = 'boton destinatario';
}
}
function muestraOcultaImagen(imagenMostrar,imagenOcultar){
document.getElementById(imagenMostrar).style.display="";
document.getElementById(imagenOcultar).style.display="none";
}
function mostrarEnlaces(idMensaje) {
var divLinkSegundo = document.getElementById("linksegundo_"+idMensaje);
divLinkSegundo.className = 'boton opciones activo';
if ( document.getElementById("linkresponder_"+idMensaje) ) {
var divBotonResponder = document.getElementById("linkresponder_"+idMensaje);
if ((typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') ||
(typeof _dndWidget != "undefined")) {
} else {
divBotonResponder.className = 'boton responder';
}
divLinkSegundo.onclick = function () {
ocultarEnlaces(idMensaje, true);
}
}
var divTipos = document.getElementById("tipos_"+idMensaje);
divTipos.ocultando = false;
if ((typeof _formatoVisualizacion == "undefined" || _formatoVisualizacion != "movil") &&
typeof _dndWidget == "undefined") {
var posDivEnlaces = EPETUtils_calcAbsPositionV2(divLinkSegundo);
divTipos.style.left = parseInt(posDivEnlaces[0]) + "px";
divTipos.style.top = parseInt(posDivEnlaces[1] + divLinkSegundo.clientHeight) + "px";
}
if (typeof _dndWidget != "undefined") {
divTipos.style.clear = "both";
divTipos.style.position = "static";
divTipos.style.width = "176px";
}
divTipos.style.display = 'block';
}
function ocultarEnlaces(idMensaje, forzado) {
if (typeof forzado == "undefined") {
forzado = false;
}
var divTipos = document.getElementById("tipos_"+idMensaje);
if (divTipos) {
if (typeof divTipos.ocultando != "undefined" && divTipos.ocultando == false && !forzado) {
return;
}
}
var divLinkSegundo = document.getElementById("linksegundo_"+idMensaje);
if (divLinkSegundo) {
divLinkSegundo.className = 'boton opciones';
}
if ( document.getElementById("linkresponder_"+idMensaje) ) {
var divBotonResponder = document.getElementById("linkresponder_"+idMensaje);
if ((typeof _formatoVisualizacion != 'undefined' && _formatoVisualizacion == 'movil') ||
(typeof _dndWidget != "undefined")) {
} else {
divBotonResponder.className = 'boton responder';
}
if (divLinkSegundo) {
divLinkSegundo.onclick = function () {
mostrarEnlaces(idMensaje);
}
}
}
if (divTipos) {
divTipos.style.display = 'none';
divTipos.ocultando = false;
}
}
function mostrarCapaSeguirUsuario(idMensaje) {
var divBotonSeguir = document.getElementById("botonseguirusuario_"+idMensaje);
var divCapaSeguir = document.getElementById("capaseguirusuario_"+idMensaje);
divCapaSeguir.ocultando = false;
if ((typeof _formatoVisualizacion == "undefined" || _formatoVisualizacion != "movil") &&
typeof _dndWidget == "undefined") {
var posDivCapa = EPETUtils_calcAbsPositionV2(divBotonSeguir);
divCapaSeguir.style.left = parseInt(posDivCapa[0]) + "px";
divCapaSeguir.style.top = parseInt(posDivCapa[1]) + "px";
}
divCapaSeguir.className = 'capafavorito visible';
}
function ocultarCapaSeguirUsuario(idMensaje, forzado) {
if (typeof forzado == "undefined") {
forzado = false;
}
var divCapaSeguir = document.getElementById("capaseguirusuario_"+idMensaje);
if (typeof divCapaSeguir.ocultando != "undefined" && divCapaSeguir.ocultando == false && !forzado) {
return;
}
divCapaSeguir.className = 'capafavorito oculto';
divCapaSeguir.ocultando = false;
}
function errorResponderMensajes(idMensaje, error) {
var divEscribirMensaje = document.getElementById("escribirmensaje_"+idMensaje);
if (document.getElementById("errorresponder_"+idMensaje)) {
divEscribirMensaje.removeChild(document.getElementById("errorresponder_"+idMensaje));
}
var divError = document.createElement("DIV");
divError.id = "errorresponder_"+idMensaje;
if(typeof classErrorComunicaciones == 'undefined'){
divError.className = "comunicaciones";
} else {
divError.className = classErrorComunicaciones;
}
divError.innerHTML = "
" + error + "
";
divEscribirMensaje.appendChild(divError);
if (document.getElementById("trabajando_"+idMensaje)) {
divEscribirMensaje.removeChild(document.getElementById("trabajando_"+idMensaje));
}
}
function avisoResponderMensajes(idMensaje, aviso, hayPremoderacion) {
if(typeof callBackAvisoResponderMensajes != 'undefined'){
var params = {idMensaje:idMensaje,aviso:aviso,hayPremoderacion:hayPremoderacion};
if( typeof _soyOpinador != 'undefined'){params['_soyOpinador'] = _soyOpinador;}
callBackAvisoResponderMensajes(params);
}else{
if (!document.getElementById("comentario_"+idMensaje)) {
return false;
}
if (typeof hayPremoderacion == "undefined") {
hayPremoderacion = false;
}
var divContenedorTextoMensaje = document.getElementById("comentario_"+idMensaje);
if (document.getElementById("avisoresponder_"+idMensaje)) {
divContenedorTextoMensaje.removeChild(document.getElementById("avisoresponder_"+idMensaje));
}
var divAviso = document.createElement("DIV");
divAviso.id = "avisoresponder_"+idMensaje;
if(typeof classComunicaciones == 'undefined'){
divAviso.className = "comunicaciones";
}else{
divAviso.className = classComunicaciones;
}
if (aviso != "") {
aviso = " (" + aviso + ")";
}
var txtPremoderacion = "";
if (hayPremoderacion && !(typeof _soyOpinador != "undefined" && _soyOpinador == true)) {
txtPremoderacion = " (" + _ESKUPhashMsgByLang[LANGESKUP].pendiente_moderacion + ")";
}
divAviso.innerHTML = "
" + _ESKUPhashMsgByLang[LANGESKUP].mensaje_enviado_correctamente + aviso + txtPremoderacion + "
";
divContenedorTextoMensaje.appendChild(divAviso);
}
}
function cerrarMensajesFlotantes() {
if (typeof _quiensoy != "undefined" && (_quiensoy == "comentarios" || _quiensoy=="widget" || _quiensoy == "mensajeUnico")) {
return;
}
if (document.getElementById(_idContenedorHilo)) {
var divContenedorMensajes = document.getElementById(_idContenedorHilo);
for (var contElem = 0; contElem != divContenedorMensajes.childNodes.length; contElem++) {
if (divContenedorMensajes.childNodes[contElem].id) {
var idMsgFlotante = divContenedorMensajes.childNodes[contElem].id.substring(divContenedorMensajes.childNodes[contElem].id.length-(_longIdMensaje));
var idFlotante = "flotante_" + idMsgFlotante;
if (document.getElementById(idFlotante)) {
mostrarMensajeRespuesta(idMsgFlotante);
}
}
}
}
}
function mostrarMensajeRespuesta(idMensaje) {
if (typeof _hashMsgs.mensajes == "undefined") {
return false;
}
var divLinkRespondeA = document.getElementById("linkrespondea_"+idMensaje);
var divContenedorMensajes = document.getElementById(_idContenedorHilo);
for (var contElem = 0; contElem != divContenedorMensajes.childNodes.length; contElem++) {
var idMsgFlotante = divContenedorMensajes.childNodes[contElem].id.substring(divContenedorMensajes.childNodes[contElem].id.length-(_longIdMensaje));
var idFlotante = "flotante_" + idMsgFlotante;
if (document.getElementById(idFlotante)) {
document.body.removeChild(document.getElementById(idFlotante));
document.getElementById("linkrespondea_"+idMsgFlotante).title = _ESKUPhashMsgByLang[LANGESKUP].ver_mensaje_al_que_responde;
if (idMensaje == idMsgFlotante) {
return true;
}
}
}
var idMsgRespuesta = "";
var hashMensaje = null;
for (var i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
idMsgRespuesta = _hashMsgs.mensajes[i].idMsgRespuesta;
break;
}
}
if (idMsgRespuesta == "") {
return false;
}
for (var i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMsgRespuesta) {
hashMensaje = _hashMsgs.mensajes[i];
break;
}
}
if (hashMensaje == null) {
return false;
}
if (document.getElementById("flotante_"+idMensaje)) {
divLinkRespondeA.title = _ESKUPhashMsgByLang[LANGESKUP].ver_mensaje_al_que_responde;
document.body.removeChild(document.getElementById("flotante_"+idMensaje));
} else {
var esVisible = true;
var esFlotante = true;
var htmlMensajeFlotante = pintaMensajeHilo(hashMensaje, esVisible, esFlotante);
arrayPosEnlace = EPETUtils_calcAbsPositionV2(divLinkRespondeA);
var divFlotante = document.createElement("DIV");
divFlotante.id = "flotante_"+idMensaje;
divFlotante.className = "flotante";
divFlotante.innerHTML = htmlMensajeFlotante;
divFlotante.style.left = parseInt(arrayPosEnlace[0] - 10) + "px";
divFlotante.style.top = parseInt(arrayPosEnlace[1] + divLinkRespondeA.clientHeight + 2) + "px";
divLinkRespondeA.title = _ESKUPhashMsgByLang[LANGESKUP].cerrar;
document.body.appendChild(divFlotante);
}
}
function ocultarRespuestas(idMensaje, nivel) {
if (!document.getElementById("linkrespuestas_"+idMensaje)) {
return false;
}
var divLinkRespuestas = document.getElementById("linkrespuestas_"+idMensaje);
var divContenedorMensajes = document.getElementById(_idContenedorHilo);
var longitudId = (nivel+2)*(_longIdMensaje+1);
var i = 0;
for (i = 0; i != _hashMsgs.numMensajes; i++) {
if (_hashMsgs.mensajes[i].idMsg == idMensaje) {
break;
}
}
var numMensajesDebajo = 0;
for (var j = (i+1); j != _hashMsgs.numMensajes; j++) {
if (_hashMsgs.mensajes[j].level <= _hashMsgs.mensajes[i].level) {
break;
}
if (_hashMsgs.mensajes[j].level == (_hashMsgs.mensajes[i].level+1)) {
ocultarRespuestas(_hashMsgs.mensajes[j].idMsg, (nivel+1));
}
numMensajesDebajo++;
}
for (var contElem = 0; contElem != divContenedorMensajes.childNodes.length; contElem++) {
if (divContenedorMensajes.childNodes[contElem].id.search(idMensaje) != -1) {
if (divContenedorMensajes.childNodes[contElem].id.length == longitudId) {
divContenedorMensajes.childNodes[contElem].style.display = "none";
} else if (divContenedorMensajes.childNodes[contElem].id.search("tmp") != -1) {
divContenedorMensajes.childNodes[contElem].style.display = "none";
}
if (divContenedorMensajes.childNodes[contElem].id.search("tmp") != -1) {
numMensajesDebajo++;
}
}
}
cerrarMensajesFlotantes();
divLinkRespuestas.className = "abrir";
divLinkRespuestas.title = "Mostrar las respuestas a este mensaje";
divLinkRespuestas.innerHTML = numMensajesDebajo + " respuestas";
eval ("divLinkRespuestas.onclick = function() { mostrarRespuestas(\"" + idMensaje + "\", " + nivel + "); }");
}
function mostrarRespuestas(idMensaje, nivel) {
if (!document.getElementById("linkrespuestas_"+idMensaje)) {
return false;
}
var divLinkRespuestas = document.getElementById("linkrespuestas_"+idMensaje);
var divContenedorMensajes = document.getElementById(_idContenedorHilo);
var longitudId = (nivel+2)*(_longIdMensaje+1);
divLinkRespuestas.className = "cerrar";
divLinkRespuestas.title = "Ocultar las respuestas a este mensaje";
divLinkRespuestas.innerHTML = "Cerrar respuestas";
eval ("divLinkRespuestas.onclick = function() { ocultarRespuestas(\"" + idMensaje + "\", " + nivel + "); }");
for (var contElem = 0; contElem != divContenedorMensajes.childNodes.length; contElem++) {
if (divContenedorMensajes.childNodes[contElem].id.length == longitudId) {
if (divContenedorMensajes.childNodes[contElem].id.search(idMensaje) != -1 ||
divContenedorMensajes.childNodes[contElem].id.search("tmp") != -1) {
divContenedorMensajes.childNodes[contElem].style.display = "block";
}
}
}
cerrarMensajesFlotantes()
}
function ESKUPisIframe(){
return !(window.self === window.top);
}
function ESKUPisIframeMismoDominio(){
var dominio_padre = null;
try {
dominio_padre = parent.document.domain;
} catch(e) {}
return (dominio_padre==document.domain);
}
function EPEThasTelonID(){
var documento = ESKUPgetDocument();
if(!documento.styleSheets) return '';
if(typeof s== 'string') s= RegExp('\\b'+s+'\\b','i');
var A, S, DS= documento.styleSheets, n= DS.length, SA= [];
while(n){
S= DS[--n];
A= (S.rules)? S.rules: S.cssRules;
for(var i= 0, L= A.length; i
0 && alto_foto > 0)
{
setTimeout(function(){
ESKUPampliaFotoCallback(boton, url_foto, ancho_foto, alto_foto, pie_foto);
}, 100);
}
else
{
var oculto = parent.document.createElement('div');
oculto.style.width = '0px';
oculto.style.height = '0px';
oculto.style.overflow = 'hidden';
document.body.appendChild(oculto);
var oImg=parent.document.createElement("img");
oImg.onload = function() { ESKUPampliaFotoCallback(boton, url_foto, (this.naturalWidth != undefined ? this.naturalWidth : this.offsetWidth), (this.naturalHeight != undefined ? this.naturalHeight : this.offsetHeight), pie_foto); oculto.parentNode.removeChild(oculto) };
oImg.setAttribute('src', url_foto + "?" + Math.random());
oculto.appendChild(oImg);
}
}, 100);
}else{
parent.postMessage("{'command':'ampliaFotoEskup','params':['"+url_foto+"',"+ancho_foto+","+alto_foto+",'"+pie_foto+"']}", "*");
}
}
function ESKUPgetDocument(){
if (_documento==null){
if (ESKUPisIframe()&& ESKUPisIframeMismoDominio()){
_documento = parent.document;
}
else
_documento = document;
}
return _documento;
}
function ESKUPgetWindow(){
if (_ventana==null){
if (ESKUPisIframe())
_ventana= parent.window;
else
_ventana = window;
}
return _ventana;
}
function ESKUPteclaPulsada(key){
var ventana = ESKUPgetWindow();
var keycode;
if (ventana.event)
keycode = ventana.event.keyCode;
else
if (key)
keycode = key.which;
if (keycode == 27)
ESKUPcerrarTelonMultimediaEskup();
}
function ESKUPteclaTelonEvent(e){
if (e.keyCode == 27 ){
ESKUPcerrarTelonMultimediaEskup();
}
}
function ESKUPbloqueaClick(e){
var ventana = ESKUPgetWindow();
if (!e) var e = ventana.event;
e.cancelBubble = true;
if (e.stopPropagation) e.stopPropagation();
}
function ESKUPampliaFotoCallback(boton, url_foto, ancho_foto, alto_foto, pie_foto)
{
var documento = ESKUPgetDocument();
var ventana = ESKUPgetWindow();
var telon = documento.getElementById('id_telon');
var capaFlotante = documento.getElementById('id_contenedorCapaFlotante');
documento.getElementById('ampliar').className = 'boton_eskup_ampliar_foto ampliar_eskup_ampliar_foto';
documento.getElementById('ampliar').innerHTML= _ESKUPhashMsgByLang[LANGESKUP].tamano_real;
fotoTamanioReal = false;
var altoPie = 0 ;
if (telon != undefined && capaFlotante != undefined )
{
pie_foto = pie_foto.replace(new RegExp("\&", "gm"), "&");
pie_foto = pie_foto.replace(new RegExp("\<", "gm"), "<");
pie_foto = pie_foto.replace(new RegExp("\>", "gm"), ">");
documento.getElementById('pie_contenedor').onclick = ESKUPbloqueaClick;
documento.getElementById('pie_contenedor').innerHTML = pie_foto;
ESKUPalternacamposEskup('id_telon','block', 'id_contenedorCapaFlotante','block');
var dimsNavegador = ESKUPBrowserDimsEskup();
if (dispositivoMovil)
{
var altoBody = document.body.scrollHeight;
telon.style.position = 'absolute';
telon.style.height = altoBody + 'px';
telon.style.width = dimsNavegador.ancho + 'px';
capaFlotante.style.position = 'absolute';
}
else
{
capaFlotante.style.position = 'fixed';
telon.style.position = 'fixed';
}
altoPie = documento.getElementById('pie_contenedor').offsetHeight;
var YscrollVertical = ESKUPgetVScrollPositionEskup();
var altoBloqueCentral = parseInt(alto_foto) + parseInt(altoPie) + 70;
if (altoBloqueCentral <= dimsNavegador.alto)
{
documento.getElementById('ampliar').style.display = 'none';
if (dispositivoMovil)
{
capaFlotante.style.top = Math.round(YscrollVertical + (dimsNavegador.alto - altoBloqueCentral ) / 2 ) + 'px';
}
else{
var top = Math.round(dimsNavegador.alto / 2 - altoBloqueCentral / 2);
if (top<0) top=0;
capaFlotante.style.top=top+"px";
}
capaFlotante.style.left = '0px';
documento.getElementById('imagen_contenedor').style.height = alto_foto + 'px';
documento.getElementById('imagen_contenedor').style.width = ancho_foto + 'px';
documento.getElementById('flotante_foto').style.width = (parseInt(ancho_foto) + 20) + "px";
}
else
{
if (dispositivoMovil)
{
capaFlotante.style.top = YscrollVertical + 'px';
}
else
capaFlotante.style.top = '0px' ;
altoPie = 55;
var imgH = dimsNavegador.alto - parseInt(altoPie) - 60;
var imgW = Math.round(imgH * ancho_foto / alto_foto);
documento.getElementById('imagen_contenedor').style.height = imgH + "px";
documento.getElementById('imagen_contenedor').style.width = imgW + "px";
documento.getElementById('flotante_foto').style.width = (imgW + 20) + "px";
documento.getElementById('ampliar').style.display = 'block';
documento.getElementById('ampliar').onclick = function (e) {
ESKUPbloqueaClick(e);
if (!fotoTamanioReal)
{
documento.getElementById('ampliar').className = 'boton_eskup_ampliar_foto reducir_eskup_ampliar_foto';
documento.getElementById('ampliar').innerHTML= _ESKUPhashMsgByLang[LANGESKUP].tamano_ventana;
capaFlotante.style.position = 'absolute';
var YscrollVertical = ESKUPgetVScrollPositionEskup();
capaFlotante.style.top = YscrollVertical + 'px';
documento.getElementById('flotante_foto').style.width = (parseInt(ancho_foto) + 20) + "px";
documento.getElementById('imagen_contenedor').style.width = ancho_foto + 'px';
documento.getElementById('imagen_contenedor').style.height = alto_foto + 'px';
}
else
{
documento.getElementById('ampliar').className = 'boton_eskup_ampliar_foto ampliar_eskup_ampliar_foto';
documento.getElementById('ampliar').innerHTML= _ESKUPhashMsgByLang[LANGESKUP].tamano_real;
if (dispositivoMovil)
{
capaFlotante.style.position = 'absolute';
capaFlotante.style.top = YscrollVertical + 'px';
}
else
{
capaFlotante.style.position = 'fixed';
capaFlotante.style.top = '0px';
}
documento.getElementById('imagen_contenedor').style.height = (dimsNavegador.alto - parseInt(altoPie) - 60) + "px";
documento.getElementById('imagen_contenedor').style.width = imgW + "px";
documento.getElementById('flotante_foto').style.width = (imgW + 20) + "px";
}
fotoTamanioReal = !fotoTamanioReal;
};
}
documento.getElementById('imagen_contenedor').onclick = ESKUPbloqueaClick;
documento.getElementById('imagen_contenedor').src = url_foto;
if (ventana.addEventListener){
ventana.addEventListener('keydown', ESKUPteclaTelonEvent,true);
}else{
documento.onkeydown = ESKUPteclaPulsada;
}
}
}
function ESKUPcrearTelonMultimedia()
{
var documento = ESKUPgetDocument();
if (documento.getElementById("id_telon"))
documento.getElementById("id_telon").parentNode.removeChild(documento.getElementById("id_telon"));
if (documento.getElementById("id_contenedorCapaFlotante"))
documento.getElementById("id_contenedorCapaFlotante").parentNode.removeChild(documento.getElementById("id_contenedorCapaFlotante"));
var telon =documento.createElement('div');
var htmlCapaCentralESKUP = '
';
telon.id = 'id_telon';
telon.style.display = 'none';
telon.className = 'telon_eskup_ampliar_foto';
telon.onclick = function() { ESKUPcerrarTelonMultimediaEskup();};
documento.body.appendChild(telon);
var textoCerrar = _ESKUPhashMsgByLang[LANGESKUP].cerrar;
var textoTamanyoReal = _ESKUPhashMsgByLang[LANGESKUP].tamano_real;
var contenedor =documento.createElement('div');
contenedor.id = 'id_contenedorCapaFlotante';
contenedor.style.top = '0px';
contenedor.style.left = '0px';
contenedor.style.display = 'none';
contenedor.className = 'telon_eskup_ampliar_foto contenedor_capa_flotante_eskup_ampliar_foto';
contenedor.onclick = function() { ESKUPcerrarTelonMultimediaEskup();};
htmlCapaFlotanteEskup = '\n';
contenedor.innerHTML = htmlCapaFlotanteEskup;
documento.body.appendChild(contenedor);
}
function ESKUPgetVScrollPositionEskup()
{
var documento = ESKUPgetDocument();
var ventana = ESKUPgetWindow();
if (typeof(documento.documentElement.scrollTop) != "undefined" && documento.documentElement.scrollTop)
return documento.documentElement.scrollTop;
else
if (typeof(ventana.pageYOffset) != "undefined")
return ventana.pageYOffset;
else
return 0;
}
function ESKUPalternacamposEskup(id_campo1, estilo_campo1, id_campo2, estilo_campo2) {
var documento = ESKUPgetDocument();
documento.getElementById(id_campo1).style.display = estilo_campo1;
documento.getElementById(id_campo2).style.display = estilo_campo2;
}
function ESKUPcerrarTelonMultimediaEskup()
{
var documento = ESKUPgetDocument();
var ventana = ESKUPgetWindow();
if (documento.getElementById("id_telon").style.display != "none")
{
ESKUPalternacamposEskup('id_telon', 'none', 'id_contenedorCapaFlotante', 'none');
var nodoCentral = documento.getElementById("contenedor_central_telon");
if (nodoCentral)
nodoCentral.innerHTML = '
';
if (window.addEventListener)
ventana.removeEventListener('keydown', ESKUPteclaTelonEvent,true);
else
documento.onkeydown = null;
}
}
function ESKUPBrowserDimsEskup()
{
var documento = ESKUPgetDocument();
var ventana = ESKUPgetWindow();
var viewportwidth = 0;
var viewportheight = 0;
if (typeof ventana.innerWidth != 'undefined') {
viewportwidth = ventana.innerWidth,
viewportheight = ventana.innerHeight
}
else if (typeof documento.documentElement != 'undefined'
&& typeof documento.documentElement.clientWidth !=
'undefined' && documento.documentElement.clientWidth != 0) {
viewportwidth = documento.documentElement.clientWidth,
viewportheight = documento.documentElement.clientHeight
}
else {
viewportwidth = documento.getElementsByTagName('body')[0].clientWidth,
viewportheight = documento.getElementsByTagName('body')[0].clientHeight
}
return {"ancho" : viewportwidth , "alto" : viewportheight};
}
function mostrarComentarioRespuesta(idMensaje, idHilo, idMensajeRespuesta) {
if (typeof _hashMsgs.mensajes == "undefined") {
return false;
}
if (document.getElementById("flotante_" + idMensaje).innerHTML != '') {
document.getElementById("flotante_" + idMensaje).innerHTML = '';
document.getElementById("enlacemostrarrespuesta_" + idMensaje).title = _ESKUPhashMsgByLang[LANGESKUP].ver_mensaje_al_que_responde;
return;
}
var hashMensaje = null;
if (typeof _hashMsgs.perfilesHilos != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+idHilo] != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+idHilo].msgs_respuesta != "undefined" &&
typeof _hashMsgs.perfilesHilos['_'+idHilo].msgs_respuesta['_'+idMensajeRespuesta] != "undefined") {
hashMensaje = _hashMsgs.perfilesHilos['_'+idHilo].msgs_respuesta['_'+idMensajeRespuesta];
}
if (hashMensaje == null) {
return false;
}
var htmlMensajeRespuesta = pintaMensajeHilo(hashMensaje,false,true);
htmlMensajeRespuesta = htmlMensajeRespuesta.replace(/#MSG:ID_BTN_FATHER#/g, idMensaje);
document.getElementById("flotante_" + idMensaje).innerHTML = htmlMensajeRespuesta;
if (document.getElementById("enlacemostrarrespuesta_" + idMensaje)) {
document.getElementById("enlacemostrarrespuesta_" + idMensaje).title = _ESKUPhashMsgByLang[LANGESKUP].cerrar;
}
}
function posicionarEnDivMensajes() {
if (typeof _quiensoy != "undefined" && _quiensoy == 'widget') {
if (typeof _iframeAltoVariable != "undefined" && _iframeAltoVariable == '1') {
if (typeof _objIframeContenedor != "undefined" && _objIframeContenedor != null) {
window.parent.EPETUtils_posicionarScrollEnPagina(EPETUtils_calcAbsPositionV2(_objIframeContenedor)[1]);
} else if (parent.postMessage && typeof _identificadorWidget != "undefined") {
parent.postMessage("{'id':'" + _identificadorWidget + "','command':'setScrollToWidget','params':[]}", "*");
}
} else {
}
EPETUtils_posicionarScrollEnPagina(0);
if (typeof _dndWidget != "undefined" &&
typeof _posInicialContenedor != "undefined" &&
document.getElementById("contenedor_interior")) {
document.getElementById("contenedor_interior").style.top = _posInicialContenedor + "px";
}
} else if (typeof _hilo != "undefined" && _hilo != "") {
if (typeof _objIframeContenedor != "undefined" && _objIframeContenedor != null) {
var pos = EPETUtils_calcAbsPositionV2(_objIframeContenedor)[1];
if( _quiensoy == 'comentarios' && (typeof _nickname == 'undefined' || _nickname == '' )){
pos -= 100;
}
window.parent.EPETUtils_posicionarScrollEnPagina(pos);
} else if (parent.postMessage && typeof _identificadorWidget != "undefined") {
var params = '';
if( _quiensoy == 'comentarios' && (typeof _nickname == 'undefined' || _nickname == '' )){
params = '-100';
}
parent.postMessage("{'id':'" + _identificadorWidget + "','command':'setScrollToWidget','params':["+params+"]}", "*");
} else {
}
EPETUtils_posicionarScrollEnPagina(0);
} else {
posicionarEnDiv('id_contenedor_paginacion');
}
}
function posicionarEnDiv(id_contenedor) {
if ( document.getElementById(id_contenedor) ) {
var posYDivMensajes = parseInt(EPETUtils_calcAbsPosition(document.getElementById(id_contenedor))[1]);
EPETUtils_posicionarScrollEnPagina(posYDivMensajes);
}
}
function mostrarError(textoError) {
var divContenedorError = document.getElementById(_idContenedorErr);
divContenedorError.innerHTML = "" + textoError + "
";
if (textoError == '') {
divContenedorError.style.display = 'none';
}
else {
divContenedorError.style.display = '';
}
}
function notificarMensajeFueraDeTema(idMensaje, noalert, nickAutor) {
notificarBase(idMensaje, noalert, nickAutor,'offtopic',_mensaje_respuesta_notificacion_insulto);
}
function notificarMensajeInsulto(idMensaje, noalert, nickAutor,medioOrigen) {
notificarBase(idMensaje, noalert, nickAutor,'abuse',_mensaje_respuesta_notificacion_insulto,medioOrigen);
}
function notificarMensajeSpam(idMensaje, noalert, nickAutor,medioOrigen) {
notificarBase(idMensaje, noalert, nickAutor,'spam',_mensaje_respuesta_notificacion_spam,medioOrigen);
}
function notificarBase(idMensaje, noalert, nickAutor,reason,errorTxt,medioOrigen) {
var sAlert = true;
if(typeof noalert != 'undefined' && noalert == '1'){
sAlert = false;
}
ocultarEnlaces(idMensaje, true);
var cadena_params = "reason="+reason+"&msg=" + idMensaje;
if(typeof medioOrigen != 'undefined' && medioOrigen != ''){
cadena_params+="&medio="+ medioOrigen;
}else{
if (typeof _medioOrigen != 'undefined'){
cadena_params+="&medio="+_medioOrigen;
}
}
if(typeof nickAutor != 'undefined' && nickAutor != ''){
cadena_params = cadena_params + "&nickAutor=" + nickAutor;
}
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
if(sAlert){
alert(_ESKUPhashMsgByLang[LANGESKUP].no_se_ha_podido_hacer_la_notificacion);
}
}
else {
var data = httpRequest.responseText;
if(sAlert){alert(errorTxt);}
}
}, _urlNOTIFICACIONES + "?" + cadena_params);
}
function valorarMensaje(idMensaje, tipoValoracion, callback, nickAutor) {
var cadena_params = "reason=" + tipoValoracion + "&msg=" + idMensaje + "&f=json";
if (typeof _medioOrigen != 'undefined'){
cadena_params+="&medio="+_medioOrigen;
}
if(typeof nickAutor != 'undefined' && nickAutor != ''){
cadena_params = cadena_params + "&nickAutor=" + nickAutor;
}
EPETUtils_makeHttpRequestGet(function(httpRequest) {
if (httpRequest.status != 200) {
alert(_ESKUPhashMsgByLang[LANGESKUP].no_se_ha_podido_hacer_la_notificacion);
}
else {
var data = httpRequest.responseText;
var hashData = Array();
try {
eval("hashData = " + data);
} catch(e) {
hashData = Array();
}
callback(idMensaje, hashData);
}
}, _urlNOTIFICACIONES + "?" + cadena_params);
}
function ESKUPdecodeURIComponent(contenido){
try{contenido = decodeURIComponent(contenido);}
catch(error){}
return contenido;
}
ESKUP.aux = {
inArray:function (needle, haystack) {
var length = haystack.length;
for(var i = 0; i < length; i++) {
if(haystack[i] == needle) return true;
}
return false;
}
}
ESKUP.getLevel = function(idpadre){
var divfather = document.getElementById('conversacion_'+idpadre);
var level = 'hijo';
if(typeof divfather == 'undefined' ||divfather== null || typeof divfather.id == 'undefined' ){
level = 'primero';
}
return level;
}
ESKUP.switchEditarMensaje= function (idMensaje,contenido,_hayPremoderacion){
if (typeof _hayPremoderacion != 'undefined'
&& _hayPremoderacion == true
&& (typeof _soyOpinador == "undefined" || _soyOpinador == false)) {
preEditarMensaje(idMensaje,contenido);
}else{
editarMensaje(idMensaje,contenido);
}
}
ESKUP.classToggle = function(elementId,classToggle){
if(document.getElementById(elementId)){
document.getElementById(elementId).classList.toggle(classToggle);
}
}
if ("document" in self) {
if (!("classList" in document.createElement("_"))) {
(function (view) {
"use strict";
if (!('Element' in view)) return;
var
classListProp = "classList"
, protoProp = "prototype"
, elemCtrProto = view.Element[protoProp]
, objCtr = Object
, strTrim = String[protoProp].trim || function () {
return this.replace(/^\s+|\s+$/g, "");
}
, arrIndexOf = Array[protoProp].indexOf || function (item) {
var
i = 0
, len = this.length
;
for (; i < len; i++) {
if (i in this && this[i] === item) {
return i;
}
}
return -1;
}
, DOMEx = function (type, message) {
this.name = type;
this.code = DOMException[type];
this.message = message;
}
, checkTokenAndGetIndex = function (classList, token) {
if (token === "") {
throw new DOMEx(
"SYNTAX_ERR"
, "An invalid or illegal string was specified"
);
}
if (/\s/.test(token)) {
throw new DOMEx(
"INVALID_CHARACTER_ERR"
, "String contains an invalid character"
);
}
return arrIndexOf.call(classList, token);
}
, ClassList = function (elem) {
var
trimmedClasses = strTrim.call(elem.getAttribute("class") || "")
, classes = trimmedClasses ? trimmedClasses.split(/\s+/) : []
, i = 0
, len = classes.length
;
for (; i < len; i++) {
this.push(classes[i]);
}
this._updateClassName = function () {
elem.setAttribute("class", this.toString());
};
}
, classListProto = ClassList[protoProp] = []
, classListGetter = function () {
return new ClassList(this);
}
;
DOMEx[protoProp] = Error[protoProp];
classListProto.item = function (i) {
return this[i] || null;
};
classListProto.contains = function (token) {
token += "";
return checkTokenAndGetIndex(this, token) !== -1;
};
classListProto.add = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
;
do {
token = tokens[i] + "";
if (checkTokenAndGetIndex(this, token) === -1) {
this.push(token);
updated = true;
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.remove = function () {
var
tokens = arguments
, i = 0
, l = tokens.length
, token
, updated = false
, index
;
do {
token = tokens[i] + "";
index = checkTokenAndGetIndex(this, token);
while (index !== -1) {
this.splice(index, 1);
updated = true;
index = checkTokenAndGetIndex(this, token);
}
}
while (++i < l);
if (updated) {
this._updateClassName();
}
};
classListProto.toggle = function (token, force) {
token += "";
var
result = this.contains(token)
, method = result ?
force !== true && "remove"
:
force !== false && "add"
;
if (method) {
this[method](token);
}
if (force === true || force === false) {
return force;
} else {
return !result;
}
};
classListProto.toString = function () {
return this.join(" ");
};
if (objCtr.defineProperty) {
var classListPropDesc = {
get: classListGetter
, enumerable: true
, configurable: true
};
try {
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
} catch (ex) {
if (ex.number === -0x7FF5EC54) {
classListPropDesc.enumerable = false;
objCtr.defineProperty(elemCtrProto, classListProp, classListPropDesc);
}
}
} else if (objCtr[protoProp].__defineGetter__) {
elemCtrProto.__defineGetter__(classListProp, classListGetter);
}
}(self));
} else {
(function () {
"use strict";
var testElement = document.createElement("_");
testElement.classList.add("c1", "c2");
if (!testElement.classList.contains("c2")) {
var createMethod = function(method) {
var original = DOMTokenList.prototype[method];
DOMTokenList.prototype[method] = function(token) {
var i, len = arguments.length;
for (i = 0; i < len; i++) {
token = arguments[i];
original.call(this, token);
}
};
};
createMethod('add');
createMethod('remove');
}
testElement.classList.toggle("c3", false);
if (testElement.classList.contains("c3")) {
var _toggle = DOMTokenList.prototype.toggle;
DOMTokenList.prototype.toggle = function(token, force) {
if (1 in arguments && !this.contains(token) === !force) {
return force;
} else {
return _toggle.call(this, token);
}
};
}
testElement = null;
}());
}
}