Add image resolution to title url

This commit is contained in:
Alexander Popov 2017-10-29 01:06:47 +03:00
parent 96ad2a323a
commit 568caa4434
1 changed files with 9 additions and 3 deletions

12
ytcg.js
View File

@ -1,7 +1,13 @@
function getCover()
{
var videoUrl = document.getElementById('videoUrl').value;
var coverUrl = 'https://img.youtube.com/vi/' + YouTubeGetID(videoUrl) + '/maxresdefault.jpg';
document.getElementById('ytImage').innerHTML =
'<a download href="' + coverUrl + '"><img src="'+ coverUrl +'"></a>';
var videoCover = new Image();
videoCover.onload = function()
{
document.getElementById('ytImage').innerHTML =
'<a title="' + videoCover.width + 'x' + videoCover.height + '" download href="' + videoCover.src + '"><img src="'+ videoCover.src +'"></a>';
}
videoCover.src = 'https://img.youtube.com/vi/' + YouTubeGetID(videoUrl) + '/maxresdefault.jpg';
}