Add image resolution to title url
This commit is contained in:
parent
96ad2a323a
commit
568caa4434
12
ytcg.js
12
ytcg.js
@ -1,7 +1,13 @@
|
|||||||
function getCover()
|
function getCover()
|
||||||
{
|
{
|
||||||
var videoUrl = document.getElementById('videoUrl').value;
|
var videoUrl = document.getElementById('videoUrl').value;
|
||||||
var coverUrl = 'https://img.youtube.com/vi/' + YouTubeGetID(videoUrl) + '/maxresdefault.jpg';
|
var videoCover = new Image();
|
||||||
document.getElementById('ytImage').innerHTML =
|
|
||||||
'<a download href="' + coverUrl + '"><img src="'+ coverUrl +'"></a>';
|
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';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user