BiliBili播放页调整(自用)

1.自动选择最高画质;2.播放器自动宽屏模式(仅可在宽屏、网页全屏、全屏模式中切换,默认最小的模式用不了);3.自动定位到播放器(进入播放页及点击主播放器时,可自动定位到播放器)

目前为 2021-08-06 提交的版本。查看 最新版本

// ==UserScript==
// @name         BiliBili播放页调整(自用)
// @namespace    https://greasyfork.org/zh-CN/scripts/415804-bilibili%E6%92%AD%E6%94%BE%E9%A1%B5%E8%B0%83%E6%95%B4-%E8%87%AA%E7%94%A8
// @version      0.1.9.1
// @description  1.自动选择最高画质;2.播放器自动宽屏模式(仅可在宽屏、网页全屏、全屏模式中切换,默认最小的模式用不了);3.自动定位到播放器(进入播放页及点击主播放器时,可自动定位到播放器)
// @author       QIAN
// @match	 *://*.bilibili.com/video/*
// @match	 *://*.bilibili.com/bangumi/play/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// ==/UserScript==

$(function() {
    function autoLocation() {
      if ($('#bilibiliPlayer').length > 0 || $("#bilibili-player").length > 0) {
          $('#bilibiliPlayer').on("click", function() {
              $("html,body").scrollTop($("#bilibiliPlayer").offset().top - 9);
          });
          $('#bilibili-player').on("click", function() {
              $("html,body").scrollTop($("#bilibili-player").offset().top - 9);
          });
      }
    }
    function autoSelect() {
        //自动网页宽屏(不影响网页全屏)
        let changeSet_1 = setInterval(function() {
            if ($('#bilibiliPlayer').hasClass("mode-widescreen") || $('#bilibiliPlayer').hasClass("mode-webfullscreen")) {
                clearInterval(changeSet_1);
            } else {
                $('.bilibili-player-video-btn.bilibili-player-video-btn-widescreen').click();
                changeSet_1 = setInterval(function() {}, 1000);
            }
        }, 1000);
        let changeSet_2 = setInterval(function() {
            if ($('.bpx-player-container').attr("data-screen") == "web" || $('.bpx-player-container').attr("data-screen") == "wide" || $('.bpx-player-container').attr("data-screen") == "full") {
                clearInterval(changeSet_2);
            } else {
                $('.squirtle-controller .squirtle-video-widescreen').click();
                changeSet_2 = setInterval(function() {}, 1000);
            }
        }, 1000);
        //自动选择最高画质
        $('.bui-select-list-wrap > ul > li').eq(0).click();
    }
    autoLocation();
    autoSelect();
});