2019-06-19 21:39:45 +02:00
|
|
|
<!--- Based on https://github.com/rtfd/sphinx_rtd_theme/pull/438/files -->
|
|
|
|
{# Creates dropdown version selection in the top-left navigation. #}
|
|
|
|
<div class="version">
|
2020-07-17 22:07:35 +02:00
|
|
|
{% if (not READTHEDOCS) and (available_versions is defined) %}
|
2019-06-19 21:39:45 +02:00
|
|
|
<div class="version-dropdown">
|
|
|
|
<select class="version-list" id="version-list" onchange="javascript:location.href = this.value;">
|
|
|
|
<script> x = document.getElementById("version-list"); </script>
|
|
|
|
{% for slug in available_versions %}
|
|
|
|
<script>
|
|
|
|
current_url = window.location.href;
|
|
|
|
option = document.createElement("option");
|
|
|
|
option.text = "{{ slug }}";
|
|
|
|
if ( "{{ slug }}" == "{{ current_version }}" ) {
|
|
|
|
option.selected = true;
|
|
|
|
}
|
2021-04-19 18:33:35 +02:00
|
|
|
if (current_url.search("/{{ current_version }}/") > -1) {
|
|
|
|
option.value = current_url.replace("/{{ current_version }}/","/{{ slug }}/");
|
2019-06-19 21:39:45 +02:00
|
|
|
} else {
|
2021-04-19 18:33:35 +02:00
|
|
|
option.value = current_url.replace("/latest/","/{{ slug }}/");
|
2019-06-19 21:39:45 +02:00
|
|
|
}
|
|
|
|
x.add(option);
|
|
|
|
</script>
|
|
|
|
{% endfor %}
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
{% else %}
|
|
|
|
{{ nav_version }}
|
|
|
|
{% endif %}
|
|
|
|
</div>
|