mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2024-12-22 21:00:23 +01:00
Added user prompt for reCAPTCHA when activating window protection
Fixes #231.
This commit is contained in:
parent
bde8ac3e8e
commit
6ca0239c53
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -2,6 +2,7 @@
|
||||
"cSpell.words": [
|
||||
"Blockiermodi",
|
||||
"Blockiermodus",
|
||||
"Captcha",
|
||||
"Ignorierliste",
|
||||
"Maleficient",
|
||||
"Nachfrageverweigerungsmodus",
|
||||
|
@ -865,6 +865,10 @@
|
||||
"message": "Es werden window.opener und window.name beschützt. Dies kann manche Webseiten unbrauchbar machen.",
|
||||
"description": ""
|
||||
},
|
||||
"protectWindow_askReCaptchaException": {
|
||||
"message": "Wenn die Window-API beschützt wird, funktioniert reCAPTCHA nicht mehr. Wollen Sie dafür eine Ausnahme hinzufügen?",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"theme_title": {
|
||||
"message": "Theme",
|
||||
|
@ -857,13 +857,17 @@
|
||||
},
|
||||
|
||||
"protectWindow_title": {
|
||||
"message": "Protect Window API",
|
||||
"message": "Protect window API",
|
||||
"description": ""
|
||||
},
|
||||
"protectWindow_description": {
|
||||
"message": "window.opener and window.name will be protected. This can render some web pages unusable.",
|
||||
"description": ""
|
||||
},
|
||||
"protectWindow_askReCaptchaException": {
|
||||
"message": "Protecting the window API breaks reCAPTCHA. Do you want to add an exception for it?",
|
||||
"description": ""
|
||||
},
|
||||
|
||||
"theme_title": {
|
||||
"message": "Theme",
|
||||
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
Loading…
x
Reference in New Issue
Block a user