// ==UserScript== // @name Bilibili 旧播放页 // @namespace https://greasyfork.org/zh-CN/scripts/394296 // @version 2.3.6 // @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'; const OR_HTML = document.getElementsByTagName("head")[0].innerHTML; const path = document.location.href.split('/')[3]; /*function xhrHM(){ // 同步链接获取网页数据 const xhr = new XMLHttpRequest(); xhr.open('GET', window.location.href, false); xhr.send(null); if (xhr.status === 200) { return xhr.responseText; } } function adscr(src){ // 添加同步script let script = document.createElement("script"); script.setAttribute("type","text/javascript"); script.setAttribute("src",src); document.body.appendChild(script); } function anscr(src){ // 添加异步script let script = document.createElement("script"); script.setAttribute("src",src); script.setAttribute("crossorigin",""); script.setAttribute("defer","defer"); document.body.appendChild(script); } function repEle(ele,dcm){ // 替换页面元素 let rp = document.getElementsByTagName(ele)[0]; let rpw = document.createElement(ele); rpw.innerHTML = dcm; rp.replaceWith(rpw); } function onPlay(){ // 动态添加av页播放器初始化代码 let bofqi = document.getElementById("bofqi"); let str = ''; var range = document.createRange() range.setStart(bofqi, 0) bofqi.appendChild( range.createContextualFragment(str) ) }*/ function wrAV(){ // 处理av页 let html = '
'; document.open(); document.write(html); document.close(); } function wrWL(){ // 处理稍后再看 let html = ''; document.open(); document.write(html); document.close(); } function wrBGM(){ // 处理BGM页 let html = ''; document.open(); document.write(html); document.close(); } function setDM(){ // 选择弹幕列表 let cDM = setInterval(function(){ let DMList = document.getElementsByClassName("bilibili-player-filter-btn")[1]; if (DMList){ DMList.click(); clearInterval(cDM); } }, 10); } function reAV(){ // av页入口 if (OR_HTML.match(/biliconfig/) == null){ // 排除自动重定向的av页 new wrAV(); new setDM(); let reh = setInterval(function(){ // av页后续处理 let reHead = document.getElementsByClassName("bili-header-m"); if (reHead[1]){ reHead[1].remove(); // 移除旧版av页已失效版头 document.getElementById("bofqi").removeAttribute("style"); // 取消播放器隐藏 document.getElementById("entryNew").setAttribute("style","visibility: hidden;"); // 隐藏新版入口 clearInterval(reh); } }, 10); } } function reWL(){ // 稍后再看入口 new wrWL(); new setDM(); } function reBGM(){ // BGM页入口 if (OR_HTML.match(/出错/) == null){ // 排除无效BGM页 new wrBGM(); new setDM(); let reh = setInterval(function(){ // BGM页后续处理 let entryNew = document.getElementsByClassName("new-entry")[0]; if (entryNew){ entryNew.setAttribute("style","visibility: hidden;"); clearInterval(reh); } }, 10); } } /* 分离页面 */ if (path == 'video'){new reAV();} if (path == 'watchlater'){new reWL();} if (path == 'bangumi'){new reBGM();} })();