diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 1a89f22ec..6eb70e759 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -127,6 +127,10 @@ "message": "Open the logger", "description": "Tooltip used for the logger icon in the panel" }, + "popupTipReport": { + "message": "Report an issue on this website", + "description": "Tooltip used for the 'chat' icon in the panel" + }, "popupTipNoPopups": { "message": "Toggle the blocking of all popups for this site", "description": "Tooltip for the no-popups per-site switch" @@ -856,6 +860,14 @@ "message": "Open", "description": "Text for button which open an external webpage in Support pane" }, + "supportReportSpecificButton": { + "message": "Create new report", + "description": "Text for button which open an external webpage in Support pane" + }, + "supportFindSpecificButton": { + "message": "Find similar reports", + "description": "A clickable link in the filter issue reporter section" + }, "supportS1H": { "message": "Documentation", "description": "Header of 'Documentation' section in Support pane" @@ -908,6 +920,46 @@ "message": "Important: Potentially private or sensitive information is redacted by default. Redacted information may make it more difficult to solve a problem.", "description": "Second paragraph of 'Troubleshooting Information' section in Support pane" }, + "supportS6H": { + "message": "Report a filter issue", + "description": "Header of 'Report a filter issue' section in Support pane" + }, + "supportS6P1S1": { + "message": "To avoid burdening volunteers with duplicate reports, please verify that the issue has not already been reported.", + "description": "A paragraph in the filter issue reporter section" + }, + "supportS6URL": { + "message": "Address of the web page:", + "description": "Label for the URL of the page" + }, + "supportS6Select1": { + "message": "The web page...", + "description": "Label for widget to select type of issue" + }, + "supportS6Select1Option0": { + "message": "-- Pick an entry --", + "description": "An entry in the widget used to select the type of issue" + }, + "supportS6Select1Option1": { + "message": "Shows ads or ad leftovers", + "description": "An entry in the widget used to select the type of issue" + }, + "supportS6Select1Option2": { + "message": "Has overlays or other nuisances", + "description": "An entry in the widget used to select the type of issue" + }, + "supportS6Select1Option3": { + "message": "Detects uBlock Origin", + "description": "An entry in the widget used to select the type of issue" + }, + "supportS6Select1Option4": { + "message": "Has privacy-related issues", + "description": "An entry in the widget used to select the type of issue" + }, + "supportS6Select1Option5": { + "message": "Breaks when uBlock Origin is enabled", + "description": "An entry in the widget used to select the type of issue" + }, "supportRedact": { "message": "Redact", "description": "Text for 'Redact' button" diff --git a/src/css/fa-icons.css b/src/css/fa-icons.css index a1d368d03..807a7f39c 100644 --- a/src/css/fa-icons.css +++ b/src/css/fa-icons.css @@ -64,6 +64,7 @@ width: calc(1em * 1794 / 1792); } .fa-icon > .fa-icon_clipboard, +.fa-icon > .fa-icon_comment-alt, .fa-icon > .fa-icon_external-link, .fa-icon > .fa-icon_eye-dropper, .fa-icon > .fa-icon_eye-open, diff --git a/src/css/popup-fenix.css b/src/css/popup-fenix.css index a06e6a635..fa8c722b5 100644 --- a/src/css/popup-fenix.css +++ b/src/css/popup-fenix.css @@ -203,6 +203,10 @@ body.mobile.no-tooltips .toolRibbon .tool { font-size: 1.6em; } +#basicTools:not(.canPick) .needPick { + visibility: hidden; + } + #extraTools .fa-icon { align-self: center; position: relative; @@ -576,6 +580,9 @@ body.godMode #actionSelector > #dynaAllow { :root body[data-ui~="+no-popups"] #no-popups { display: flex; } +:root.mobile [href="logger-ui.html#_"] { + display: none; + } body:not([data-more~="a"]) [data-more="a"], body:not([data-more~="b"]) [data-more="b"], body:not([data-more~="c"]) [data-more="c"], diff --git a/src/css/support.css b/src/css/support.css index 1d6f32f5a..9344dc0af 100644 --- a/src/css/support.css +++ b/src/css/support.css @@ -2,21 +2,52 @@ body { margin-bottom: 6rem; } +.body > div { + max-width: 800px; + } + .supportEntry { display: flex; margin-top: 1em; } +:root.mobile .supportEntry { + flex-direction: column; + } .supportEntry > div:first-of-type { flex-grow: 1; } -.supportEntry > div:last-of-type { +.supportEntry > div.hasButtons { align-items: center; display: flex; + justify-content: space-around; } .supportEntry h3 { margin-top: 0; } + +.e > .supportEntry { + flex-direction: column; + } +.e > .supportEntry > div:not(:first-of-type) { + margin-top: 1em; + } +.e > .supportEntry *:is(input,select) { + padding: var(--default-gap-xxsmall); + } +.e > .supportEntry input[type="url"] { + width: 100%; + } +.e > .supportEntry *:is(input,select) { + max-width: calc(100% - 1em); + } +body:not(.filterIssue) .body > div.e { + display: none; +} +body.filterIssue .body > div:not(.e) { + display: none; +} + button { margin-inline-end: 1em; -webkit-margin-end: 1em; diff --git a/src/img/fontawesome/fontawesome-defs.svg b/src/img/fontawesome/fontawesome-defs.svg index fe33f8e80..75bc67ff9 100644 --- a/src/img/fontawesome/fontawesome-defs.svg +++ b/src/img/fontawesome/fontawesome-defs.svg @@ -38,6 +38,7 @@ License - https://github.com/FortAwesome/Font-Awesome/tree/a8386aae19e200ddb0f68 + diff --git a/src/js/fa-icons.js b/src/js/fa-icons.js index 3c8f7dbb2..67638ba68 100644 --- a/src/js/fa-icons.js +++ b/src/js/fa-icons.js @@ -40,6 +40,7 @@ const faIconsInit = (( ) => { [ 'code', { viewBox: '0 0 1830 1373', path: 'm 572,1125.5 -50,50 q -10,10 -23,10 -13,0 -23,-10 l -466,-466 q -10,-10 -10,-23 0,-13 10,-23 l 466,-466 q 10,-10 23,-10 13,0 23,10 l 50,50 q 10,10 10,23 0,13 -10,23 l -393,393 393,393 q 10,10 10,23 0,13 -10,23 z M 1163,58.476203 790,1349.4762 q -4,13 -15.5,19.5 -11.5,6.5 -23.5,2.5 l -62,-17 q -13,-4 -19.5,-15.5 -6.5,-11.5 -2.5,-24.5 L 1040,23.5 q 4,-13 15.5,-19.5 11.5,-6.5 23.5,-2.5 l 62,17 q 13,4 19.5,15.5 6.5,11.5 2.5,24.5 z m 657,651 -466,466 q -10,10 -23,10 -13,0 -23,-10 l -50,-50 q -10,-10 -10,-23 0,-13 10,-23 l 393,-393 -393,-393 q -10,-10 -10,-23 0,-13 10,-23 l 50,-50 q 10,-10 23,-10 13,0 23,10 l 466,466 q 10,10 10,23 0,13 -10,23 z' } ], [ 'cog', { viewBox: '0 0 1536 1536', path: 'm 1024,768 q 0,-106 -75,-181 -75,-75 -181,-75 -106,0 -181,75 -75,75 -75,181 0,106 75,181 75,75 181,75 106,0 181,-75 75,-75 75,-181 z m 512,-109 0,222 q 0,12 -8,23 -8,11 -20,13 l -185,28 q -19,54 -39,91 35,50 107,138 10,12 10,25 0,13 -9,23 -27,37 -99,108 -72,71 -94,71 -12,0 -26,-9 l -138,-108 q -44,23 -91,38 -16,136 -29,186 -7,28 -36,28 l -222,0 q -14,0 -24.5,-8.5 Q 622,1519 621,1506 l -28,-184 q -49,-16 -90,-37 l -141,107 q -10,9 -25,9 -14,0 -25,-11 -126,-114 -165,-168 -7,-10 -7,-23 0,-12 8,-23 15,-21 51,-66.5 36,-45.5 54,-70.5 -27,-50 -41,-99 L 29,913 Q 16,911 8,900.5 0,890 0,877 L 0,655 q 0,-12 8,-23 8,-11 19,-13 l 186,-28 q 14,-46 39,-92 -40,-57 -107,-138 -10,-12 -10,-24 0,-10 9,-23 26,-36 98.5,-107.5 Q 315,135 337,135 q 13,0 26,10 L 501,252 Q 545,229 592,214 608,78 621,28 628,0 657,0 L 879,0 Q 893,0 903.5,8.5 914,17 915,30 l 28,184 q 49,16 90,37 l 142,-107 q 9,-9 24,-9 13,0 25,10 129,119 165,170 7,8 7,22 0,12 -8,23 -15,21 -51,66.5 -36,45.5 -54,70.5 26,50 41,98 l 183,28 q 13,2 21,12.5 8,10.5 8,23.5 z' } ], [ 'cogs', { viewBox: '0 0 1920 1761', path: 'm 896,880 q 0,-106 -75,-181 -75,-75 -181,-75 -106,0 -181,75 -75,75 -75,181 0,106 75,181 75,75 181,75 106,0 181,-75 75,-75 75,-181 z m 768,512 q 0,-52 -38,-90 -38,-38 -90,-38 -52,0 -90,38 -38,38 -38,90 0,53 37.5,90.5 37.5,37.5 90.5,37.5 53,0 90.5,-37.5 37.5,-37.5 37.5,-90.5 z m 0,-1024 q 0,-52 -38,-90 -38,-38 -90,-38 -52,0 -90,38 -38,38 -38,90 0,53 37.5,90.5 37.5,37.5 90.5,37.5 53,0 90.5,-37.5 Q 1664,421 1664,368 Z m -384,421 v 185 q 0,10 -7,19.5 -7,9.5 -16,10.5 l -155,24 q -11,35 -32,76 34,48 90,115 7,11 7,20 0,12 -7,19 -23,30 -82.5,89.5 -59.5,59.5 -78.5,59.5 -11,0 -21,-7 l -115,-90 q -37,19 -77,31 -11,108 -23,155 -7,24 -30,24 H 547 q -11,0 -20,-7.5 -9,-7.5 -10,-17.5 l -23,-153 q -34,-10 -75,-31 l -118,89 q -7,7 -20,7 -11,0 -21,-8 -144,-133 -144,-160 0,-9 7,-19 10,-14 41,-53 31,-39 47,-61 -23,-44 -35,-82 L 24,1000 Q 14,999 7,990.5 0,982 0,971 V 786 Q 0,776 7,766.5 14,757 23,756 l 155,-24 q 11,-35 32,-76 -34,-48 -90,-115 -7,-11 -7,-20 0,-12 7,-20 22,-30 82,-89 60,-59 79,-59 11,0 21,7 l 115,90 q 34,-18 77,-32 11,-108 23,-154 7,-24 30,-24 h 186 q 11,0 20,7.5 9,7.5 10,17.5 l 23,153 q 34,10 75,31 l 118,-89 q 8,-7 20,-7 11,0 21,8 144,133 144,160 0,8 -7,19 -12,16 -42,54 -30,38 -45,60 23,48 34,82 l 152,23 q 10,2 17,10.5 7,8.5 7,19.5 z m 640,533 v 140 q 0,16 -149,31 -12,27 -30,52 51,113 51,138 0,4 -4,7 -122,71 -124,71 -8,0 -46,-47 -38,-47 -52,-68 -20,2 -30,2 -10,0 -30,-2 -14,21 -52,68 -38,47 -46,47 -2,0 -124,-71 -4,-3 -4,-7 0,-25 51,-138 -18,-25 -30,-52 -149,-15 -149,-31 v -140 q 0,-16 149,-31 13,-29 30,-52 -51,-113 -51,-138 0,-4 4,-7 4,-2 35,-20 31,-18 59,-34 28,-16 30,-16 8,0 46,46.5 38,46.5 52,67.5 20,-2 30,-2 10,0 30,2 51,-71 92,-112 l 6,-2 q 4,0 124,70 4,3 4,7 0,25 -51,138 17,23 30,52 149,15 149,31 z m 0,-1024 v 140 q 0,16 -149,31 -12,27 -30,52 51,113 51,138 0,4 -4,7 -122,71 -124,71 -8,0 -46,-47 -38,-47 -52,-68 -20,2 -30,2 -10,0 -30,-2 -14,21 -52,68 -38,47 -46,47 -2,0 -124,-71 -4,-3 -4,-7 0,-25 51,-138 -18,-25 -30,-52 -149,-15 -149,-31 V 298 q 0,-16 149,-31 13,-29 30,-52 -51,-113 -51,-138 0,-4 4,-7 4,-2 35,-20 31,-18 59,-34 28,-16 30,-16 8,0 46,46.5 38,46.5 52,67.5 20,-2 30,-2 10,0 30,2 51,-71 92,-112 l 6,-2 q 4,0 124,70 4,3 4,7 0,25 -51,138 17,23 30,52 149,15 149,31 z' } ], + [ 'comment-alt', { viewBox: '0 0 1792 1536', path: 'M 896,128 Q 692,128 514.5,197.5 337,267 232.5,385 128,503 128,640 128,752 199.5,853.5 271,955 401,1029 l 87,50 -27,96 q -24,91 -70,172 152,-63 275,-171 l 43,-38 57,6 q 69,8 130,8 204,0 381.5,-69.5 Q 1455,1013 1559.5,895 1664,777 1664,640 1664,503 1559.5,385 1455,267 1277.5,197.5 1100,128 896,128 Z m 896,512 q 0,174 -120,321.5 -120,147.5 -326,233 -206,85.5 -450,85.5 -70,0 -145,-8 -198,175 -460,242 -49,14 -114,22 h -5 q -15,0 -27,-10.5 -12,-10.5 -16,-27.5 v -1 q -3,-4 -0.5,-12 2.5,-8 2,-10 -0.5,-2 4.5,-9.5 l 6,-9 q 0,0 7,-8.5 7,-8.5 8,-9 7,-8 31,-34.5 24,-26.5 34.5,-38 10.5,-11.5 31,-39.5 20.5,-28 32.5,-51 12,-23 27,-59 15,-36 26,-76 Q 181,1052 90.5,921 0,790 0,640 0,466 120,318.5 240,171 446,85.5 652,0 896,0 q 244,0 450,85.5 206,85.5 326,233 120,147.5 120,321.5 z' } ], [ 'double-angle-left', { viewBox: '0 0 966 998', path: 'm 582,915 q 0,13 -10,23 l -50,50 q -10,10 -23,10 -13,0 -23,-10 L 10,522 Q 0,512 0,499 0,486 10,476 L 476,10 q 10,-10 23,-10 13,0 23,10 l 50,50 q 10,10 10,23 0,13 -10,23 L 179,499 572,892 q 10,10 10,23 z m 384,0 q 0,13 -10,23 l -50,50 q -10,10 -23,10 -13,0 -23,-10 L 394,522 q -10,-10 -10,-23 0,-13 10,-23 L 860,10 q 10,-10 23,-10 13,0 23,10 l 50,50 q 10,10 10,23 0,13 -10,23 L 563,499 956,892 q 10,10 10,23 z' } ], [ 'double-angle-up', { viewBox: '0 0 998 966', path: 'm 998,883 q 0,13 -10,23 l -50,50 q -10,10 -23,10 -13,0 -23,-10 L 499,563 106,956 Q 96,966 83,966 70,966 60,956 L 10,906 Q 0,896 0,883 0,870 10,860 L 476,394 q 10,-10 23,-10 13,0 23,10 l 466,466 q 10,10 10,23 z m 0,-384 q 0,13 -10,23 l -50,50 q -10,10 -23,10 -13,0 -23,-10 L 499,179 106,572 Q 96,582 83,582 70,582 60,572 L 10,522 Q 0,512 0,499 0,486 10,476 L 476,10 q 10,-10 23,-10 13,0 23,10 l 466,466 q 10,10 10,23 z' } ], [ 'download-alt', { viewBox: '0 0 1664 1536', path: 'm 1280,1344 q 0,-26 -19,-45 -19,-19 -45,-19 -26,0 -45,19 -19,19 -19,45 0,26 19,45 19,19 45,19 26,0 45,-19 19,-19 19,-45 z m 256,0 q 0,-26 -19,-45 -19,-19 -45,-19 -26,0 -45,19 -19,19 -19,45 0,26 19,45 19,19 45,19 26,0 45,-19 19,-19 19,-45 z m 128,-224 v 320 q 0,40 -28,68 -28,28 -68,28 H 96 q -40,0 -68,-28 -28,-28 -28,-68 v -320 q 0,-40 28,-68 28,-28 68,-28 h 465 l 135,136 q 58,56 136,56 78,0 136,-56 l 136,-136 h 464 q 40,0 68,28 28,28 28,68 z M 1339,551 q 17,41 -14,70 l -448,448 q -18,19 -45,19 -27,0 -45,-19 L 339,621 q -31,-29 -14,-70 17,-39 59,-39 H 640 V 64 Q 640,38 659,19 678,0 704,0 h 256 q 26,0 45,19 19,19 19,45 v 448 h 256 q 42,0 59,39 z' } ], diff --git a/src/js/html-filtering.js b/src/js/html-filtering.js index fd98aa872..e3ff2101a 100644 --- a/src/js/html-filtering.js +++ b/src/js/html-filtering.js @@ -50,7 +50,10 @@ const htmlFilteringEngine = { }, get discardedCount() { return discardedCount; - } + }, + getFilterCount() { + return filterDB.size; + }, }; const PSelectorHasTextTask = class { diff --git a/src/js/messaging.js b/src/js/messaging.js index 74e761963..6bbba4e43 100644 --- a/src/js/messaging.js +++ b/src/js/messaging.js @@ -28,6 +28,7 @@ import punycode from '../lib/punycode.js'; import cacheStorage from './cachestorage.js'; import cosmeticFilteringEngine from './cosmetic-filtering.js'; +import htmlFilteringEngine from './html-filtering.js'; import logger from './logger.js'; import lz4Codec from './lz4.js'; import io from './assets.js'; @@ -477,15 +478,22 @@ const onMessage = function(request, sender, callback) { // Sync let response; - let pageStore; switch ( request.what ) { - case 'hasPopupContentChanged': - pageStore = µb.pageStoreFromTabId(request.tabId); - var lastModified = pageStore ? pageStore.contentLastModified : 0; + case 'hasPopupContentChanged': { + const pageStore = µb.pageStoreFromTabId(request.tabId); + const lastModified = pageStore ? pageStore.contentLastModified : 0; response = lastModified !== request.contentLastModified; break; - + } + case 'launchReporter': { + const pageStore = µb.pageStoreFromTabId(request.tabId); + if ( pageStore === null ) { break; } + const supportURL = new URL(vAPI.getURL('support.html')); + supportURL.searchParams.set('reportURL', pageStore.rawURL); + µb.openNewTab({ url: supportURL.href, select: true, index: -1 }); + break; + } case 'revertFirewallRules': // TODO: use Set() to message around sets of hostnames sessionFirewall.copyRules( @@ -537,8 +545,8 @@ const onMessage = function(request, sender, callback) { response = popupDataFromTabId(request.tabId); break; - case 'toggleNetFiltering': - pageStore = µb.pageStoreFromTabId(request.tabId); + case 'toggleNetFiltering': { + const pageStore = µb.pageStoreFromTabId(request.tabId); if ( pageStore ) { pageStore.toggleNetFilteringSwitch( request.url, @@ -548,7 +556,7 @@ const onMessage = function(request, sender, callback) { µb.updateToolbarIcon(request.tabId, 0b111); } break; - + } default: return vAPI.messaging.UNHANDLED; } @@ -1304,16 +1312,22 @@ const getSupportData = async function() { extensionVersion: vAPI.app.version, modifiedUserSettings, modifiedHiddenSettings, + 'filterset (summary)': { + network: staticNetFilteringEngine.getFilterCount(), + cosmetic: cosmeticFilteringEngine.getFilterCount(), + scriptlet: scriptletFilteringEngine.getFilterCount(), + html: htmlFilteringEngine.getFilterCount(), + }, 'listset (total-discarded, last updated)': { removed: removedListset, added: addedListset, default: defaultListset, }, + 'filterset (user)': filterset, trustedset: diffArrays( µb.arrayFromWhitelist(µb.netWhitelist), µb.netWhitelistDefault ), - filterset, switchRuleset: diffArrays( sessionSwitches.toArray(), µb.hostnameSwitchesDefault diff --git a/src/js/popup-fenix.js b/src/js/popup-fenix.js index ecbd0b433..c01431ccb 100644 --- a/src/js/popup-fenix.js +++ b/src/js/popup-fenix.js @@ -570,9 +570,10 @@ const renderPopup = function() { } } - const canElementPicker = popupData.canElementPicker === true && isFiltering; - uDom.nodeFromId('gotoPick').classList.toggle('enabled', canElementPicker); - uDom.nodeFromId('gotoZap').classList.toggle('enabled', canElementPicker); + uDom.nodeFromId('basicTools').classList.toggle( + 'canPick', + popupData.canElementPicker === true && isFiltering + ); let blocked, total; if ( popupData.pageCounts !== undefined ) { @@ -844,6 +845,15 @@ const gotoPick = function() { /******************************************************************************/ +const gotoReport = function() { + messaging.send('popupPanel', { + what: 'launchReporter', + tabId: popupData.tabId, + }); +}; + +/******************************************************************************/ + const gotoURL = function(ev) { if ( this.hasAttribute('href') === false ) { return; } @@ -1382,6 +1392,7 @@ const getPopupData = async function(tabId, first = false) { uDom('#switch').on('click', toggleNetFilteringSwitch); uDom('#gotoZap').on('click', gotoZap); uDom('#gotoPick').on('click', gotoPick); +uDom('#gotoReport').on('click', gotoReport); uDom('.hnSwitch').on('click', ev => { toggleHostnameSwitch(ev); }); uDom('#saveRules').on('click', saveFirewallRules); uDom('#revertRules').on('click', ( ) => { revertFirewallRules(); }); diff --git a/src/js/scriptlet-filtering.js b/src/js/scriptlet-filtering.js index ebd3067fb..3a090dbba 100644 --- a/src/js/scriptlet-filtering.js +++ b/src/js/scriptlet-filtering.js @@ -57,7 +57,10 @@ const scriptletFilteringEngine = { }, get discardedCount() { return discardedCount; - } + }, + getFilterCount() { + return scriptletDB.size; + }, }; // Purpose of `contentscriptCode` below is too programmatically inject diff --git a/src/js/support.js b/src/js/support.js index 88a26bceb..d9591c0a8 100644 --- a/src/js/support.js +++ b/src/js/support.js @@ -28,6 +28,7 @@ let supportData; const uselessKeys = [ + 'modifiedHiddenSettings.benchmarkDatasetURL', 'modifiedUserSettings.popupPanelSections', 'modifiedUserSettings.externalLists', 'modifiedUserSettings.importedLists', @@ -113,21 +114,25 @@ function patchEmptiness(data, prop) { } } -function addDetailsToReportURL(id) { +function configToMarkdown(collapse = false) { const text = cmEditor.getValue().replace(/^ /gm, ''); + return collapse + ? '
\n\n```yaml\n' + text + '\n```\n
' + : '```yaml\n' + text + '\n```\n'; +} + +function addDetailsToReportURL(id, collapse = false) { const elem = uDom.nodeFromId(id); const url = new URL(elem.getAttribute('data-url')); - url.searchParams.set( - 'configuration', - '
\n\n```yaml\n' + text + '\n```\n
' - ); + url.searchParams.set('configuration', configToMarkdown(collapse)); elem.setAttribute('data-url', url); } function showData() { const shownData = JSON.parse(JSON.stringify(supportData)); uselessKeys.forEach(prop => { removeKey(shownData, prop); }); - if ( document.body.classList.contains('redacted') ) { + const redacted = document.body.classList.contains('redacted'); + if ( redacted ) { sensitiveValues.forEach(prop => { redactValue(shownData, prop); }); sensitiveKeys.forEach(prop => { redactKeys(shownData, prop); }); } @@ -139,8 +144,8 @@ function showData() { .slice(1, -1) .map(v => { return v - .replace( /^( *)"/, ' $1') - .replace( /^( +.*[^\\])(?:": "|": \{$|": \[$|": )/, '$1: ') + .replace( /^( *?) "/, '$1') + .replace( /^( *.*[^\\])(?:": "|": \{$|": \[$|": )/, '$1: ') .replace( /(?:",?|\},?|\],?|,)$/, ''); }) .filter(v => v.trim() !== '') @@ -149,15 +154,77 @@ function showData() { cmEditor.setValue(text); cmEditor.clearHistory(); - addDetailsToReportURL('filterReport'); - addDetailsToReportURL('bugReport'); + addDetailsToReportURL('filterReport', redacted === false); + addDetailsToReportURL('bugReport', redacted === false); +} + +/******************************************************************************/ + +const reportURL = (( ) => { + const url = new URL(window.location.href); + try { + const reportURL = url.searchParams.get('reportURL'); + if ( reportURL !== null ) { + document.body.classList.add('filterIssue'); + } + document.querySelector('[data-i18n="supportS6URL"] ~ input').value = reportURL; + return new URL(reportURL); + } catch(ex) { + } + return null; +})(); + +function reportSpecificFilterHostname() { + return reportURL.hostname.replace(/^www\./, ''); +} + +function reportSpecificFilterType() { + return document.querySelector('[data-i18n="supportS6Select1"] ~ select').value; +} + +function reportSpecificFilterIssue(ev) { + const bodyTemplate = [ + '### Address of the web page', + '', + '`{{url}}`', + '', + '### Type of issue', + '', + '{{type}}', + '', + '### Description (when issue is not obvious)', + '', + '[none]', + '', + '### Screenshot (when description is difficult)', + '', + '[none]', + '', + '### Configuration', + '', + '{{configuration}}', + ].join('\n'); + const githubURL = new URL('https://github.com/uBlockOrigin/uAssets/issues/new'); + const issueType = document.querySelector('[data-i18n="supportS6Select1"] ~ select').value; + const title = `${reportSpecificFilterHostname()}: ${reportSpecificFilterType()}`; + const body = bodyTemplate + .replace('{{url}}', reportURL.href) + .replace('{{type}}', issueType) + .replace('{{configuration}}', configToMarkdown(false)); + githubURL.searchParams.set('title', title); + githubURL.searchParams.set('body', body); + vAPI.messaging.send('default', { + what: 'gotoURL', + details: { url: githubURL.href, select: true, index: -1 }, + }); + ev.preventDefault(); } /******************************************************************************/ const cmEditor = new CodeMirror(document.getElementById('supportData'), { autofocus: true, - lineWrapping: true, + readOnly: true, styleActiveLine: true, }); @@ -170,12 +237,6 @@ uBlockDashboard.patchCodeMirrorEditor(cmEditor); what: 'getSupportData', }); - // Remove unnecessary information - if ( supportData.modifiedHiddenSettings instanceof Object ) { - const o = supportData.modifiedHiddenSettings; - o.benchmarkDatasetURL = undefined; - } - showData(); uDom('[data-url]').on('click', ev => { @@ -189,6 +250,20 @@ uBlockDashboard.patchCodeMirrorEditor(cmEditor); ev.preventDefault(); }); + uDom('[data-i18n="supportReportSpecificButton"]').on('click', ev => { + reportSpecificFilterIssue(ev); + }); + + uDom('[data-i18n="supportFindSpecificButton"]').on('click', ev => { + const url = new URL('https://github.com/uBlockOrigin/uAssets/issues'); + url.searchParams.set('q', `is:issue "${reportSpecificFilterHostname()}" in:title`); + vAPI.messaging.send('default', { + what: 'gotoURL', + details: { url: url.href, select: true, index: -1 }, + }); + ev.preventDefault(); + }); + uDom('#redactButton').on('click', ( ) => { document.body.classList.add('redacted'); showData(); diff --git a/src/popup-fenix.html b/src/popup-fenix.html index ab8401592..5807857cd 100644 --- a/src/popup-fenix.html +++ b/src/popup-fenix.html @@ -57,8 +57,9 @@
- bolt - eye-dropper + bolt + eye-dropper + comment-alt list-alt cogs
diff --git a/src/support.html b/src/support.html index 8e8886a1f..92e31e713 100644 --- a/src/support.html +++ b/src/support.html @@ -17,53 +17,90 @@
-
-
-

-

-

-
- +
+
+
+

+

+

+
+ +
+
-
-
-
-

-

-

-
- +
+
+
+

+

+

+
+ +
+
-
-
-
-

-

-

-

-

-
- +
+
+
+

+

+

+

+

+
+ +
+
-
-
-
-

-

-

-
- +
+
+
+

+

+

+
+ +
+
+
+
+
+
+

+

+

+

+
+ +

+
+ +

+
+ + +
+
+
+
+
+

+

+

+

+

-
-

-

-

-

-