mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
[mv3] Allow copy/paste troubleshooting info
This commit is contained in:
parent
d0c028386a
commit
5e9737d38e
2 changed files with 36 additions and 18 deletions
|
|
@ -91,6 +91,30 @@ function renderData(data, depth = 0) {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
async function getConfigData() {
|
||||
const manifest = runtime.getManifest();
|
||||
const [
|
||||
rulesets,
|
||||
defaultMode,
|
||||
] = await Promise.all([
|
||||
dnr.getEnabledRulesets(),
|
||||
sendMessage({ what: 'getDefaultFilteringMode' }),
|
||||
]);
|
||||
const modes = [ 'no filtering', 'basic', 'optimal', 'complete' ];
|
||||
const config = {
|
||||
name: manifest.name,
|
||||
version: manifest.version,
|
||||
filtering: {
|
||||
'site': `${modes[reportedPage.mode]}`,
|
||||
'default': `${modes[defaultMode]}`,
|
||||
},
|
||||
rulesets,
|
||||
};
|
||||
return renderData(config);
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
async function reportSpecificFilterIssue() {
|
||||
const githubURL = new URL(
|
||||
'https://github.com/uBlockOrigin/uAssets/issues/new?template=specific_report_from_ubol.yml'
|
||||
|
|
@ -107,22 +131,9 @@ async function reportSpecificFilterIssue() {
|
|||
);
|
||||
githubURL.searchParams.set('category', issueType);
|
||||
|
||||
const manifest = runtime.getManifest();
|
||||
const rulesets = await dnr.getEnabledRulesets();
|
||||
const defaultMode = await sendMessage({ what: 'getDefaultFilteringMode' });
|
||||
const modes = [ 'no filtering', 'basic', 'optimal', 'complete' ];
|
||||
const config = {
|
||||
name: manifest.name,
|
||||
version: manifest.version,
|
||||
filtering: {
|
||||
'site': `${modes[reportedPage.mode]}`,
|
||||
'default': `${modes[defaultMode]}`,
|
||||
},
|
||||
rulesets,
|
||||
};
|
||||
const configBody = [
|
||||
'```yaml',
|
||||
renderData(config),
|
||||
qs$('[data-i18n="supportS5H"] + pre').textContent,
|
||||
'```',
|
||||
'',
|
||||
].join('\n');
|
||||
|
|
@ -132,7 +143,9 @@ async function reportSpecificFilterIssue() {
|
|||
|
||||
/******************************************************************************/
|
||||
|
||||
(async ( ) => {
|
||||
getConfigData().then(config => {
|
||||
qs$('[data-i18n="supportS5H"] + pre').textContent = config;
|
||||
|
||||
dom.on('[data-url]', 'click', ev => {
|
||||
const elem = ev.target.closest('[data-url]');
|
||||
const url = dom.attr(elem, 'data-url');
|
||||
|
|
@ -154,5 +167,4 @@ async function reportSpecificFilterIssue() {
|
|||
ev.preventDefault();
|
||||
});
|
||||
}
|
||||
|
||||
})();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<section>
|
||||
|
||||
<h3 data-i18n="supportS6H"></h3>
|
||||
<h2 data-i18n="supportS6H"></h2>
|
||||
<p data-i18n="supportS3P1"></p>
|
||||
<div class="supportEntry">
|
||||
<hr>
|
||||
|
|
@ -49,6 +49,12 @@
|
|||
</p>
|
||||
<button type="button" data-i18n="supportReportSpecificButton" class="preferred">_<span class="hover"></span></button>
|
||||
</div>
|
||||
<div style="font-size: smaller;">
|
||||
<hr>
|
||||
<details><summary data-i18n="supportS5H"></summary>
|
||||
<pre style="user-select: all;"></pre>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue