@@ -13,30 +13,31 @@ document.addEventListener('DOMContentLoaded', function(){
1313 var i18nCheckBoxAutoDetection = chrome . i18n . getMessage ( "checkBoxAutoDetection" ) ;
1414 document . getElementById ( "auto_detection" ) . innerHTML = i18nCheckBoxAutoDetection ;
1515
16- /*
1716 var i18nInfos = chrome . i18n . getMessage ( "infos" ) ;
1817 document . getElementById ( "infos" ) . textContent = i18nInfos ;
1918
2019 var i18nLinkGithub = chrome . i18n . getMessage ( "linkGithub" ) ;
2120 document . getElementById ( "linkGithub" ) . textContent = i18nLinkGithub ;
22- */
21+
2322
2423
2524 /* watch the checkboxes 'cache-browser' and 'autodetection'
2625 * Both can't be check at the same time but both can be uncheck
2726 * at the same time
2827 */
29- var input = document . getElementById ( 'cache-browser' ) ;
28+ var active = document . getElementById ( 'cache-browser' ) ;
3029 var autodetection = document . getElementById ( 'autodetection' ) ;
3130
32- /* cvache -browser */
31+ /* cache -browser */
3332 chrome . storage . sync . get ( "cache-browser" , function ( data ) {
34- input . checked = data [ "cache-browser" ] ;
33+ active . checked = data [ "cache-browser" ] ;
3534 } ) ;
3635 /* add listener on change event */
37- input . addEventListener ( "change" , function ( ) {
38- chrome . storage . sync . set ( { 'cache-browser' : input . checked } ) ;
36+ active . addEventListener ( "change" , function ( ) {
37+ chrome . storage . sync . set ( { 'cache-browser' : active . checked } ) ;
3938 autodetection . checked = false ;
39+ chrome . storage . sync . set ( { 'autodetection' : false } ) ;
40+
4041 } ) ;
4142
4243 /* autodetection */
@@ -46,14 +47,16 @@ document.addEventListener('DOMContentLoaded', function(){
4647 /* add listener on change event */
4748 autodetection . addEventListener ( "change" , function ( ) {
4849 chrome . storage . sync . set ( { 'autodetection' : autodetection . checked } ) ;
49- input . checked = false ;
50+ active . checked = false ;
51+ chrome . storage . sync . set ( { 'cache-browser' : false } ) ;
5052 } ) ;
5153
5254 /* open links in a new tab */
53- document . getElementByTag ( "a ") . addEventListener ( 'click' , function ( e ) {
55+ document . getElementById ( "linkGithub ") . addEventListener ( 'click' , function ( e ) {
5456 chrome . tabs . create ( {
5557 url : e . target . href
5658 } )
5759 } ) ;
5860
61+
5962} ) ;
0 commit comments