GitHub Site-Wide Dark Mode

Fixes GitHub's dark mode not being enabled on Explore page, Marketplace, etc.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        GitHub Site-Wide Dark Mode
// @namespace   JunkiEDM/auto-dark-mode
// @match       https://github.com/*
// @grant       none
// @version     1.0
// @author      JunkiEDM
// @description Fixes GitHub's dark mode not being enabled on Explore page, Marketplace, etc.
// ==/UserScript==


window.addEventListener('load', function() {
    document.documentElement.setAttribute("data-color-mode", "dark")
    document.documentElement.setAttribute("data-dark-theme", "dark")
    document.evaluate('//*[@id="js-pjax-container"]/div[2]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.setAttribute("style", "/* background-color: #fcfdfd; */")
    document.evaluate('//*[@id="js-pjax-container"]/div[2]/div/div/div[2]/article[1]/div[3]/div/div', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.setAttribute("style", "background: linear-gradient(to top, var(--color-bg-canvas), rgba(255,255,255,0));")
}, false);