diff --git a/.gitignore b/.gitignore index ca74e2ef82e813a50e37abde7111cefa75bbc191..479c9b78780d70030e86708c9c4bebebe136b5ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ web-ext-artifacts/ node_modules +package-lock.json diff --git a/index.js b/index.js index 266ecc8ac1e59de48389a6255ba2a3eb109e583d..33f21d0011f3980602581b64a74dff001c54463b 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 d3eba748ece1e22e5db90ba53ef456f91a7f2658..d0ec37d0e5ced5a3aa1b4efba7820825d8183fca 100644 --- a/options.html +++ b/options.html @@ -9,7 +9,10 @@
- + +
++
diff --git a/options.js b/options.js index 491f9b15b6f3913489fa8930e0869915eeca1aac..2413daca2e2666b403aa2c710880a9c2099e4f13 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')