您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
F**king Bilibili, give my av number back!
当前为
// ==UserScript== // @name Give me AV not BV // @namespace https://xsky123.com // @version 0.2b // @description F**king Bilibili, give my av number back! // @author XSky123 // @match https://www.bilibili.com/video/* // @match https://acg.tv/* // @match https://b23.tv/* // @run-at document-end // @grant none // ==/UserScript== (function() { 'use strict'; if(window.location.href.match(/.*bilibili.com\/video\/BV.*/)){ var p_match = window.location.href.match(/\?p\=(\d+)/); // Detect P, though a little ugly : P var url = "https://www.bilibili.com/video/av"+window.__INITIAL_STATE__.aid; if(p_match){ url += p_match[0]; } window.location.href=url; console.log("[AVnoBV] F**k You BV Number!"); } var is_finished_ajax = false; var is_av_number_written = false; var _current_url = ""; var MutationObserver = window.MutationObserver; var PageBodyElement = document.querySelector("body"); var DocumentObserverConfig = { attributes: true, childList: true, characterData: true, subtree: true }; var ObserverDetectAndAddAVNumber = function(mutationsList) { //console.log("changed"); if(document.getElementsByClassName("view")){ //console.log(document.getElementsByClassName("view").innerHTML); if(document.getElementsByClassName("view")[0].innerHTML.match(/\d+/)){ document.getElementsByClassName("video-data")[1].innerHTML += " <span class=\"a-crumbs\"><a href=\""+window.location.href+"\">av"+window.__INITIAL_STATE__.aid+"</a></span>"; console.log("[AVnoBV] Add av number successfully!"); RanderFinishObserver.disconnect(); } } }; var RanderFinishObserver = new MutationObserver(ObserverDetectAndAddAVNumber); RanderFinishObserver.observe(PageBodyElement, DocumentObserverConfig); })();