BiliPlus 优化版

哔哩哔哩错误视频自动跳转

目前為 2022-11-08 提交的版本,檢視 最新版本

// ==UserScript==
// @name         BiliPlus 优化版
// @namespace    https://www.biliplus.com
// @version      1.13.22
// @description  哔哩哔哩错误视频自动跳转
// @author       蓝云
// @icon         https://www.biliplus.com/favicon.ico
// @license      MIT
// @include      http*://*.bilibili.com/*

// @require      https://code.jquery.com/jquery-latest.js

// @run_at       document_idle
// ==/UserScript==
//视频跳转
$(window).load(function () {
    let body = $('body');

    if ($('.error-container').length > 0)
        location.replace(location.href.replace(/\:\/\/www\.bilibili\.com\/video/, '://www.biliplus.com/video'));
    if ($('.video-list-status-text').length > 0)
        location.replace(location.href.replace(/\:\/\/bangumi\.bilibili\.com\/anime/, '://www.biliplus.com/bangumi/i'));
    if ($('.player-limit-wrap').length > 0)
        location.replace(location.href.replace(/\:\/\/www\.bilibili\.com/, '://www.biliplus.com'));


    //收藏夹跳转
    body.mouseover(function () {
        $('.small-item.disabled').each(function () {
            $(this).removeClass('disabled');
            $(this).find('a').attr('href', 'https://www.biliplus.com/video/' + $(this).attr('data-aid'));
        });

    });



    //主菜单修改
    addCss(`
    #home_popularize {
      height: 48px;
      display: flex;
      align-items: center;
      margin-right: 0;
      margin-left: 14px;
    }
    @media screen and (min-width: 1400px) {
      #home_popularize {
        margin-left: 32px;
      }
    }`, 'Popularize');


    if (orginPopularize.length > 0) {




    }

    //顶部修改
    addCss(`
    .bili-wrapper {
      margin: 16px auto;
    }
    .nav-item.live .i-frame,
    .nav-item {
      display: none !important;
      pointer-events: none !important;
    }
    .nav-item.home,
    .nav-item.hbili,
    .nav-item.mbili,
    .nav-item.live,
    .nav-con.fr .nav-item {
      display: list-item !important;
      pointer-events: all !important;
    }
    .nav-con.fr .nav-item[report-id="playpage_VIP"] {
      display: none !important;
      pointer-events: none !important;
    }`, 'Top');

    /*视频页面*/
    addCss(`
    .app-download,
    #playpage_mobileshow,
    #arc_toolbar_report .tb-line,
    #live_recommand_report{
      display: none !important;
      pointer-events: none !important;
    }`,'Video');

    /**
     * 添加style到head
     * @param css css内容
     * @param name style标识
     */
    function addCss(css, name) {
        let style = body.find("style[data-meta='" + name + "']:first");
        if (style.length === 0) {
        }
        style.text(style.text() + css);
        style.attr("data-meta", name);
        body.append(style);
    }
});