1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-03 12:06:31 +02:00

Added user prompt for reCAPTCHA when activating window protection

Fixes #231.
This commit is contained in:
kkapsner 2018-08-31 16:41:36 +02:00
parent bde8ac3e8e
commit 6ca0239c53
4 changed files with 31 additions and 1 deletions

View file

@ -255,4 +255,25 @@
version.textContent = "Version " + manifest.version;
});
document.body.appendChild(version);
settings.onloaded(function(){
const reCaptchaEntry = "^https://www\\.google\\.com/recaptcha/api2/(?:b?frame|anchor).*$";
const {url: urlContainer} = settings.getContainers();
settings.on("protectWindow", function({newValue}){
const urlValue = urlContainer.get();
const matching = urlValue.filter(function(entry){
return entry.url = reCaptchaEntry;
});
if (
newValue &&
(
matching.length === 0 ||
matching[0].protectWindow
) &&
window.confirm(browser.i18n.getMessage("protectWindow_askReCaptchaException"))
){
settings.set("protectWindow", false, reCaptchaEntry);
}
});
});
}());