Add global language switch capabilities to the refdoc
See gh-21778
This commit is contained in:
@@ -94,10 +94,10 @@ dependencies {
|
|||||||
|
|
||||||
task extractDocResources(type: Sync) {
|
task extractDocResources(type: Sync) {
|
||||||
dependsOn configurations.docs
|
dependsOn configurations.docs
|
||||||
from "src/docs/asciidoc/"
|
|
||||||
from {
|
from {
|
||||||
configurations.docs.collect { zipTree(it) }
|
configurations.docs.collect { zipTree(it) }
|
||||||
}
|
}
|
||||||
|
from "src/docs/asciidoc/"
|
||||||
into "$buildDir/asciidoc/build"
|
into "$buildDir/asciidoc/build"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
3
src/docs/asciidoc/docinfo-footer.html
Normal file
3
src/docs/asciidoc/docinfo-footer.html
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<script type="text/javascript" src="js/tocbot/tocbot.min.js"></script>
|
||||||
|
<script type="text/javascript" src="js/toc.js"></script>
|
||||||
|
<script type="text/javascript" src="js/switch-language.js"></script>
|
||||||
18
src/docs/asciidoc/js/switch-language.js
Normal file
18
src/docs/asciidoc/js/switch-language.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
function globalSwitch() {
|
||||||
|
$('.switch--item').each(function() {
|
||||||
|
$(this).off('click');
|
||||||
|
$(this).on('click', function() {
|
||||||
|
selectedText = $(this).text()
|
||||||
|
selectedIndex = $(this).index()
|
||||||
|
$(".switch--item").filter(function() { return ($(this).text() === selectedText) }).each(function() {
|
||||||
|
$(this).addClass('selected');
|
||||||
|
$(this).siblings().removeClass('selected');
|
||||||
|
selectedContent = $(this).parent().siblings(".content").eq(selectedIndex)
|
||||||
|
selectedContent.removeClass('hidden');
|
||||||
|
selectedContent.siblings().addClass('hidden');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
$(globalSwitch);
|
||||||
Reference in New Issue
Block a user