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

@ -230,7 +230,7 @@
);
return (ifUnattended
? tryPromiseSeveralTimesAsync(tryAllUrlsAsync, [20, 40, 60])
: tryAllUrlsAsync()
: tryAllUrlsAsync()
).catch(
(err) => Promise.reject(clarify(
err,

View File

@ -1,7 +1,19 @@
'use strict';
chrome.commands.onCommand.addListener((command) => {
chrome.commands.onCommand.addListener(async (command) => {
if (command === 'toggle-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();
}
});