// ==UserScript==
// @name Bilibili 旧播放页
// @namespace https://greasyfork.org/zh-CN/scripts/394296
// @version 2.2.3
// @description 切换旧版播放页面,布局、播放器全部切换回2019年12月09日之前的样子。
// @author Motoori Kashin
// @match *://*.bilibili.com/video/av*
// @match *://*.bilibili.com/watchlater/*
// @match *://*.bilibili.com/bangumi/play/ss*
// @match *://*.bilibili.com/bangumi/play/ep*
// @license MIT
// @run-at document-start
// @grant none
// @downloadURL none
// ==/UserScript==
(function() {
'use strict';
//window.stop();/*阻止原页面继续加载,但配合`@run-at document-start`在chrmoe中可能会导致无法替换失败*/
//document.open();document.write('
loading
');document.close();/*覆盖原网页延迟加载元素,已用同步请求解决,不够再打开*/
if(location.pathname.startsWith('/video')) {
const xhr = new XMLHttpRequest();
xhr.open('GET', window.location.href, false);
xhr.send(null);
if (xhr.status === 200) {
const OHTML = xhr.responseText;
if (OHTML.match(/biliconfig/) == null){wrVideo(OHTML);}
}
var reh = setInterval(function(){
var rehead = document.getElementsByClassName("bili-header-m");
rehead[0].setAttribute("style","display: none;");
if (rehead[1]){
rehead[0].removeAttribute("style");
rehead[1].remove();
document.getElementById("bofqi").removeAttribute("style");
clearInterval(reh);
}
}, 10);
}
if(location.pathname.startsWith('/watchlater')) {
const xhr = new XMLHttpRequest();
xhr.open('GET', window.location.href, false);
xhr.send(null);
if (xhr.status === 200) {
const OHTML = xhr.responseText;
wrWatchlater(OHTML);
}
}
if(location.pathname.startsWith('/bangumi')) {
const xhr = new XMLHttpRequest();
xhr.open('GET', window.location.href, false);
xhr.send(null);
if (xhr.status === 200) {
const OHTML = xhr.responseText;
wrBangumi(OHTML);
}
}
var cdm = setInterval(function(){
var dmlist = document.getElementsByClassName("bilibili-player-filter-btn")[1];
if (dmlist){
dmlist.click();
clearInterval(cdm);
}
}, 10);
function wrVideo(oht){
var html = oht;
var wrh = html.match(/' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'' +
'';
return wrb;
}
function wrWatchlater(oht){
var html = '';
document.open();
document.write(html);
document.close();
}
function wrBangumi(oht){
var html = oht;
//var bgms = html.match(/' +
'' +
'' +
'' +
'' +
'';
html = html.replace(/<\/head>/g,wrh);
var wrb = bgmBody();
html = html.replace(/xxx/g,wrb);
document.open();
document.write(html);
document.close();
}
function bgmBody(){
var wrb = '' +
'' +
'' +
'' +
'' +
'' +
'' +
'';
return wrb;
}
})();