GitHub Gist apply dark theme on secret Gists

Apply dark theme to your secret Gists on GitHub Gist

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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');
    }
})();