From 068b02e92be3aaae290ae156e5b93416e0c578b6 Mon Sep 17 00:00:00 2001 From: Snuupy Date: Tue, 21 Aug 2018 16:01:18 -0700 Subject: [PATCH] Fix disappearing context menu --- BUILD.gn | 1 + app/background/events/cosmeticFilterEvents.ts | 51 +++++++++---------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index e2584d6f27c1..1fbb6c345313 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -13,6 +13,7 @@ action("brave-extension") { outputs = [ "$target_gen_dir/brave_extension/build/background.html", "$target_gen_dir/brave_extension/build/js/background.bundle.js", + "$target_gen_dir/brave_extension/build/js/content.bundle.js", "$target_gen_dir/brave_extension/build/js/braveShieldsPanel.bundle.js", "$target_gen_dir/brave_extension/build/braveShieldsPanel.html", "$target_gen_dir/brave_extension/build/bravelizer.css", diff --git a/app/background/events/cosmeticFilterEvents.ts b/app/background/events/cosmeticFilterEvents.ts index f8bd21340923..92aeec5879f2 100644 --- a/app/background/events/cosmeticFilterEvents.ts +++ b/app/background/events/cosmeticFilterEvents.ts @@ -5,33 +5,30 @@ let rule = { selector: '' } -// add context menu -chrome.runtime.onInstalled.addListener(function () { - // parent menu - chrome.contextMenus.create({ - title: 'Brave', - id: 'brave', - contexts: ['all'] - }) - // block ad child menu - chrome.contextMenus.create({ - title: 'Block element via selector', - id: 'addBlockElement', - parentId: 'brave', - contexts: ['all'] - }) - chrome.contextMenus.create({ - title: 'Clear CSS rules for this site', - id: 'resetSiteFilterSettings', - parentId: 'brave', - contexts: ['all'] - }) - chrome.contextMenus.create({ - title: 'Clear CSS rules for all sites', - id: 'resetAllFilterSettings', - parentId: 'brave', - contexts: ['all'] - }) +// parent menu +chrome.contextMenus.create({ + title: 'Brave', + id: 'brave', + contexts: ['all'] +}) +// block ad child menu +chrome.contextMenus.create({ + title: 'Block element via selector', + id: 'addBlockElement', + parentId: 'brave', + contexts: ['all'] +}) +chrome.contextMenus.create({ + title: 'Clear CSS rules for this site', + id: 'resetSiteFilterSettings', + parentId: 'brave', + contexts: ['all'] +}) +chrome.contextMenus.create({ + title: 'Clear CSS rules for all sites', + id: 'resetAllFilterSettings', + parentId: 'brave', + contexts: ['all'] }) // contextMenu listener - when triggered, grab latest selector