// ==UserScript==
// @name shumin-Bilibili
// @namespace https://www.tampermonkey.net/
// @version 1.3
// @description 自用
// @author 庶民player
// @license MIT
// @match *.bilibili.com/*
// @icon https://static.hdslb.com/images/favicon.ico
// @require https://cdn.staticfile.org/jquery/3.3.1/jquery.min.js
// @grant none
// @run-at document-idle
// ==/UserScript==
function go_dn(elem_name){
for(
let cur_li = $(elem_name) , next_li = cur_li.next();
next_li.length > 0;
next_li = cur_li.next()
){
next_li.after(cur_li);
}
}
$(document).ready(function () {
//-=-=-=-=-=-=-=-=-=-=-=-=-t.bili-=-=-=-=-=-=-=-=-=-=-=-
if (window.location.href.indexOf("t.bilibili.com") >= 0 ){
if(window.location.href.indexOf("tab=video") < 0)
$(".bili-dyn-list-tabs__item:nth-child(2)").click();
//window.location.href = "https://t.bilibili.com/?tab=video";
$(".right").hide();
$(".left").hide();
$(".bili-backtop").css({
"right": "0px",
"bottom": "300px",
});
$(document.body).css({'overflow-x':'hidden'});
$(".left-entry").remove();
$(".offset-center-search").remove();
return;
}
//-=-=-=-=-=-=-=-=-=-=-=-=-自动关全屏-=-=-=-=-=-=-=-=-=-=-=-
if (window.location.href.indexOf("bilibili.com/video/") >= 0 ){
let cycle_id = setInterval(() => {
if(
$(".bpx-player-ending").is(":visible") ||
$(".bpx-player-electric-box").is(":visible") ||
false
) {
document.webkitCancelFullScreen();
document.exitFullscreen();
document.cancelFullScreen();
}
}, 1000);
}
//-=-=-=-=-=-=-=-=-=-=-=-=-下移-=-=-=-=-=-=-=-=-=-=-=-
window.onload = function(){
setTimeout(
() => {
go_dn('.video-card-ad-small');
go_dn('.video-page-game-card-small');
go_dn('#paybar_module');
go_dn('#danmukuBox');
if (window.location.href.indexOf("bilibili.com/video/") >= 0 )
window.history.replaceState( null, null, window.location.pathname);
},
5000
)
}
//-=-=-=-=-=-=-=-=-=-=-=-=-=-彩虹猫=-=-=-=-=-=-=-=-=-=-=-=-=
/* var css = [
".video-control-show .bui-thumb-dot-special{",
" -webkit-transform: scale(1) !important;",
" transform: scale(1) !important;",
" opacity: 1 !important;",
"}",
".bilibili-player-video-progress .bpui-slider-progress, .bilibili-player-area.video-control-show .bilibili-player-video-progress-slider .bui-bar-normal {",
" background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAMCAIAAAAs6UAAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUNCQzIyREQ0QjdEMTFFMzlEMDM4Qzc3MEY0NzdGMDgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUNCQzIyREU0QjdEMTFFMzlEMDM4Qzc3MEY0NzdGMDgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQ0JDMjJEQjRCN0QxMUUzOUQwMzhDNzcwRjQ3N0YwOCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQ0JDMjJEQzRCN0QxMUUzOUQwMzhDNzcwRjQ3N0YwOCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PovDFgYAAAAmSURBVHjaYvjPwMAAxjMZmBhA9H8INv4P4TPM/A+m04zBNECAAQBCWQv9SUQpVgAAAABJRU5ErkJggg==\") repeat-x !important;",
" background: linear-gradient(to bottom, #FF0000 0%, #FF0000 16.5%, #FF9900 16.5%, #FF9900 33%, #FFFF00 33%, #FFFF00 50%, #33FF00 50%, #33FF00 66%, #0099FF 66%, #0099FF 83.5%, #6633ff 83.5%, #6633ff 100%) !important;",
" background: -webkit-linear-gradient(top, #FF0000 0%, #FF0000 16.5%, #FF9900 16.5%, #FF9900 33%, #FFFF00 33%, #FFFF00 50%, #33FF00 50%, #33FF00 66%, #0099FF 66%, #0099FF 83.5%, #6633ff 83.5%, #6633ff 100%) !important;",
" background: -moz-linear-gradient(top, #FF0000 0%, #FF0000 16.5%, #FF9900 16.5%, #FF9900 33%, #FFFF00 33%, #FFFF00 50%, #33FF00 50%, #33FF00 66%, #0099FF 66%, #0099FF 83.5%, #6633ff 83.5%, #6633ff 100%) !important;",
" }",
" .bilibili-player-video-progress .bilibili-player-video-progress-buffer-range, .bilibili-player-area.video-control-show .bilibili-player-video-progress-slider .bui-bar-buffer {",
" background: url(\"data:image/gif;base64,R0lGODlhMAAMAIAAAAxBd////yH/C05FVFNDQVBFMi4wAwEAAAAh+QQECgAAACwAAAAAMAAMAAACJYSPqcvtD6MKstpLr24Z9A2GYvJ544mhXQmxoesElIyCcB3dRgEAIfkEBAoAAAAsAQACAC0ACgAAAiGEj6nLHG0enNQdWbPefOHYhSLydVhJoSYXPO04qrAmJwUAIfkEBAoAAAAsBQABACkACwAAAiGEj6nLwQ8jcC5ViW3evHt1GaE0flxpphn6BNTEqvI8dQUAIfkEBAoAAAAsAQABACoACwAAAiGEj6nLwQ+jcU5VidPNvPtvad0GfmSJeicUUECbxnK0RgUAIfkEBAoAAAAsAAAAACcADAAAAiCEj6mbwQ+ji5QGd6t+c/v2hZzYiVpXmuoKIikLm6hXAAAh+QQECgAAACwAAAAALQAMAAACI4SPqQvBD6NysloTXL480g4uX0iW1Wg21oem7ismLUy/LFwAACH5BAQKAAAALAkAAAAkAAwAAAIghI8Joe0Po0yBWTaz3g/z7UXhMX7kYmplmo0rC8cyUgAAIfkEBAoAAAAsBQAAACUACgAAAh2Ejwmh7Q+jbIFZNrPeEXPudU74IVa5kSiYqOtRAAAh+QQECgAAACwEAAAAIgAKAAACHISPELfpD6OcqTGKs4bWRp+B36YFi0mGaVmtWQEAIfkEBAoAAAAsAAAAACMACgAAAh2EjxC36Q+jnK8xirOW1kavgd+2BYtJhmnpiGtUAAAh+QQECgAAACwAAAAALgALAAACIYSPqcvtD+MKicqLn82c7e6BIhZQ5jem6oVKbfdqQLzKBQAh+QQECgAAACwCAAIALAAJAAACHQx+hsvtD2OStDplKc68r2CEm0eW5uSN6aqe1lgAADs=\") !important;",
" }",
" .bui-track-video-progress .bui-thumb .bui-thumb-dot-special div svg {",
" display: none;",
" }",
" .bilibili-player-video-progress .bpui-slider-handle {",
" margin-left: -17px !important;",
" margin-top: -4px !important;",
" }",
" .bui-track-video-progress .bui-thumb .bui-thumb-dot-special div {",
" margin-left: -8px !important;",
" margin-top: -4px !important;",
" }",
" .bilibili-player-video-progress .bpui-slider-handle, .bui-track-video-progress .bui-thumb .bui-thumb-dot-special div {",
" background: url(\"data:image/gif;base64,R0lGODlhIgAVAKIHAL3/9/+Zmf8zmf/MmZmZmf+Z/wAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/wtYTVAgRGF0YVhNUDw/eHBhY2tldCBiZWdpbj0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DQkAOw==\") !important;",
" width: 34px !important;",
" height: 21px !important;",
" border: none !important;",
" box-shadow: none !important;",
" transform: scale(0.8) !important;",
" -webkit-transform: scale(0.8) !important;",
" -moz-transform: scale(0.8) !important;",
" -ms-transform: scale(0.8) !important;",
" transition: transform .1s ease;",
" }",
" .bilibili-player .bilibili-player-area .bilibili-player-video-control .bui-slider .bui-track.bui-track-video-progress {",
" height: 8px;",
" }",
" .bilibili-player .bilibili-player-area .bilibili-player-video-control .bilibili-player-video-progress.bilibili-player-show .bui-track.bui-track-video-progress {",
" height: 8px",
" }"
].join("\n");
if (typeof GM_addStyle != "undefined") {
GM_addStyle(css);
} else if (typeof PRO_addStyle != "undefined") {
PRO_addStyle(css);
} else if (typeof addStyle != "undefined") {
addStyle(css);
} else {
var node = document.createElement("style");
node.type = "text/css";
node.appendChild(document.createTextNode(css));
var heads = document.getElementsByTagName("head");
if (heads.length > 0) {
heads[0].appendChild(node);
} else {
// no head yet, stick it whereever
document.documentElement.appendChild(node);
}
}
*/
//-=-=-=-=-=-=-=-=-=-=-=-=封面-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
if (window.location.href.indexOf("bilibili.com/video/") < 0 ) return;
const openInNew = true; //是否在新标签页中打开图片地址
const item = document.createElement('item');
item.id = 'SIR';
item.innerHTML = `
<button class="SIR-button">获取封面</button>
`;
document.body.append(item)
const style = document.createElement('style');
var ss = `
#SIR * {
box-sizing: border-box;
padding: 0;
margin: 0;
}
#SIR .SIR-button {
cursor: pointer;
display: inline-block;
height: 26px;
margin-right: 10px;
border: solid 1px ;
border-radius: 3px;
font-size: 13px;
padding:0 5px;
z-index: 5;
opacity: 0.5;
position:absolute;
`;/*
color: #FB7299;
background: #66CCFF;
*/
style.innerHTML = ss
+"top:"
+($('#arc_toolbar_report').offset().top + $('#arc_toolbar_report').height()*0.6)//17
+"px; left:"
+($('#arc_toolbar_report').offset().left + $('#arc_toolbar_report').width()*0.58)
+"px;}";
const button = item.querySelector('.SIR-button')
button.onclick = () => {
if(openInNew) {
window.open(getUrl());
} else {
self.location = getUrl();
}
}
document.head.append(style)
function getUrl() {
//获取网址
var source_url = window.location.href;
//获取源代码
let source = '';
var xhr = new XMLHttpRequest();
xhr.open('GET', window.location.href, false);
xhr.send();
source = xhr.responseText;
var video_BV = /https\:\/\/www\.bilibili\.com\/video\/BV(.*)/i;
var video_AV = /https\:\/\/www\.bilibili\.com\/video\/AV(.*)/i;
//类型对应的正则表达式
var rex = /a/;
//偏移量
var offset = 0;
if (video_AV.test(source_url)) {
//av视频
rex = /<meta data-vue-meta=\"true\" property=\"og:image\" content=\"(.*?)\.(jpe?g|png)\">/
offset = 56
} else if (video_BV.test(source_url)) {
//bv视频
rex = /<meta data-vue-meta=\"true\" property=\"og:image\" content=\"(.*?)\.(jpe?g|png)\">/
offset = 56
}
//获取封面地址
return source.match(rex)[0].slice(offset, -2).replace(/\\u002F/g, '\/')
}
});