mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Report cosmetic filters as popup panel property
This commit is contained in:
parent
8c376d7791
commit
620a96531c
2 changed files with 4 additions and 12 deletions
|
|
@ -615,9 +615,6 @@ const onMessage = function(request, sender, callback) {
|
||||||
if ( vAPI.net.hasUnprocessedRequest(request.tabId) ) {
|
if ( vAPI.net.hasUnprocessedRequest(request.tabId) ) {
|
||||||
request.popupPanel.hasUnprocessedRequest = true;
|
request.popupPanel.hasUnprocessedRequest = true;
|
||||||
}
|
}
|
||||||
const supportURL = new URL(vAPI.getURL('support.html'));
|
|
||||||
supportURL.searchParams.set('pageURL', request.pageURL);
|
|
||||||
supportURL.searchParams.set('popupPanel', JSON.stringify(request.popupPanel));
|
|
||||||
vAPI.tabs.executeScript(request.tabId, {
|
vAPI.tabs.executeScript(request.tabId, {
|
||||||
allFrames: true,
|
allFrames: true,
|
||||||
file: '/js/scriptlets/cosmetic-report.js',
|
file: '/js/scriptlets/cosmetic-report.js',
|
||||||
|
|
@ -628,8 +625,11 @@ const onMessage = function(request, sender, callback) {
|
||||||
return a;
|
return a;
|
||||||
}, []);
|
}, []);
|
||||||
if ( filters.length !== 0 ) {
|
if ( filters.length !== 0 ) {
|
||||||
supportURL.searchParams.set('cosmetic', JSON.stringify(filters));
|
request.popupPanel.cosmetic = filters;
|
||||||
}
|
}
|
||||||
|
const supportURL = new URL(vAPI.getURL('support.html'));
|
||||||
|
supportURL.searchParams.set('pageURL', request.pageURL);
|
||||||
|
supportURL.searchParams.set('popupPanel', JSON.stringify(request.popupPanel));
|
||||||
µb.openNewTab({ url: supportURL.href, select: true, index: -1 });
|
µb.openNewTab({ url: supportURL.href, select: true, index: -1 });
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -151,9 +151,6 @@ function showData() {
|
||||||
}
|
}
|
||||||
if ( reportedPage !== null ) {
|
if ( reportedPage !== null ) {
|
||||||
shownData.popupPanel = reportedPage.popupPanel;
|
shownData.popupPanel = reportedPage.popupPanel;
|
||||||
if ( reportedPage.cosmeticFilters ) {
|
|
||||||
shownData.cosmeticFilters = reportedPage.cosmeticFilters;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
const text = JSON.stringify(shownData, null, 2)
|
const text = JSON.stringify(shownData, null, 2)
|
||||||
.split('\n')
|
.split('\n')
|
||||||
|
|
@ -200,14 +197,9 @@ const reportedPage = (( ) => {
|
||||||
select.append(option);
|
select.append(option);
|
||||||
}
|
}
|
||||||
dom.cl.add(dom.body, 'filterIssue');
|
dom.cl.add(dom.body, 'filterIssue');
|
||||||
let cosmeticFilters;
|
|
||||||
if ( url.searchParams.has('cosmetic') ) {
|
|
||||||
cosmeticFilters = JSON.parse(url.searchParams.get('cosmetic'));
|
|
||||||
}
|
|
||||||
return {
|
return {
|
||||||
hostname: parsedURL.hostname.replace(/^(m|mobile|www)\./, ''),
|
hostname: parsedURL.hostname.replace(/^(m|mobile|www)\./, ''),
|
||||||
popupPanel: JSON.parse(url.searchParams.get('popupPanel')),
|
popupPanel: JSON.parse(url.searchParams.get('popupPanel')),
|
||||||
cosmeticFilters,
|
|
||||||
};
|
};
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue