Greasy Fork

Greasy Fork is available in English.

安静看B站bilibili

我可以用APP但你不能强制我用APP打开

当前为 2021-04-25 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         安静看B站bilibili
// @namespace    http://tampermonkey.net/
// @version      0.11
// @description  我可以用APP但你不能强制我用APP打开
// @author       soundEgg
// @match        https://m.bilibili.com/video/*
// @match        https://m.bilibili.com/space/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var root = window.location.href;
    if(root.indexOf('/video/')>-1){
        // Your code here...
        // 我可以用APP但你不能强制我APP打开
        //清除APP打开
        var arr=document.querySelectorAll('.open-app');arr.forEach(function (item) {
            if(item){
                item.remove();
            }
        });
        //清除class属性
        var arr2=document.querySelectorAll('.open-app-btn.v-card-toapp');
        arr2.forEach(function (item) {
            if(item){
                item.setAttribute("class", "v-card-toapp")
            }
        });
        //清除原有点击,重新插入
        var t = document.querySelector('.video-list').getInnerHTML();
        var obj = document.getElementsByClassName("video-list")[0];
        document.getElementsByClassName("card-box")[0].remove()
        obj.insertAdjacentHTML("afterBegin",t);
        //增加点击事件*转换
        var arr3=document.querySelectorAll('.v-card-toapp');
        arr3.forEach(function (item) {
            if(item){
                var aid=item.dataset.aid;
                item.addEventListener('click', function(){
                    window.location.href="https://m.bilibili.com/video/av"+aid;
                })
            }
        });
        //移除APP打开高清又流畅标题
        document.getElementsByClassName("open-app-btn m-video-main-openapp visible-open-app-btn")[0].remove()
    }
    else if(root.indexOf('/space/')>-1){

        document.getElementsByClassName("open-app-btn m-space-float-openapp")[0].remove()

            }

})();