@@ -58,7 +58,16 @@ const onBlockElement = function(details, tab) {
58
58
}
59
59
60
60
µBlock . epickerArgs . mouse = true ;
61
- µBlock . elementPickerExec ( tab . id , tagName + '\t' + src ) ;
61
+ µBlock . elementPickerExec ( tab . id , 0 , `${ tagName } \t${ src } ` ) ;
62
+ } ;
63
+
64
+ /******************************************************************************/
65
+
66
+ const onBlockElementInFrame = function ( details , tab ) {
67
+ if ( tab === undefined ) { return ; }
68
+ if ( / ^ h t t p s ? : \/ \/ / . test ( details . frameUrl ) === false ) { return ; }
69
+ µBlock . epickerArgs . mouse = false ;
70
+ µBlock . elementPickerExec ( tab . id , details . frameId ) ;
62
71
} ;
63
72
64
73
/******************************************************************************/
@@ -76,25 +85,33 @@ const onEntryClicked = function(details, tab) {
76
85
if ( details . menuItemId === 'uBlock0-blockElement' ) {
77
86
return onBlockElement ( details , tab ) ;
78
87
}
88
+ if ( details . menuItemId === 'uBlock0-blockElementInFrame' ) {
89
+ return onBlockElementInFrame ( details , tab ) ;
90
+ }
79
91
if ( details . menuItemId === 'uBlock0-temporarilyAllowLargeMediaElements' ) {
80
92
return onTemporarilyAllowLargeMediaElements ( details , tab ) ;
81
93
}
82
94
} ;
83
95
84
96
/******************************************************************************/
85
97
86
- const menuEntries = [
87
- {
98
+ const menuEntries = {
99
+ blockElement : {
88
100
id : 'uBlock0-blockElement' ,
89
101
title : vAPI . i18n ( 'pickerContextMenuEntry' ) ,
90
102
contexts : [ 'all' ] ,
91
103
} ,
92
- {
104
+ blockElementInFrame : {
105
+ id : 'uBlock0-blockElementInFrame' ,
106
+ title : vAPI . i18n ( 'contextMenuBlockElementInFrame' ) ,
107
+ contexts : [ 'frame' ] ,
108
+ } ,
109
+ temporarilyAllowLargeMediaElements : {
93
110
id : 'uBlock0-temporarilyAllowLargeMediaElements' ,
94
111
title : vAPI . i18n ( 'contextMenuTemporarilyAllowLargeMediaElements' ) ,
95
112
contexts : [ 'all' ] ,
96
113
}
97
- ] ;
114
+ } ;
98
115
99
116
/******************************************************************************/
100
117
@@ -115,10 +132,11 @@ const update = function(tabId = undefined) {
115
132
currentBits = newBits ;
116
133
let usedEntries = [ ] ;
117
134
if ( newBits & 0x01 ) {
118
- usedEntries . push ( menuEntries [ 0 ] ) ;
135
+ usedEntries . push ( menuEntries . blockElement ) ;
136
+ usedEntries . push ( menuEntries . blockElementInFrame ) ;
119
137
}
120
138
if ( newBits & 0x02 ) {
121
- usedEntries . push ( menuEntries [ 1 ] ) ;
139
+ usedEntries . push ( menuEntries . temporarilyAllowLargeMediaElements ) ;
122
140
}
123
141
vAPI . contextMenu . setEntries ( usedEntries , onEntryClicked ) ;
124
142
} ;
0 commit comments