better yt video support

This commit is contained in:
Hannes Mannerheim 2015-06-10 00:25:36 +02:00
parent dd14e3977e
commit fdb2c5b49f
2 changed files with 31 additions and 3 deletions

View File

@ -1663,6 +1663,9 @@ body.rtl .queet.rtl .expanded-content {
margin-top:10px;
position:relative;
}
.queet .queet-thumbs.hide-thumbs {
display:none;
}
.queet .attachment-thumb {
opacity:0;
@ -1686,6 +1689,25 @@ body.rtl .queet.rtl .expanded-content {
.queet .thumb-container.no-cover {
background-size:100% auto;
}
.queet .thumb-container[href*="://www.youtube.com"]:before {
display:block;
position:absolute;
width:100%;
height:100%;
z-index:1;
content: "\f01d";
font-family:FontAwesome;
line-height:250px;
text-align:center;
font-size:100px;
color:rgba(255,255,255,0.65);
}
.queet .thumb-container[href*="://www.youtube.com"] img {
z-index:2;
position:relative;
}
.queet .queet-thumbs .thumb-container.no-cover .attachment-thumb {
min-height:0;
}
@ -3736,7 +3758,7 @@ background:rgba(0,0,0,0.2);
right: 0;
top: 0;
z-index: 5000;
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.5);
background: none repeat scroll 0 0 rgba(0, 0, 0, 0.75);
}
.modal-draggable {
margin: 0;

View File

@ -1145,7 +1145,12 @@ function expand_queet(q,doScrolling) {
else if(attachment_title.indexOf('youtube.com/watch?v=') > -1 || attachment_title.indexOf('://youtu.be/') > -1) {
var youtubeId = attachment_title.replace('http://www.youtube.com/watch?v=','').replace('https://www.youtube.com/watch?v=','').replace('http://youtu.be/','').replace('https://youtu.be/','').substr(0,11);
if(q.children('.queet').find('.expanded-content').children('.media').children('iframe[src="//www.youtube.com/embed/' + youtubeId + '"]').length < 1) { // not if already showed
q.children('.queet').find('.expanded-content').prepend('<div class="media"><iframe width="420" height="315" src="//www.youtube.com/embed/' + youtubeId + '" frameborder="0" allowfullscreen></iframe></div>');
// hide video thumbnail if it's the only one
if(q.children('.queet').find('.queet-thumbs').children('.thumb-container').length < 2) {
q.children('.queet').find('.queet-thumbs').addClass('hide-thumbs');
}
// show video
q.children('.queet').find('.expanded-content').prepend('<div class="media"><iframe width="510" height="315" src="//www.youtube.com/embed/' + youtubeId + '" frameborder="0" allowfullscreen></iframe></div>');
}
}
else {
@ -1199,7 +1204,8 @@ function cleanUpAfterCollapseQueet(q) {
q.removeAttr('style');
q.children('.queet').removeAttr('style');
q.children('.queet').find('.queet-thumbs.thumb-num-1').removeAttr('style');
q.children('.queet').find('.queet-thumbs.thumb-num-1 .thumb-container').css('max-height','');
q.children('.queet').find('.queet-thumbs.thumb-num-1 .thumb-container').css('max-height','');
q.children('.queet').find('.queet-thumbs').removeClass('hide-thumbs');
}