-
Notifications
You must be signed in to change notification settings - Fork 10
/
content.js
71 lines (65 loc) · 2.6 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
function contentUpdateById(id, message) {
let infoTitle = document.getElementById(id);
let messageContent = chrome.i18n.getMessage(message);
if (infoTitle === null) {
console.log("content error", id, messageContent);
return;
}
infoTitle.textContent = messageContent;
}
// Information Section
contentUpdateById("text-section-header", "extensionName");
contentUpdateById("description", "extensionDescription");
contentUpdateById("i2pbrowser-version", browser.runtime.getManifest().version);
// Control Section
contentUpdateById("controlHeader", "controlHeader");
contentUpdateById("controlExplain", "controlExplain");
contentUpdateById("clear-browser-data", "clearData");
contentUpdateById("clear-desc", "clearDesc");
contentUpdateById("enable-web-rtc", "enableWebRTC");
contentUpdateById("rtcDesc", "rtcDesc");
contentUpdateById("disable-history", "disableHistory");
//contentUpdateById("disable-referers", "disableReferers");
contentUpdateById("histDesc", "histDesc");
// Application Section
contentUpdateById("applicationHeader", "applicationHeader");
contentUpdateById("applicationExplain", "applicationExplain");
contentUpdateById("window-visit-index", "windowVisitHelppage");
contentUpdateById("help", "help");
contentUpdateById("window-visit-router", "windowVisitConsole");
contentUpdateById("routerConsole", "routerConsole");
contentUpdateById("window-visit-homepage", "extensionName");
contentUpdateById("abouthome", "abouthome");
contentUpdateById("window-visit-i2ptunnel", "windowVisitI2ptunnel");
contentUpdateById("i2ptunnel", "i2ptunnel");
contentUpdateById("window-visit-susimail", "windowVisitSusiMail");
contentUpdateById("susimail", "susimail");
contentUpdateById("window-visit-snark", "windowVisitSnark");
contentUpdateById("snark", "snark");
// Homepage Section
contentUpdateById("window-visit-webpage", "windowVisitWebPage");
contentUpdateById("webpage", "help");
contentUpdateById("window-visit-sources", "windowVisitSources");
contentUpdateById("sources", "sources");
contentUpdateById("window-visit-releases", "windowVisitReleases");
contentUpdateById("releases", "releases");
function hide(elements) {
const elems = Array.isArray(elements) ? elements : [elements];
for (let i = 0; i < elems.length; i++) {
const el = elems[i];
if (el.style) {
console.log("(content) hiding");
el.classList.add("hidden");
}
}
}
function unhide(elements) {
const elems = Array.isArray(elements) ? elements : [elements];
elems.forEach(el => {
if (el.style) {
//el.style.display = "inline-block";
console.log("(content) unhiding");
el.classList.remove("hidden");
}
});
}