Start adding shortcut support

This commit is contained in:
ilyaigpetrov 2022-03-26 19:28:35 +05:00
parent 3d72acc6dd
commit f4f95c0763
2 changed files with 14 additions and 2 deletions

View File

@ -1,7 +1,19 @@
'use strict'; 'use strict';
chrome.commands.onCommand.addListener((command) => { chrome.commands.onCommand.addListener(async (command) => {
if (command === 'toggle-pac-script') { if (command === 'toggle-pac-script') {
console.log("Toggling PAC-script!"); console.log("Toggling PAC-script!");
const pacKey = window.apis.antiCensorRu.getCurrentPacProviderKey();
if (!pacKey) {
let antiCensorRu = await window.utils.promisedLocalStorage
.get('antiCensorRu');
const oldKey = antiCensorRu._currentPacProviderKey;
console.log('OLD KEY:', oldKey);
if (oldKey) {
window.apis.antiCensorRu.installPacAsync(oldKey, cb);
}
return;
}
window.apis.antiCensorRu.clearPacAsync();
} }
}); });