6969 hostName = 'com.javahelps.ugetchromewrapper' ;
7070}
7171
72+ current_browser . commands . onCommand . addListener ( function ( command ) {
73+ if ( "toggle-interruption" === command ) {
74+ // Toggle
75+ setInterruptDownload ( ! interruptDownloads , true ) ;
76+ }
77+ } ) ;
78+
7279chromeVersion = parseInt ( chromeVersion ) ;
7380sendMessageToHost ( {
7481 version : "2.1.0"
@@ -117,21 +124,6 @@ var message = {
117124 batch : false
118125} ;
119126
120- // Listen to the key press
121- current_browser . runtime . onMessage . addListener ( function ( request , sender , sendResponse ) {
122- var msg = request . message ;
123- if ( msg === 'enable' ) {
124- // Temporarily enable
125- setInterruptDownload ( true ) ;
126- } else if ( msg == 'disable' ) {
127- // Temporarily disable
128- setInterruptDownload ( false ) ;
129- } else {
130- // Toggle
131- setInterruptDownload ( ! interruptDownloads , true ) ;
132- }
133- } ) ;
134-
135127// Add to Chrome context menu
136128current_browser . contextMenus . create ( {
137129 title : 'Download with uGet' ,
@@ -152,7 +144,6 @@ current_browser.contextMenus.onClicked.addListener(function(info, tab) {
152144 message . referrer = info [ 'pageUrl' ] ;
153145 current_browser . cookies . getAll ( { 'url' : extractRootURL ( info . pageUrl ) } , parseCookies ) ;
154146 } else if ( info . menuItemId === "download_all_links_with_uget" ) {
155- var dataToWebPage = { text : 'test' , foo : 1 , bar : false } ;
156147 current_browser . tabs . executeScript ( null , { file : 'extract.js' } , function ( results ) {
157148 // Do nothing
158149 if ( results [ 0 ] . success ) {
0 commit comments