// ==UserScript== // @name 哔哩哔哩 // @namespace http://tampermonkey.net/ // @version 0.2 // @description 去除手机版 6 分钟限制,添加网页跳转 // @author sl00p // @match https://m.bilibili.com/video/* // @grant none // @run-at document-start // @downloadURL none // ==/UserScript== (function() { 'use strict'; var data; var host = "https://comment.bilibili.com/recommendnew,"; var aid = /\d+/g.exec(document.location.href)[0]; console.log("start parse...."); function FackWechat() { 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("cookie ==> ", document.cookie); } 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(); } FackWechat(); HttpGet(host + aid, function(res) { data = JSON.parse(res).data; }); setTimeout(function() { var nodes = document.getElementsByClassName("index__title__src-videoPage-relativeVideo-videoItem-"); for(var i = 0; i < nodes.length; ++i) { console.log("parse node " + i + " ..."); nodes[i].innerHTML="
"; }; }, 1000); setTimeout(function() { document.getElementsByClassName("index__openAppBtn__src-commonComponent-topArea-")[0].remove() document.getElementsByClassName("index__openAppBtn__src-videoPage-openAppBtn-")[0].remove(); var app = document.getElementsByClassName("index__openApp__src-videoPage-relativeVideo-videoItem-"); for(var i = 0; i < app.length; ++i) { app[i].innerText = data[i].owner.name; } }, 1000); })();