update app code
This commit is contained in:
parent
4743da6fae
commit
bde6b9ee05
13
docs/ytcg.js
13
docs/ytcg.js
@ -1,13 +0,0 @@
|
|||||||
function getCover()
|
|
||||||
{
|
|
||||||
var videoUrl = document.getElementById('videoUrl').value;
|
|
||||||
var videoCover = new Image();
|
|
||||||
|
|
||||||
videoCover.onload = function()
|
|
||||||
{
|
|
||||||
document.getElementById('ytImage').innerHTML =
|
|
||||||
'<a title="' + videoCover.width + 'x' + videoCover.height + '" href="' + videoCover.src + '" download="cover"><img src="'+ videoCover.src +'"></a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
videoCover.src = 'https://img.youtube.com/vi/' + YouTubeGetID(videoUrl) + '/maxresdefault.jpg';
|
|
||||||
}
|
|
21
src/ytcg.js
Normal file
21
src/ytcg.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
function getCover()
|
||||||
|
{
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
let videoUrl = document.getElementById('videoUrl').value;
|
||||||
|
let imageDiv = document.getElementById('ytImage');
|
||||||
|
imageDiv.innerHTML = '';
|
||||||
|
|
||||||
|
let videoCover = document.createElement('img');
|
||||||
|
let imageLink = document.createElement('a');
|
||||||
|
|
||||||
|
videoCover.src = 'https://img.youtube.com/vi/' + YouTubeGetID(videoUrl) + '/maxresdefault.jpg';
|
||||||
|
imageLink.href = videoCover.src;
|
||||||
|
imageLink.download = 'cover';
|
||||||
|
videoCover.onload = function() {
|
||||||
|
imageLink.title = videoCover.width + 'x' + videoCover.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
imageLink.appendChild(videoCover);
|
||||||
|
imageDiv.appendChild(imageLink);
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user