Skip to content
This repository has been archived by the owner on Oct 15, 2020. It is now read-only.

Commit

Permalink
draft: add quick issue reporter to nano adblocker
Browse files Browse the repository at this point in the history
  • Loading branch information
jspenguin2017 committed Feb 23, 2019
1 parent 2c35d37 commit d159e9d
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Your language is not listed? Submit an issue to let me know.
1. `git clone --depth 1 https://github.com/NanoAdblocker/NanoCore2.git`
2. `git clone --depth 1 https://github.com/NanoAdblocker/NanoFilters.git`
3. `git clone --depth 1 https://github.com/jspenguin2017/Edgyfy.git`
4. `git clone --depth 1 https://github.com/jspenguin2017/uBlockProtector`
3. Run `git clone --depth 1 https://github.com/gorhill/uBlock.git` in an
appropriate directory to get upstream. Check out a tag or commit as
appropriate.
Expand Down
1 change: 1 addition & 0 deletions config.nano.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@

"./patches/integration/20_0_popup_tweaks.patch",
"./patches/integration/20_1_force_scroll.patch",
"./patches/integration/20_2_bug_reporter.patch",

"./patches/integration/30_0_settings_tweaks.patch",
"./patches/integration/30_1_editor_settings.patch",
Expand Down
69 changes: 69 additions & 0 deletions patches/integration/20_2_bug_reporter.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
diff --git a/platform/chromium/vapi-common.js b/platform/chromium/vapi-common.js
index 9396b47a..ac486d41 100644
--- a/platform/chromium/vapi-common.js
+++ b/platform/chromium/vapi-common.js
@@ -138,6 +138,23 @@ vAPI.download = function(details) {

vAPI.getURL = chrome.runtime.getURL;

+vAPI.nanoOpenBugReporter = function() {
+ const reporter = vAPI.getURL('/reporter/index.html');
+
+ chrome.tabs.query({
+ active: true,
+ currentWindow: true,
+ }, (tabs) => {
+ if (chrome.runtime.lastError || tabs.length === 0) {
+ return;
+ }
+
+ chrome.tabs.create({
+ url: reporter + '?' + tabs[0].id
+ });
+ });
+};
+
/******************************************************************************/

vAPI.i18n = chrome.i18n.getMessage;
diff --git a/src/js/popup.js b/src/js/popup.js
index 79def108..1c41379f 100644
--- a/src/js/popup.js
+++ b/src/js/popup.js
@@ -450,6 +450,7 @@ const renderPopup = function() {
uDom.nodeFromId('gotoPick').classList.toggle('enabled', canElementPicker);
uDom.nodeFromId('gotoZap').classList.toggle('enabled', canElementPicker);
uDom.nodeFromId('nanoForceEnableScroll').classList.toggle('enabled', canElementPicker);
+ uDom.nodeFromId('nanoOpenBugReporter').classList.toggle('enabled', canElementPicker);

let blocked = popupData.pageBlockedRequestCount,
total = popupData.pageAllowedRequestCount + blocked,
@@ -759,6 +760,8 @@ const nanoForceEnableScroll = function() {
vAPI.closePopup();
};

+const nanoOpenBugReporter = vAPI.nanoOpenBugReporter;
+
/******************************************************************************/

const gotoURL = function(ev) {
@@ -1153,6 +1156,7 @@ uDom('#switch .fa-icon').on('click', toggleNetFilteringSwitch);
uDom('#gotoZap').on('click', gotoZap);
uDom('#gotoPick').on('click', gotoPick);
uDom('#nanoForceEnableScroll').on('click', nanoForceEnableScroll);
+uDom('#nanoOpenBugReporter').on('click', nanoOpenBugReporter);
uDom('#nanoFirewallPaneToggle').on('click', toggleFirewallPane);
uDom('#refresh').on('click', reloadTab);
uDom('.hnSwitch').on('click', toggleHostnameSwitch);
diff --git a/src/popup.html b/src/popup.html
index 48f78ec3..7f5cd9d4 100644
--- a/src/popup.html
+++ b/src/popup.html
@@ -25,6 +25,7 @@
<p id="basicTools2">
<span id="gotoZap" class="fa-icon tool" data-i18n-tip="popupTipZapper" data-tip-position="under">bolt</span>
<span id="nanoForceEnableScroll" class="fa tool" data-i18n-tip="nano_p_force_scroll" data-tip-position="under">&#xf103;</span>
+ <span id="nanoOpenBugReporter" class="fa tool" data-i18n-tip="nano_p_bug_reporter" data-tip-position="under">&#xf088;</span>
</p>
<h2 id="dfToggler" data-i18n="popupBlockedRequestPrompt">&nbsp;</h2>
<p class="statName">
2 changes: 2 additions & 0 deletions patches/integration/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ settings page.

`20_1_force_scroll.patch`: Enable force scroll mode button in popup panel.

`20_2_bug_reporter.patch`: Open bug reporter button in popup panel.

## Group `30`: Dashboard Changes

`30_0_settings_tweaks.patch`: Cosmetic tweaks to dashboard settings tab.
Expand Down
8 changes: 8 additions & 0 deletions term/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ const f = (root, ext, match = true) => {
*/
exports.src_repo = null;
exports.assets_repo = "../NanoFilters";
exports.defender_repo = "../uBlockProtector";
exports.edge_shim = "../Edgyfy/edgyfy.js";

/*****************************************************************************/
Expand Down Expand Up @@ -186,6 +187,13 @@ exports.build_core = async (browser) => {
await fs.copy(r("./src/js"), r(output, "js"));
await fs.copy(r("./LICENSE"), r(output, "LICENSE"));

await fs.copy(
r(exports.defender_repo, "src/reporter"), r(output, "reporter"),
);
await fs.copy(
r(exports.defender_repo, "src/libdom.js"), r(output, "libdom.js"),
);

// This must be after copying platform files
await fs.writeFile(
r(output, "manifest.json"), data.manifest(browser), "utf8",
Expand Down

0 comments on commit d159e9d

Please sign in to comment.