mirror of
https://github.com/corda/corda.git
synced 2024-12-21 22:07:55 +00:00
a5f43110f0
* Swap order of Java and Kotlin examples in HTML docs * Nicer comment * Put the hiding of kotlin examples back in the css file (so they start out hidden rather than being hidden when the JS runs - this could potentially make a difference with a large page over a slow connection)
27 lines
1.2 KiB
JavaScript
27 lines
1.2 KiB
JavaScript
$(document).ready(function() {
|
|
$(".codeset").each(function(index, el) {
|
|
var c = $("<div class='codesnippet-widgets'><span class='current'>Java</span><span>Kotlin</span></div>");
|
|
var javaButton = c.children()[0];
|
|
var kotlinButton = c.children()[1];
|
|
kotlinButton.onclick = function() {
|
|
$(el).children(".highlight-java")[0].style.display = "none";
|
|
$(el).children(".highlight-kotlin")[0].style.display = "block";
|
|
javaButton.setAttribute("class", "");
|
|
kotlinButton.setAttribute("class", "current");
|
|
};
|
|
javaButton.onclick = function() {
|
|
$(el).children(".highlight-java")[0].style.display = "block";
|
|
$(el).children(".highlight-kotlin")[0].style.display = "none";
|
|
kotlinButton.setAttribute("class", "");
|
|
javaButton.setAttribute("class", "current");
|
|
};
|
|
|
|
if ($(el).children(".highlight-java").length == 0) {
|
|
// No Java for this example.
|
|
javaButton.style.display = "none";
|
|
// In this case, display Kotlin by default
|
|
$(el).children(".highlight-kotlin")[0].style.display = "block";
|
|
}
|
|
c.insertBefore(el);
|
|
});
|
|
}); |