Adds button to view largest thumbnail image for any video
目前為
// ==UserScript==
// @name Get YouTube Thumbnail
// @version 0.2
// @description Adds button to view largest thumbnail image for any video
// @author Drazen Bjelovuk
// @match *://www.youtube.com/*
// @grant none
// @run-at document-end
// @namespace https://greasyfork.org/users/11679
// @contributionURL https://goo.gl/dYIygm
// ==/UserScript==
document.addEventListener('spfdone', function(e) {
addThumbnailButton();
});
addThumbnailButton();
function addThumbnailButton() {
var button = document.getElementById('viewThumbnailBtn');
if (button)
return;
var container = document.getElementById('watch7-subscription-container');
if (container) {
button = document.createElement('button');
button.id = 'viewThumbnailBtn';
button.className = 'yt-uix-button yt-uix-button-default';
button.style.cssText = 'height:24px; color:#666; font-weight:initial; margin-left:10px';
button.textContent = 'View Thumbnail';
button.onclick = function() {
window.open(document.querySelector('link[itemprop="thumbnailUrl"]').href);
};
container.appendChild(button);
}
else if (window.location.href.indexOf('v=') > -1)
setTimeout(addThumbnailButton, 500);
}