Skip to content

Commit

Permalink
v1.90
Browse files Browse the repository at this point in the history
  • Loading branch information
adokseo committed Nov 29, 2020
1 parent 837b97f commit bcf162d
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 7 deletions.
Binary file added assets/icons/128g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/16g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/32g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/48g.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 18 additions & 4 deletions background.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*---------------------------------------------------------------
>>> BACKGROUND
-----------------------------------------------------------------
1.0 On installed
# On installed
# Message listener
---------------------------------------------------------------*/

/*---------------------------------------------------------------
1.0 ON INSTALLED
# ON INSTALLED
---------------------------------------------------------------*/

chrome.runtime.onInstalled.addListener(function() {
Expand All @@ -21,8 +22,7 @@ chrome.runtime.onInstalled.addListener(function() {
url = url.substring(0, url.lastIndexOf('#'));
}

if (
!url.startsWith('about:') &&
if (!url.startsWith('about:') &&
!url.startsWith('chrome') &&
!url.startsWith('edge') &&
!url.startsWith('https://addons.mozilla.org') &&
Expand All @@ -39,3 +39,17 @@ chrome.runtime.onInstalled.addListener(function() {
}
});
});


/*---------------------------------------------------------------
# MESSAGE LISTENER
---------------------------------------------------------------*/

chrome.runtime.onMessage.addListener(function(message, sender) {
if (message === 'night-mode') {
chrome.browserAction.setIcon({
path: 'assets/icons/48.png',
tabId: sender.tab.id
});
}
});
6 changes: 4 additions & 2 deletions content-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function getFilters(settings) {
}

if (settings.invert_colors === true || settings.invert_colors === undefined) {
string += 'body [style*="url("],body [style*=background-position],body canvas,body iframe,body img:not([src*="/ic_"]):not([src*=_ic_]):not([class*=icon]),body pre,body video{-webkit-filter:invert(1)!important;filter:invert(1)!important}';
string += 'body [style*="url("],body [style*=background-position],body canvas,body iframe,body img:not([src*="/ic_"]):not([src*=_ic_]):not([class*=icon]),body pre,body video, body i{-webkit-filter:invert(1)!important;filter:invert(1)!important}';

if (!(settings.bluelight > 0) && (settings.invert_colors === true || settings.invert_colors === undefined)) {
string += 'html,body{background:#fff 0 0 !important}';
Expand Down Expand Up @@ -236,4 +236,6 @@ chrome.storage.onChanged.addListener(function(changes) {
}

update();
});
});

chrome.runtime.sendMessage('night-mode');
8 changes: 7 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Dark Mode",
"version": "1.90",
"description": "Dark Mode, read at night. Blue Light Filter for Every Website. Relax your eyes at night and day.",
"description": "Dark Mode, read at night. Bluelight filter for every website. Relax your eyes at night and day.",

"default_locale": "en",

Expand Down Expand Up @@ -31,6 +31,12 @@
}],

"browser_action": {
"default_icon": {
"16": "assets/icons/16g.png",
"32": "assets/icons/32g.png",
"48": "assets/icons/48g.png",
"128": "assets/icons/128g.png"
},
"default_popup": "index.html"
},

Expand Down

0 comments on commit bcf162d

Please sign in to comment.