Bilibili 网页全屏后改变标签栏颜色

在新版Safari合并标签页和地址栏的情况下,网页全屏后将顶栏改为黑色

// ==UserScript==
// @name         Bilibili 网页全屏后改变标签栏颜色
// @namespace    xianfei
// @version      0.2.0
// @description  在新版Safari合并标签页和地址栏的情况下,网页全屏后将顶栏改为黑色
// @author       xianfei
// @match      *://www.bilibili.com/video/*
// @license     MIT
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function setToolbarColor(color) {
        let themeColorMeta = document.querySelector('meta[name="theme-color"]');
 
        if (!themeColorMeta) {
            themeColorMeta = document.createElement('meta');
            themeColorMeta.name = 'theme-color';
            document.head.appendChild(themeColorMeta);
        }
 
        themeColorMeta.content = color;
    }
    setInterval(()=>{if(document.querySelector('#bilibili-player').getAttribute('class').indexOf("mode-webscreen")!=-1)setToolbarColor('#000');else setToolbarColor('#fff');},100)
})();