Greasy Fork

Greasy Fork is available in English.

LinkCheatGuradian_BiliBili

try to take over the world!

当前为 2021-07-31 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         LinkCheatGuradian_BiliBili
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  try to take over the world!
// @author       wlx0079
// @match        *://www.bilibili.com/video/*
// @icon         https://i0.hdslb.com/bfs/album/5b628d8d94bbf2f80f8006f1f6865a3f977e51d2.jpg
// @grant        GM_xmlhttpRequest
// ==/UserScript==

//Update: 0801-01:42 只采集/video,采用hashmap缓存策略减少访问量,时间间隔调大,访问太多要验证码的==

var hashmap = new Map()

function getTitle(text){
    var myReg = new RegExp("<title.*title>");
    var nt = text.match(myReg)[0];
    var title = nt.split("<")[1];
    title = title.split(">")[1];
    title = title.split("_哔哩哔哩_bilibili")[0]
    return title;
}



function httpGet(theUrl,theSpan)
{
    GM_xmlhttpRequest({
        url: theUrl,
        method :"GET",
        onload:function(xhr){
            var name = getTitle(xhr.responseText)
            if(!hashmap.has(theSpan.innerHTML)){
               var newContent = theSpan.innerHTML + '<p style="font-family:verdana; color:rgb(70,60,220); font-weight:800; font-size:12pt">#诈骗检测:'+name+"</p>"
               hashmap.set(theSpan.innerHTML,newContent)
               hashmap.set(newContent,"$")
               theSpan.innerHTML = newContent
        }
        }
    });
}


function Alter(){
    console.log("bg")
    var links = document.getElementsByTagName("a")
    for (var i = 0 ; i < links.length ; ++i){
        var url = links[i].href;
        if (url.search("b23.tv") != -1 ){
            if(hashmap.has(links[i].innerHTML)){
                var content = hashmap.get(links[i].innerHTML);
                if (content != "$"){
                    links[i].innerHTML = content;
                }
            }
            else
            {
                httpGet(url,links[i])
            }
        }
    }
}




function Main() {
    'use strict'
    Alter();
}
setInterval(Main,2500)