forked from EFForg/https-everywhere
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathux.js
More file actions
21 lines (19 loc) · 727 Bytes
/
Copy pathux.js
File metadata and controls
21 lines (19 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"use strict";
let observer;
document.addEventListener("DOMContentLoaded", () => {
const explainer = document.querySelector("[data-i18n=cancel_he_blocking_explainer]");
observer = new MutationObserver(() => {replaceLink(explainer)});
if (explainer.innerText.length > 0) {
replaceLink(explainer);
} else {
observer.observe(explainer, {childList: true});
}
});
function replaceLink(explainer){
observer.disconnect();
const linkText = chrome.i18n.getMessage("cancel_he_blocking_network");
const link = document.createElement("a");
link.href = "https://en.wikipedia.org/wiki/Downgrade_attack";
link.innerText = linkText;
explainer.innerHTML = explainer.innerHTML.replace(linkText, link.outerHTML);
}