Browse files

Propagate the fragment identifier in *all* versions (not just dev).

In d48b796, I added the ability
of the apge to track the fragment identifier in the URL so that
switching between version would preserve it.

However, I overlooked the fact that the block of code I used
was only executed when viewing the dev version of the docs.

This commit makes the fragement identifier tracking available
for all version.
  • Loading branch information...
1 parent 91c7a89 commit da114303d06f413bda604b363c64e07c32b6bee0 @bmispelon bmispelon committed Nov 23, 2013
Showing with 10 additions and 8 deletions.
  1. +10 −8 docs/templates/docs/doc.html
View
18 docs/templates/docs/doc.html
@@ -5,6 +5,16 @@
{% block title %}{{ doc.title|striptags|safe }} | {% trans "Django documentation" %}{% endblock %}
{% block extrabody %}
+ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
+ <script>
+ // Propagate the fragment identifier to the links in the version switcher
+ if (window.location.hash) {
+ $('#doc-versions a').each(function () {
+ var anchor = $(this);
+ anchor.attr('href', anchor.attr('href') + window.location.hash);
+ });
+ }
+ </script>
{% if version == 'dev' %}
<div id="dev-warning">
{% trans "This document is for Django's development version, which can be significantly different from previous releases. For older releases, use the version selector floating in the bottom right corner of this page." %}
@@ -14,7 +24,6 @@
margin-top: 2em;
}
</style>
- <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
{% comment %}
Here we are doing something really annoying, we catch clicks on
@@ -53,13 +62,6 @@
}, 50);
});
- // Propagate the fragment identifier to the links in the version switcher
- if (window.location.hash) {
- $('#doc-versions a').each(function () {
- var anchor = $(this);
- anchor.attr('href', anchor.attr('href') + window.location.hash);
- });
- }
</script>
{% endif %}
{% endblock extrabody %}

0 comments on commit da11430

Please sign in to comment.