mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 04:27:15 +03:00
Dark mode unless explicitely disabled (sorry)
This commit is contained in:
@@ -20,14 +20,6 @@ window.addEventListener('DOMContentLoaded', init);
|
||||
async function init() {
|
||||
utils.localizeHtmlPage();
|
||||
|
||||
//switch to light mode when requested, except for Chrome on Linux or older Windows/Mac versions, where Chrome doesn't support themes
|
||||
if (window.matchMedia("(prefers-color-scheme: light)")?.matches &&
|
||||
!(navigator.vendor == "Google Inc." && (navigator.userAgent.includes("Linux") ||
|
||||
navigator.userAgent.includes("Windows NT 6") ||
|
||||
navigator.userAgent.includes("Mac OS X") && navigator.userAgent.match(/Mac OS X [^)]+/)[0] < "Mac OS X 10_14") &&
|
||||
!navigator.userAgent.includes("OPR/") && !navigator.userAgent.includes("Edg/")))
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
|
||||
// selected tab
|
||||
if (location.hash != "") {
|
||||
const substr = location.hash.substring(1);
|
||||
@@ -58,6 +50,10 @@ async function init() {
|
||||
|
||||
await utils.wait(() => Config.config !== null);
|
||||
|
||||
if (Config.config.lightMode) {
|
||||
document.documentElement.setAttribute("data-theme", "light");
|
||||
}
|
||||
|
||||
if (!showDonationLink()) {
|
||||
document.getElementById("sbDonate").classList.add("hidden");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user