Skip to content

Commit

Permalink
[DEMAD] Correcciones
Browse files Browse the repository at this point in the history
correcciones conectados
  • Loading branch information
ajmorenoh committed Apr 22, 2020
1 parent 605c6d8 commit efc0ca1
Showing 1 changed file with 37 additions and 26 deletions.
63 changes: 37 additions & 26 deletions app/views/welcome/encuentrosconexpertos.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,45 @@
part : 'player,snippet',
id : videoId,
key: key_x},
function(data) {
function(data) {
$('#player').html("<div class=\"video-responsive\">"+data.items[0].player.embedHtml.replace("width=\"480\"", "").replace("height=\"270\"", "")+"</div>");
if (data.items[0].snippet.liveBroadcastContent != 'none' ) {
$('#comments').html("<iframe src=https://www.youtube.com/live_chat?v="+videoId+"&embed_domain="+embed_domain+" width='100%' height='600'></iframe>");

if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)) {
$('#comments').html("El chat no es accesible a través de una plataforma móvil");
} else {
$.get(
"https://www.googleapis.com/youtube/v3/commentThreads",{
part : 'snippet',
order: 'time',
videoId : videoId,
maxResults: 6,
key: key_x},
function(data) {
var contenido = '';
if (data.items.length > 0) {
$.each( data.items, function( i, cont ) {
var item = cont.snippet.topLevelComment.snippet
var datecre = new Date(Date.parse(item.updatedAt));
var fecha = datecre.getDay() + "/" + datecre.getMonth() + "/" + datecre.getFullYear();
contenido = contenido + "<p><b>" + item.authorDisplayName + "</b> - <span class='desc_video'>" + fecha + "</span></p><p>" + item.textDisplay + "</p>"

});
}else {
contenido = "No hay comentarios disponibles";
if (data.items[0].snippet.liveBroadcastContent != 'none' ) {
$('#comments').html("<iframe frameBorder='0' src=https://www.youtube.com/live_chat?v="+videoId+"&embed_domain="+embed_domain+" width='100%' height='600'></iframe>");
} else {
$.get(
"https://www.googleapis.com/youtube/v3/commentThreads",{
part : 'snippet',
order: 'time',
videoId : videoId,
maxResults: 6,
key: key_x},
function(data) {
var contenido = '';
if (data.items.length > 0) {
$.each( data.items, function( i, cont ) {
var item = cont.snippet.topLevelComment.snippet
var datecre = new Date(Date.parse(item.updatedAt));
var fecha = datecre.getDay() + "/" + datecre.getMonth() + "/" + datecre.getFullYear();
contenido = contenido + "<p><b>" + item.authorDisplayName + "</b> - <span class='desc_video'>" + fecha + "</span></p><p>" + item.textDisplay + "</p>"

});
}else {
contenido = "No hay comentarios disponibles";
}
$('#comments').html(contenido);
}
$('#comments').html(contenido);
}
);
);
}
}
}
);
Expand All @@ -52,7 +63,7 @@
var item = cont.snippet
var datecre = new Date(Date.parse(item.publishedAt));
var fecha = datecre.getDay() + "/" + datecre.getMonth() + "/" + datecre.getFullYear();
contenido = contenido + "<div class='small-6 medium-2 column'>"
contenido = contenido + "<div class='small-6 medium-2 column' style='float:left'>"
contenido = contenido + "<div class='row background_uniq_video'>"
contenido = contenido + "<div class='small-12 column'>"
contenido = contenido + "<a href='https://www.youtube.com/watch?v="+ item.resourceId.videoId + "' target='_blank'><img width='100%' src='" +item.thumbnails.high.url +"'></a>"
Expand Down

0 comments on commit efc0ca1

Please sign in to comment.