mirror of
https://github.com/zombieFox/nightTab.git
synced 2025-06-29 14:01:28 +02:00
[refactor] improve initial background colour check
This commit is contained in:
parent
72596dffbb
commit
775f1bf5c0
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nightTab",
|
"name": "nightTab",
|
||||||
"version": "5.74.0",
|
"version": "5.75.0",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nightTab",
|
"name": "nightTab",
|
||||||
"version": "5.74.0",
|
"version": "5.75.0",
|
||||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -266,7 +266,7 @@ var data = (function() {
|
|||||||
|
|
||||||
var init = function() {
|
var init = function() {
|
||||||
mod.nameFix();
|
mod.nameFix();
|
||||||
mod.restore(data.load());
|
mod.restore(load());
|
||||||
render.feedback.empty();
|
render.feedback.empty();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
// inital check for systems which do not have light or dark mode
|
// inital check for systems which do not have light or dark mode
|
||||||
var data = JSON.parse(localStorage.getItem("nightTab"));
|
var nightTabData = JSON.parse(localStorage.getItem("nightTab"));
|
||||||
if (window.matchMedia("(prefers-color-scheme:light)").matches) {
|
if (window.matchMedia("(prefers-color-scheme:light)").matches) {
|
||||||
if (data) {
|
if (nightTabData) {
|
||||||
if (data.state.theme.style == "dark") {
|
if (nightTabData.state.theme.style == "dark") {
|
||||||
document.querySelector("html").setAttribute("style", "background-color:rgb(0,0,0)");
|
document.querySelector("html").setAttribute("style", "background-color:rgb(0,0,0)");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} else if (window.matchMedia("(prefers-color-scheme:dark)").matches) {
|
} else if (window.matchMedia("(prefers-color-scheme:dark)").matches) {
|
||||||
if (data) {
|
if (nightTabData) {
|
||||||
if (data.state.theme.style == "light") {
|
if (nightTabData.state.theme.style == "light") {
|
||||||
document.querySelector("html").setAttribute("style", "background-color:rgb(255,255,255)");
|
document.querySelector("html").setAttribute("style", "background-color:rgb(255,255,255)");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
var version = (function() {
|
var version = (function() {
|
||||||
|
|
||||||
var current = "5.74.0";
|
var current = "5.75.0";
|
||||||
|
|
||||||
var name = "Jaded Raven";
|
var name = "Jaded Raven";
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"name": "nightTab",
|
"name": "nightTab",
|
||||||
"short_name": "nightTab",
|
"short_name": "nightTab",
|
||||||
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
"description": "A neutral new tab page accented with a chosen colour. Customise the layout, style, background and bookmarks in nightTab.",
|
||||||
"version": "5.74.0",
|
"version": "5.75.0",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"chrome_url_overrides": {
|
"chrome_url_overrides": {
|
||||||
"newtab": "index.html"
|
"newtab": "index.html"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user