Skip to content

Commit eff9cae

Browse files
committed
Add global language switch capabilities to the refdoc
See gh-21778
1 parent 32a942f commit eff9cae

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

gradle/docs.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ dependencies {
9494

9595
task extractDocResources(type: Sync) {
9696
dependsOn configurations.docs
97-
from "src/docs/asciidoc/"
9897
from {
9998
configurations.docs.collect { zipTree(it) }
10099
}
100+
from "src/docs/asciidoc/"
101101
into "$buildDir/asciidoc/build"
102102
}
103103

src/docs/asciidoc/docinfo-footer.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script type="text/javascript" src="js/tocbot/tocbot.min.js"></script>
2+
<script type="text/javascript" src="js/toc.js"></script>
3+
<script type="text/javascript" src="js/switch-language.js"></script>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
function globalSwitch() {
2+
$('.switch--item').each(function() {
3+
$(this).off('click');
4+
$(this).on('click', function() {
5+
selectedText = $(this).text()
6+
selectedIndex = $(this).index()
7+
$(".switch--item").filter(function() { return ($(this).text() === selectedText) }).each(function() {
8+
$(this).addClass('selected');
9+
$(this).siblings().removeClass('selected');
10+
selectedContent = $(this).parent().siblings(".content").eq(selectedIndex)
11+
selectedContent.removeClass('hidden');
12+
selectedContent.siblings().addClass('hidden');
13+
});
14+
});
15+
});
16+
}
17+
18+
$(globalSwitch);

0 commit comments

Comments
 (0)