1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

Add option to disable content menu integation (#99)

* Add option to disable content menu integation

Fixes issue #98

* pass tab to contextMenuReady
This commit is contained in:
byron jones
2017-03-04 11:33:17 +08:00
committed by Kyle Spearrin
parent 0298c19e13
commit 84821fd67d
5 changed files with 73 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
$scope.i18n = i18nService;
$scope.disableGa = false;
$scope.disableAddLoginNotification = false;
$scope.disableContextMenuItem = false;
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
// Default for Firefox is disabled.
@@ -30,6 +31,17 @@
$scope.$apply();
});
chrome.storage.local.get(constantsService.disableContextMenuItemKey, function (obj) {
if (obj && obj[constantsService.disableContextMenuItemKey]) {
$scope.disableContextMenuItem = true;
}
else {
$scope.disableContextMenuItem = false;
}
$scope.$apply();
});
$scope.updateGa = function () {
chrome.storage.local.get(constantsService.disableGaKey, function (obj) {
// Default for Firefox is disabled.
@@ -75,4 +87,29 @@
});
});
};
$scope.updateDisableContextMenuItem = function () {
chrome.storage.local.get(constantsService.disableContextMenuItemKey, function (obj) {
if (obj[constantsService.disableContextMenuItemKey]) {
// enable
obj[constantsService.disableContextMenuItemKey] = false;
}
else {
// disable
$analytics.eventTrack('Disabled Context Menu Item');
obj[constantsService.disableContextMenuItemKey] = true;
}
chrome.storage.local.set(obj, function () {
$scope.disableContextMenuItem = obj[constantsService.disableContextMenuItemKey];
$scope.$apply();
if (!obj[constantsService.disableContextMenuItemKey]) {
$analytics.eventTrack('Enabled Context Menu Item');
}
chrome.runtime.sendMessage({
command: 'bgUpdateContextMenu'
});
});
});
};
});

View File

@@ -29,5 +29,17 @@
{{i18n.addLoginNotificationDesc}}
</div>
</div>
<div class="list-section">
<div class="list-section-items">
<div class="list-section-item list-section-item-checkbox">
<label for="context-menu">{{i18n.disableContextMenuItem}}</label>
<input id="context-menu" type="checkbox" ng-model="disableContextMenuItem"
ng-change="updateDisableContextMenuItem()">
</div>
</div>
<div class="list-section-footer">
{{i18n.disableContextMenuItemDesc}}
</div>
</div>
</div>
</div>