From e792b16c5be5dc91594f769377d9576dd287dfde Mon Sep 17 00:00:00 2001 From: flynn Date: Mon, 16 Oct 2017 17:23:43 +0200 Subject: [PATCH 1/2] gitignore update for node --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ca74e2e..479c9b7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ web-ext-artifacts/ node_modules +package-lock.json -- GitLab From 649ac4ba23f3dab9c63fb8a5c6d0fdcc911119d6 Mon Sep 17 00:00:00 2001 From: flynn Date: Mon, 16 Oct 2017 17:37:05 +0200 Subject: [PATCH 2/2] Feature transparent style --- index.js | 10 ++++++---- options.html | 5 ++++- options.js | 8 +++++++- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 266ecc8..33f21d0 100644 --- a/index.js +++ b/index.js @@ -97,10 +97,11 @@ const gafamHosts = [ 'youku.com' ] -function colorGAFAMLinks (color, background) { +function colorGAFAMLinks (color, background, opacity) { const style = { backgroundColor: background, - color: color + color: color, + opacity: opacity } document.querySelectorAll('a').forEach(highlight(style)) @@ -124,9 +125,10 @@ function colorGAFAMLinks (color, background) { browser.storage.local.get({ color: '#FF0000', - backgroundColor: '#FFFF00' + backgroundColor: '#FFFF00', + opacity: '1' }).then(conf => { - colorGAFAMLinks(conf.color, conf.backgroundColor) + colorGAFAMLinks(conf.color, conf.backgroundColor, conf.opacity) }) function highlight (style) { diff --git a/options.html b/options.html index d3eba74..d0ec37d 100644 --- a/options.html +++ b/options.html @@ -9,7 +9,10 @@

- + +

+

+

diff --git a/options.js b/options.js index 491f9b1..2413dac 100644 --- a/options.js +++ b/options.js @@ -2,7 +2,8 @@ function watchChanges (sel) { document.querySelector(sel).addEventListener('change', evt => browser.storage.local.set({ color: document.querySelector('#color').value, - backgroundColor: document.querySelector('#background-color').value + backgroundColor: document.querySelector('#background-color').value, + opacity: document.querySelector('#opacity').value }) ) } @@ -15,8 +16,13 @@ function restoreOptions () { browser.storage.local.get({ backgroundColor: '#FF0000' }).then(result => { document.querySelector('#background-color').value = result.backgroundColor }).catch(console.error) + + browser.storage.local.get({ opacity: '1' }).then(result => { + document.querySelector('#opacity').value = result.opacity + }).catch(console.error) } document.addEventListener('DOMContentLoaded', restoreOptions) watchChanges('#color') watchChanges('#background-color') +watchChanges('#opacity') -- GitLab