diff --git a/script.user.js b/script.user.js index 996a151..a03d946 100644 --- a/script.user.js +++ b/script.user.js @@ -1,5 +1,5 @@ // ==UserScript== -// @name Snap! Dark Theme +// @name DarkSnap // @namespace http://tampermonkey.net/ // @match https://snap.berkeley.edu/* // @exclude *://snap.berkeley.edu/snap/* @@ -9,14 +9,8 @@ // @description Fork of https://forum.snap.berkeley.edu/t/18272 // ==/UserScript== // -function isBootstrap5() { - // Select all elements with data-bs-theme attribute - const elementsWithTheme = document.querySelectorAll('[data-bs-theme]'); - // Check if there are any such elements - return elementsWithTheme.length > 0; -} -if (isBootstrap5()) { +if (document.querySelectorAll('[data-bs-theme]').length > 0) { // Set the data-bs-theme attribute to "dark" // By doing some inspectation I determined a lot of pages use // bootstrap 5, and this is how you make bootstrap go in dark mode @@ -48,4 +42,5 @@ style.innerHTML = ` color: #212529; } `; -document.head.appendChild(style); \ No newline at end of file +document.head.appendChild(style); +console.info("Loaded DarkSnap.") \ No newline at end of file