// ==UserScript== // @name 哔哩哔哩去除 6 分钟限制及 APP 下载 // @namespace http://tampermonkey.net/ // @version 0.5.4 // @description 去除手机版 6 分钟限制,添加网页跳转 // @author sl00p // @match https://m.bilibili.com/video/* // @grant none // @run-at document-end // @downloadURL none // ==/UserScript== (function() { 'use strict'; var herfs = document.location.href.split("/"); var bvid = herfs[herfs.length - 1]; var relate = "https://api.bilibili.com/x/web-interface/archive/related?bvid=" + bvid; var zone = "https://api.bilibili.com/x/web-interface/archive/related?aid=370010949&context="; console.log("start parse...."); (function() { if(window.localStorage && window.localStorage.getItem("window.bsource") != "wechat") { window.localStorage.setItem("window.bsource", "wechat"); } if(document.cookie.indexOf("wechat") == -1) { document.cookie = "bsource=wechat"; } })(); console.log("window.bsource ==> ", window.localStorage.getItem("window.bsource")); function HttpGet(url,success){ var xmlhttp = null; if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); } xmlhttp.open("GET",url,true); xmlhttp.timeout = 4000; xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { if (xmlhttp.status == 504 ) { console.log("服务器请求超时.."); xmlhttp.abort(); }else if(xmlhttp.status == 200){ success(xmlhttp.responseText); } xmlhttp = null; } } xmlhttp.ontimeout = function () { console.log("客户端请求超时.."); } xmlhttp.send(); } HttpGet(relate, function(res) { var data = JSON.parse(res).data; var tidMap = {}; for(var i = 0; i < data.length; ++i) { if(tidMap.hasOwnProperty(data[i].tid)) { tidMap[data[i].tid] += 1; } else { tidMap[data[i].tid] = 1; } } var nodesInterval = setInterval(function() { var nodes = document.getElementsByClassName("v-card-toapp"); if (nodes !== undefined) { for(var i = 0; i < nodes.length; ++i) { // console.log("parse node " + i + " ..."); nodes[i].getElementsByClassName('title')[0].innerHTML="
"; // clearInterval(nodesInterval); }; } }, 1000); var appInterval = setInterval(function() { var nodeList = ["m-video-openapp", "openapp", "m-video2-openapp", "m-video2-float-openapp", "m-related-openapp report-scroll-module"]; var appList = ["v-card-toapp"]; for(var i = 0; i < appList.length; ++i) { var app = document.getElementsByClassName(appList[i]); if (app !== undefined) { app.onclick = function() { return false }; for(var k = 0; k < nodeList.length; ++k) { if(document.getElementsByClassName(nodeList[k]).length > 0) { document.getElementsByClassName(nodeList[k])[0].remove(); } } // clearInterval(appInterval); } } }, 1000); var relInterval = setInterval(function() { var relate_video = document.getElementsByClassName("player-ending-panel-title"); var app = document.getElementsByClassName("player-ending-panel-button"); if(relate_video !== undefined && relate_video.length > 0) { for(var i = 0; i < data.length; ++i) { if(relate_video[0].textContent === data[i].title) { console.log(relate_video[0].textContent, data[i].title); relate_video[0].innerHTML=""; if(app !== undefined && app.length > 0) { app[0].innerText = data[i].owner.name; } } } } }, 500); }); })();