您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
在哔哩哔哩番剧页面中显示封面
当前为
// ==UserScript== // @name Bilibili Bangumi Cover // @name:zh-CN 哔哩哔哩番剧封面 // @namespace hoothin // @version 0.5 // @description Show Bilibili Bangumi Cover // @description:zh-CN 在哔哩哔哩番剧页面中显示封面 // @grant GM_xmlhttpRequest // @author hoothin // @include http*://bangumi.bilibili.com/anime/* // ==/UserScript== (function() { 'use strict'; var vSmall=document.querySelector(".recom"); if(!vSmall)return; var title=document.createElement("h3"); title.id="coverTitle"; title.classList.add("v1-bangumi-head-h3"); title.style.display="block"; title.innerHTML="封面"; var coverLink=document.createElement("a"); var cover=document.createElement("img"); cover.style.width="270px"; coverLink.target="_blank"; coverLink.appendChild(cover); var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; var observer = new MutationObserver(function(records){ if(!vSmall.querySelector("h3#coverTitle")){ vSmall.insertBefore(coverLink,vSmall.firstChild); vSmall.insertBefore(title,vSmall.firstChild); refreshCover(); } }); var option = { 'childList': true }; observer.observe(vSmall, option); function refreshCover(){ GM_xmlhttpRequest({ method: 'GET', url: bangumiIndex.href, onload: function(result) { var doc = null; try { doc = document.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = result.responseText; } catch (e) { console.log(e); } if (!doc) { return; } var img=doc.querySelector("a.v1-complete-text[href='"+location.href.replace(/https?:/,"")+"']>div>img"); if(img){ coverLink.href=cover.src=img.getAttribute("src").replace(/\d+_\d+|_\d+x\d+\.jpg/,""); } } }); } var bangumiIndex=document.querySelector(".v1-bangumi-info-title>a"); if(bangumiIndex){ refreshCover(); } })();