GitHub Gist apply dark theme on secret Gists

Apply dark theme to your secret Gists on GitHub Gist

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         GitHub Gist apply dark theme on secret Gists
// @namespace    https://github.com/benok/
// @description  Apply dark theme to your secret Gists on GitHub Gist
// @include      https://gist.github.com/*
// @version      2022.01.31.0
// @homepage     https://gist.github.com/benok/69b98fc38aa5884234fe50326ef014ae
// @author       benok
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';
     if ( (document.querySelector('span.Label.v-align-middle')||
           document.querySelector('span.Label.Label--secondary')/* Editing page */).textContent.includes('Secret')) {
         document.querySelector('html').setAttribute('data-color-mode', 'dark');
    }
})();