@@ -280,6 +280,14 @@ function createHtml5VideoContextMenus() {
280
280
} , onContextMenuCreated ) ;
281
281
}
282
282
283
+ function getLinkUrl ( infoObject ) {
284
+ var link = infoObject . linkUrl ;
285
+ if ( link === undefined ) {
286
+ link = infoObject . selectionText ;
287
+ }
288
+ return link ;
289
+ }
290
+
283
291
function createMagnetAndP2PAndImageContextMenus ( ) {
284
292
chrome . contextMenus . create ( {
285
293
title : "Show Image" ,
@@ -297,12 +305,12 @@ function createMagnetAndP2PAndImageContextMenus() {
297
305
298
306
chrome . contextMenus . create ( {
299
307
title : "Play now" ,
300
- contexts : [ "link" ] ,
308
+ contexts : [ "link" , "selection" ] ,
301
309
targetUrlPatterns : [ 'magnet:*' , 'acestream:*' , 'sop:*' ] ,
302
310
onclick : function ( info ) {
303
311
doAction ( actions . Stop , function ( ) {
304
- clearPlaylist ( function ( ) {
305
- queueItem ( info . linkUrl , function ( ) {
312
+ clearPlaylist ( function ( ) {
313
+ queueItem ( getLinkUrl ( info ) , function ( ) {
306
314
} ) ;
307
315
} )
308
316
} ) ;
@@ -311,21 +319,21 @@ function createMagnetAndP2PAndImageContextMenus() {
311
319
312
320
chrome . contextMenus . create ( {
313
321
title : "Queue" ,
314
- contexts : [ "link" ] ,
322
+ contexts : [ "link" , "selection" ] ,
315
323
targetUrlPatterns : [ 'magnet:*' , 'acestream:*' , 'sop:*' ] ,
316
324
onclick : function ( info ) {
317
- queueItem ( info . linkUrl , function ( ) {
325
+ queueItem ( getLinkUrl ( info ) , function ( ) {
318
326
} ) ;
319
327
}
320
328
} , onContextMenuCreated ) ;
321
329
322
330
chrome . contextMenus . create ( {
323
331
title : "Play this Next" ,
324
- contexts : [ "link" ] ,
332
+ contexts : [ "link" , "selection" ] ,
325
333
targetUrlPatterns : [ 'magnet:*' , 'acestream:*' , 'sop:*' ] ,
326
334
onclick : function ( info ) {
327
335
getPlaylistPosition ( function ( position ) {
328
- insertItem ( info . linkUrl , position + 1 , function ( ) {
336
+ insertItem ( getLinkUrl ( info ) , position + 1 , function ( ) {
329
337
} ) ;
330
338
} ) ;
331
339
}
0 commit comments