forked from zomb-676/CobaltDocs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions.js
23 lines (22 loc) · 910 Bytes
/
functions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function switchLanguageShow() {
let switcher = document.getElementById("languageSwitcher");
let isJava = switcher.checked
let containers = document.getElementsByClassName("docsify-tabs docsify-tabs--material")
for (let container of containers) {
if (container.getElementsByClassName("languageChangeAware").length === 0) {
continue
}
let raw = container.innerHTML
if (raw.includes("java")) {
container.style.display = isJava ? "" : "none"
} else if (raw.includes("kotlin")) {
container.style.display = isJava ? "none" : ""
}
}
for (let java of document.getElementsByClassName("languageChangeAware-java")) {
java.style.display = isJava ? "" : "none"
}
for (let kt of document.getElementsByClassName("languageChangeAware-kotlin")) {
kt.style.display = isJava ? "none" : ""
}
}