@@ -79,27 +79,27 @@ current_browser.storage.sync.get(function(items) {
7979 if ( items [ "uget-keywords-exclude" ] ) {
8080 keywordsToExclude = items [ "uget-keywords-exclude" ] . split ( / [ \s , ] + / ) ;
8181 } else {
82- current_browser . storage . sync . set ( { "uget-keywords-exclude" : '' } ) ;
82+ current_browser . storage . sync . set ( { "uget-keywords-exclude" : '' } ) ;
8383 }
8484
8585 // Read the local storage for included keywords
8686 if ( items [ "uget-keywords-include" ] ) {
8787 keywordsToInclude = items [ "uget-keywords-include" ] . split ( / [ \s , ] + / ) ;
8888 } else {
89- current_browser . storage . sync . set ( { "uget-keywords-include" : '' } ) ;
89+ current_browser . storage . sync . set ( { "uget-keywords-include" : '' } ) ;
9090 }
9191
9292 // Read the local storage for the minimum file-size to interrupt
9393 if ( items [ "uget-min-file-size" ] ) {
9494 minFileSizeToInterrupt = parseInt ( items [ "uget-min-file-size" ] ) ;
9595 } else {
96- current_browser . storage . sync . set ( { "uget-min-file-size" : minFileSizeToInterrupt } ) ;
96+ current_browser . storage . sync . set ( { "uget-min-file-size" : minFileSizeToInterrupt } ) ;
9797 }
9898
9999 // Read the local storage for enabled flag
100100 if ( ! items [ "uget-interrupt" ] ) {
101101 // Keep the value string
102- current_browser . storage . sync . set ( { "uget-interrupt" : 'true' } ) ;
102+ current_browser . storage . sync . set ( { "uget-interrupt" : 'true' } ) ;
103103 } else {
104104 var interrupt = ( items [ "uget-interrupt" ] == "true" ) ;
105105 setInterruptDownload ( interrupt ) ;
@@ -144,18 +144,18 @@ current_browser.contextMenus.create({
144144 id : "download_all_links_with_uget" ,
145145 contexts : [ 'page' ]
146146} ) ;
147-
147+
148148current_browser . contextMenus . onClicked . addListener ( function ( info , tab ) {
149149 "use strict" ;
150150 if ( info . menuItemId === "download_with_uget" ) {
151151 message . url = info [ 'linkUrl' ] ;
152152 message . referrer = info [ 'pageUrl' ] ;
153153 current_browser . cookies . getAll ( { 'url' : extractRootURL ( info . pageUrl ) } , parseCookies ) ;
154154 } else if ( info . menuItemId === "download_all_links_with_uget" ) {
155- var dataToWebPage = { text : 'test' , foo : 1 , bar : false } ;
156- current_browser . tabs . executeScript ( null , { file : 'extract.js' } , function ( results ) {
155+ var dataToWebPage = { text : 'test' , foo : 1 , bar : false } ;
156+ current_browser . tabs . executeScript ( null , { file : 'extract.js' } , function ( results ) {
157157 // Do nothing
158- if ( results [ 0 ] . success ) {
158+ if ( results [ 0 ] . success ) {
159159 message . url = results [ 0 ] . urls ;
160160 message . referrer = info [ 'pageUrl' ] ;
161161 message . batch = true ;
@@ -172,7 +172,7 @@ current_browser.downloads.onCreated.addListener(function(downloadItem) {
172172 return ;
173173 }
174174
175- if ( "in_progress" !== downloadItem [ 'state' ] . toString ( ) . toLowerCase ( ) ) {
175+ if ( "in_progress" !== downloadItem [ 'state' ] . toString ( ) . toLowerCase ( ) ) {
176176 return ;
177177 }
178178
@@ -198,7 +198,7 @@ current_browser.downloads.onCreated.addListener(function(downloadItem) {
198198 } ) ;
199199
200200 message . url = url ;
201- message . filename = unescape ( downloadItem [ 'filename' ] ) ;
201+ message . filename = unescape ( downloadItem [ 'filename' ] ) . replace ( / \" / g , "" ) ;
202202 message . filesize = fileSize ;
203203 message . referrer = downloadItem [ 'referrer' ] ;
204204 current_browser . cookies . getAll ( { 'url' : extractRootURL ( url ) } , parseCookies ) ;
@@ -290,7 +290,7 @@ current_browser.webRequest.onHeadersReceived.addListener(function(details) {
290290 disposition = details . responseHeaders [ i ] . value ;
291291 if ( disposition . lastIndexOf ( 'filename' ) != - 1 ) {
292292 message . filename = disposition . match ( / f i l e n a m e [ ^ ; = \n ] * = ( ( [ ' " ] ) .* ?\2| [ ^ ; \n ] * ) / ) [ 1 ] ;
293- message . filename = unescape ( message . filename ) ;
293+ message . filename = unescape ( message . filename ) . replace ( / \" / g , "" ) ;
294294 interruptDownload = true ;
295295 }
296296 } else if ( details . responseHeaders [ i ] . name . toLowerCase ( ) == 'content-type' ) {
@@ -466,8 +466,8 @@ function parseCookies(cookies_arr) {
466466function updateKeywords ( include , exclude ) {
467467 keywordsToInclude = include . split ( / [ \s , ] + / ) ;
468468 keywordsToExclude = exclude . split ( / [ \s , ] + / ) ;
469- current_browser . storage . sync . set ( { "uget-keywords-include" : include } ) ;
470- current_browser . storage . sync . set ( { "uget-keywords-exclude" : exclude } ) ;
469+ current_browser . storage . sync . set ( { "uget-keywords-include" : include } ) ;
470+ current_browser . storage . sync . set ( { "uget-keywords-exclude" : exclude } ) ;
471471}
472472
473473/**
@@ -476,7 +476,7 @@ function updateKeywords(include, exclude) {
476476 */
477477function updateMinFileSize ( size ) {
478478 minFileSizeToInterrupt = size ;
479- current_browser . storage . sync . set ( { "uget-min-file-size" : size } ) ;
479+ current_browser . storage . sync . set ( { "uget-min-file-size" : size } ) ;
480480}
481481
482482/**
@@ -527,6 +527,6 @@ function setInterruptDownload(interrupt, writeToStorage) {
527527 } ) ;
528528 }
529529 if ( writeToStorage ) {
530- current_browser . storage . sync . set ( { "uget-interrupt" : interrupt . toString ( ) } ) ;
530+ current_browser . storage . sync . set ( { "uget-interrupt" : interrupt . toString ( ) } ) ;
531531 }
532- }
532+ }
0 commit comments