GitHub Site-Wide Dark Mode

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

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