69
69
hostName = 'com.javahelps.ugetchromewrapper' ;
70
70
}
71
71
72
+ current_browser . commands . onCommand . addListener ( function ( command ) {
73
+ if ( "toggle-interruption" === command ) {
74
+ // Toggle
75
+ setInterruptDownload ( ! interruptDownloads , true ) ;
76
+ }
77
+ } ) ;
78
+
72
79
chromeVersion = parseInt ( chromeVersion ) ;
73
80
sendMessageToHost ( {
74
81
version : "2.1.0"
@@ -117,21 +124,6 @@ var message = {
117
124
batch : false
118
125
} ;
119
126
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
-
135
127
// Add to Chrome context menu
136
128
current_browser . contextMenus . create ( {
137
129
title : 'Download with uGet' ,
@@ -152,7 +144,6 @@ current_browser.contextMenus.onClicked.addListener(function(info, tab) {
152
144
message . referrer = info [ 'pageUrl' ] ;
153
145
current_browser . cookies . getAll ( { 'url' : extractRootURL ( info . pageUrl ) } , parseCookies ) ;
154
146
} else if ( info . menuItemId === "download_all_links_with_uget" ) {
155
- var dataToWebPage = { text : 'test' , foo : 1 , bar : false } ;
156
147
current_browser . tabs . executeScript ( null , { file : 'extract.js' } , function ( results ) {
157
148
// Do nothing
158
149
if ( results [ 0 ] . success ) {
0 commit comments