@@ -74,35 +74,37 @@ sendMessageToHost({
74
74
version : "2.0.9"
75
75
} ) ;
76
76
77
- // Read the local storage for excluded keywords
78
- if ( localStorage [ "uget-keywords-exclude" ] ) {
79
- keywordsToExclude = localStorage [ "uget-keywords-exclude" ] . split ( / [ \s , ] + / ) ;
80
- } else {
81
- localStorage [ "uget-keywords-exclude" ] = '' ;
82
- }
83
-
84
- // Read the local storage for included keywords
85
- if ( localStorage [ "uget-keywords-include" ] ) {
86
- keywordsToInclude = localStorage [ "uget-keywords-include" ] . split ( / [ \s , ] + / ) ;
87
- } else {
88
- localStorage [ "uget-keywords-include" ] = '' ;
89
- }
77
+ // Read the storage for excluded keywords
78
+ current_browser . storage . sync . get ( function ( items ) {
79
+ if ( items [ "uget-keywords-exclude" ] ) {
80
+ keywordsToExclude = items [ "uget-keywords-exclude" ] . split ( / [ \s , ] + / ) ;
81
+ } else {
82
+ current_browser . storage . sync . set ( { "uget-keywords-exclude" : '' } ) ;
83
+ }
90
84
91
- // Read the local storage for the minimum file-size to interrupt
92
- if ( localStorage [ "uget-min-file-size " ] ) {
93
- minFileSizeToInterrupt = parseInt ( localStorage [ "uget-min-file-size" ] ) ;
94
- } else {
95
- localStorage [ "uget-min-file-size" ] = minFileSizeToInterrupt ;
96
- }
85
+ // Read the local storage for included keywords
86
+ if ( items [ "uget-keywords-include " ] ) {
87
+ keywordsToInclude = items [ "uget-keywords-include" ] . split ( / [ \s , ] + / ) ;
88
+ } else {
89
+ current_browser . storage . sync . set ( { "uget-keywords-include" : '' } ) ;
90
+ }
97
91
98
- // Read the local storage for enabled flag
99
- if ( ! localStorage [ "uget-interrupt" ] ) {
100
- localStorage [ "uget-interrupt" ] = 'true' ;
101
- } else {
102
- var interrupt = ( localStorage [ "uget-interrupt" ] == "true" ) ;
103
- setInterruptDownload ( interrupt ) ;
104
- }
92
+ // Read the local storage for the minimum file-size to interrupt
93
+ if ( items [ "uget-min-file-size" ] ) {
94
+ minFileSizeToInterrupt = parseInt ( items [ "uget-min-file-size" ] ) ;
95
+ } else {
96
+ current_browser . storage . sync . set ( { "uget-min-file-size" : minFileSizeToInterrupt } ) ;
97
+ }
105
98
99
+ // Read the local storage for enabled flag
100
+ if ( ! items [ "uget-interrupt" ] ) {
101
+ // Keep the value string
102
+ current_browser . storage . sync . set ( { "uget-interrupt" : 'true' } ) ;
103
+ } else {
104
+ var interrupt = ( items [ "uget-interrupt" ] == "true" ) ;
105
+ setInterruptDownload ( interrupt ) ;
106
+ }
107
+ } ) ;
106
108
// Message format to send the download information to the uget-chrome-wrapper
107
109
var message = {
108
110
url : '' ,
@@ -464,6 +466,8 @@ function parseCookies(cookies_arr) {
464
466
function updateKeywords ( include , exclude ) {
465
467
keywordsToInclude = include . split ( / [ \s , ] + / ) ;
466
468
keywordsToExclude = exclude . split ( / [ \s , ] + / ) ;
469
+ current_browser . storage . sync . set ( { "uget-keywords-include" : include } ) ;
470
+ current_browser . storage . sync . set ( { "uget-keywords-exclude" : exclude } ) ;
467
471
}
468
472
469
473
/**
@@ -472,6 +476,7 @@ function updateKeywords(include, exclude) {
472
476
*/
473
477
function updateMinFileSize ( size ) {
474
478
minFileSizeToInterrupt = size ;
479
+ current_browser . storage . sync . set ( { "uget-min-file-size" : size } ) ;
475
480
}
476
481
477
482
/**
@@ -519,6 +524,6 @@ function setInterruptDownload(interrupt, writeToStorage) {
519
524
} ) ;
520
525
}
521
526
if ( writeToStorage ) {
522
- localStorage [ "uget-interrupt" ] = interrupt . toString ( ) ;
527
+ current_browser . storage . sync . set ( { "uget-interrupt" : interrupt . toString ( ) } ) ;
523
528
}
524
529
}
0 commit comments