// ==UserScript==
// @name B站视频封面查看
// @namespace limgmk/bilibili-cover
// @version 0.0.1
// @description 在播放窗口下方添加查看封面的按钮
// @author Limgmk
// @include http*://www.bilibili.com/video/av*
// @include http*://www.bilibili.com/video/BV*
// @run-at document-end
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
var cover = document.evaluate('//meta[@itemprop="image" and @data-vue-meta="true"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue
var coverURL = cover.getAttribute("content");
addNode();
function addNode(){
var share = document.evaluate('//span[@title="分享"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
var ops = document.evaluate('//div[@class="ops"]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
if(share.innerText != "--" && ops){
var showCover = document.createElement("span");
showCover.innerHTML = '🔎 封面';
share.setAttribute("style", "width: 92px;");
ops.insertBefore(showCover, null);
}else{
setTimeout(addNode,100);
}
}
})();