@@ -29,6 +29,8 @@ let supportData;
29
29
30
30
const uselessKeys = [
31
31
'modifiedHiddenSettings.benchmarkDatasetURL' ,
32
+ 'modifiedHiddenSettings.consoleLogLevel' ,
33
+ 'modifiedHiddenSettings.uiPopupConfig' ,
32
34
'modifiedUserSettings.alwaysDetachLogger' ,
33
35
'modifiedUserSettings.popupPanelSections' ,
34
36
'modifiedUserSettings.externalLists' ,
@@ -133,65 +135,43 @@ function showData() {
133
135
const shownData = JSON . parse ( JSON . stringify ( supportData ) ) ;
134
136
uselessKeys . forEach ( prop => { removeKey ( shownData , prop ) ; } ) ;
135
137
const redacted = true ;
136
- // If the report is for a specific site, report per-site switches which
137
- // are triggered on the reported site.
138
- if (
139
- reportHostname !== '' &&
140
- shownData . switchRuleset instanceof Object &&
141
- Array . isArray ( shownData . switchRuleset . added )
142
- ) {
143
- const added = [ ] ;
144
- const triggered = [ ] ;
145
- for ( const rule of shownData . switchRuleset . added ) {
146
- const match = / ^ [ ^ : ] + : \s + ( \S + ) / . exec ( rule ) ;
147
- if (
148
- match [ 1 ] === '*' ||
149
- reportHostname === match [ 1 ] ||
150
- reportHostname . endsWith ( `.${ match [ 1 ] } ` )
151
- ) {
152
- triggered . push ( rule ) ;
153
- } else {
154
- added . push ( rule ) ;
155
- }
156
- }
157
- if ( triggered . length !== 0 ) {
158
- shownData . switchRuleset . triggered = triggered ;
159
- shownData . switchRuleset . added = added ;
160
- }
161
- }
162
138
if ( redacted ) {
163
139
sensitiveValues . forEach ( prop => { redactValue ( shownData , prop ) ; } ) ;
164
140
sensitiveKeys . forEach ( prop => { redactKeys ( shownData , prop ) ; } ) ;
165
141
}
166
142
for ( const prop in shownData ) {
167
143
patchEmptiness ( shownData , prop ) ;
168
144
}
145
+ if ( reportedPage !== null ) {
146
+ shownData . popupPanel = reportedPage . popupPanel ;
147
+ }
169
148
const text = JSON . stringify ( shownData , null , 2 )
170
149
. split ( '\n' )
171
150
. slice ( 1 , - 1 )
172
151
. map ( v => {
173
152
return v
174
- . replace ( / ^ ( * ?) " / , '$1' )
175
- . replace ( / ^ ( * .* [ ^ \\ ] ) (?: " : " | " : \{ $ | " : \[ $ | " : ) / , '$1: ' )
176
- . replace ( / (?: " , ? | \} , ? | \] , ? | , ) $ / , '' ) ;
153
+ . replace ( / ^ ( * ?) " / , '$1' )
154
+ . replace ( / ^ ( * .* [ ^ \\ ] ) (?: " : " | " : \{ $ | " : \[ $ | " : ) / , '$1: ' )
155
+ . replace ( / (?: " , ? | \} , ? | \] , ? | , ) $ / , '' ) ;
177
156
} )
178
157
. filter ( v => v . trim ( ) !== '' )
179
158
. join ( '\n' ) + '\n' ;
180
159
181
160
cmEditor . setValue ( text ) ;
182
161
cmEditor . clearHistory ( ) ;
183
162
184
- addDetailsToReportURL ( 'filterReport' , redacted === false ) ;
185
- addDetailsToReportURL ( 'bugReport' , redacted === false ) ;
163
+ addDetailsToReportURL ( 'filterReport' , true ) ;
164
+ addDetailsToReportURL ( 'bugReport' , true ) ;
186
165
}
187
166
188
167
/******************************************************************************/
189
168
190
- const reportHostname = ( ( ) => {
169
+ const reportedPage = ( ( ) => {
191
170
const url = new URL ( window . location . href ) ;
192
171
try {
193
- const reportURL = url . searchParams . get ( 'reportURL' ) ;
194
- const parsedURL = new URL ( reportURL ) ;
172
+ const pageURL = url . searchParams . get ( 'pageURL' ) ;
173
+ if ( pageURL === null ) { return null ; }
174
+ const parsedURL = new URL ( pageURL ) ;
195
175
parsedURL . username = '' ;
196
176
parsedURL . password = '' ;
197
177
parsedURL . hash = '' ;
@@ -209,13 +189,14 @@ const reportHostname = (( ) => {
209
189
option . textContent = parsedURL . href ;
210
190
select . append ( option ) ;
211
191
}
212
- if ( reportURL !== null ) {
213
- document . body . classList . add ( 'filterIssue' ) ;
214
- }
215
- return parsedURL . hostname . replace ( / ^ w w w \. / , '' ) ;
192
+ document . body . classList . add ( 'filterIssue' ) ;
193
+ return {
194
+ hostname : parsedURL . hostname . replace ( / ^ w w w \. / , '' ) ,
195
+ popupPanel : JSON . parse ( url . searchParams . get ( 'popupPanel' ) ) ,
196
+ } ;
216
197
} catch ( ex ) {
217
198
}
218
- return '' ;
199
+ return null ;
219
200
} ) ( ) ;
220
201
221
202
function reportSpecificFilterType ( ) {
@@ -225,7 +206,7 @@ function reportSpecificFilterType() {
225
206
function reportSpecificFilterIssue ( ev ) {
226
207
const githubURL = new URL ( 'https://github.com/uBlockOrigin/uAssets/issues/new?template=specific_report_from_ubo.yml' ) ;
227
208
const issueType = reportSpecificFilterType ( ) ;
228
- let title = `${ reportHostname } : ${ issueType } ` ;
209
+ let title = `${ reportedPage . hostname } : ${ issueType } ` ;
229
210
if ( document . getElementById ( 'isNSFW' ) . checked ) {
230
211
title = `[nsfw] ${ title } ` ;
231
212
}
@@ -269,24 +250,26 @@ uBlockDashboard.patchCodeMirrorEditor(cmEditor);
269
250
if ( typeof url !== 'string' || url === '' ) { return ; }
270
251
vAPI . messaging . send ( 'default' , {
271
252
what : 'gotoURL' ,
272
- details : { url, select : true , index : - 1 } ,
253
+ details : { url, select : true , index : - 1 , shiftKey : ev . shiftKey } ,
273
254
} ) ;
274
255
ev . preventDefault ( ) ;
275
256
} ) ;
276
257
277
- uDom ( '[data-i18n="supportReportSpecificButton"]' ) . on ( 'click' , ev => {
278
- reportSpecificFilterIssue ( ev ) ;
279
- } ) ;
258
+ if ( reportedPage !== null ) {
259
+ uDom ( '[data-i18n="supportReportSpecificButton"]' ) . on ( 'click' , ev => {
260
+ reportSpecificFilterIssue ( ev ) ;
261
+ } ) ;
280
262
281
- uDom ( '[data-i18n="supportFindSpecificButton"]' ) . on ( 'click' , ev => {
282
- const url = new URL ( 'https://github.com/uBlockOrigin/uAssets/issues' ) ;
283
- url . searchParams . set ( 'q' , `is:issue "${ reportHostname } " in:title` ) ;
284
- vAPI . messaging . send ( 'default' , {
285
- what : 'gotoURL' ,
286
- details : { url : url . href , select : true , index : - 1 } ,
263
+ uDom ( '[data-i18n="supportFindSpecificButton"]' ) . on ( 'click' , ev => {
264
+ const url = new URL ( 'https://github.com/uBlockOrigin/uAssets/issues' ) ;
265
+ url . searchParams . set ( 'q' , `is:issue "${ reportedPage . hostname } " in:title` ) ;
266
+ vAPI . messaging . send ( 'default' , {
267
+ what : 'gotoURL' ,
268
+ details : { url : url . href , select : true , index : - 1 } ,
269
+ } ) ;
270
+ ev . preventDefault ( ) ;
287
271
} ) ;
288
- ev . preventDefault ( ) ;
289
- } ) ;
272
+ }
290
273
291
274
uDom ( '#selectAllButton' ) . on ( 'click' , ( ) => {
292
275
cmEditor . focus ( ) ;
0 commit comments