-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move javascript back to head #545
Changes from 10 commits
433ce2f
2a47e06
0614961
cc0a99b
9744003
6cd5a15
25b9abe
c43d0b0
1f47e23
0bff615
bdef03a
d9c1668
8e00c50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,17 +28,44 @@ | |
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/> | ||
{% endif %} | ||
|
||
{# CSS #} | ||
|
||
{# OPENSEARCH #} | ||
{% if not embedded %} | ||
{% if use_opensearch %} | ||
<link rel="search" type="application/opensearchdescription+xml" | ||
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}" | ||
href="{{ pathto('_static/opensearch.xml', 1) }}"/> | ||
{# Javascript #} | ||
{%- if not embedded %} | ||
{# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #} | ||
{% if sphinx_version >= "1.8.0" %} | ||
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script> | ||
{%- for scriptfile in script_files %} | ||
{{ js_tag(scriptfile) }} | ||
{%- endfor %} | ||
{% else %} | ||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT:'{{ url_root }}', | ||
VERSION:'{{ release|e }}', | ||
LANGUAGE:'{{ language }}', | ||
COLLAPSE_INDEX:false, | ||
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}', | ||
HAS_SOURCE: {{ has_source|lower }}, | ||
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}' | ||
}; | ||
</script> | ||
{%- for scriptfile in script_files %} | ||
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> | ||
{%- endfor %} | ||
{% endif %} | ||
|
||
{% endif %} | ||
{# RTD hosts this file, so just load on non RTD builds #} | ||
{%- if not READTHEDOCS %} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This if block should be removed. We are always including the |
||
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script> | ||
{%- endif %} | ||
<script src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You definitely want modernizr before loading 3rd party scripts ( |
||
|
||
{# OPENSEARCH #} | ||
{%- if use_opensearch %} | ||
<link rel="search" type="application/opensearchdescription+xml" | ||
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}" | ||
href="{{ pathto('_static/opensearch.xml', 1) }}"/> | ||
{%- endif %} | ||
{%- endif %} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpick: the |
||
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" /> | ||
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" /> | ||
|
@@ -49,6 +76,7 @@ | |
<link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" /> | ||
{%- endif %} | ||
{%- endfor %} | ||
|
||
{%- for cssfile in extra_css_files %} | ||
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" /> | ||
{%- endfor %} | ||
|
@@ -74,10 +102,6 @@ | |
{%- endif %} | ||
{%- endblock %} | ||
{%- block extrahead %} {% endblock %} | ||
|
||
{# Keep modernizr in head - http://modernizr.com/docs/#installing #} | ||
<script src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script> | ||
|
||
</head> | ||
|
||
<body class="wy-body-for-nav"> | ||
|
@@ -186,35 +210,6 @@ | |
</div> | ||
{% include "versions.html" %} | ||
|
||
{% if not embedded %} | ||
|
||
{# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #} | ||
{% if sphinx_version >= "1.8.0" %} | ||
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script> | ||
{%- for scriptfile in script_files %} | ||
{{ js_tag(scriptfile) }} | ||
{%- endfor %} | ||
{% else %} | ||
<script type="text/javascript"> | ||
var DOCUMENTATION_OPTIONS = { | ||
URL_ROOT:'{{ url_root }}', | ||
VERSION:'{{ release|e }}', | ||
LANGUAGE:'{{ language }}', | ||
COLLAPSE_INDEX:false, | ||
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}', | ||
HAS_SOURCE: {{ has_source|lower }}, | ||
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}' | ||
}; | ||
</script> | ||
{%- for scriptfile in script_files %} | ||
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script> | ||
{%- endfor %} | ||
{% endif %} | ||
|
||
{% endif %} | ||
|
||
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script> | ||
|
||
<script type="text/javascript"> | ||
jQuery(function () { | ||
SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Use
{# JAVASCRIPT #}
or{# SCRIPTS #}
in all uppercase for consistency with other section comments