Compare commits

...
Author SHA1 Message Date
Aaron Carlisle e276b9ca5d Put js reference in if 2019-02-25 20:34:01 -05:00
Aaron Carlisle 271c3a9b70 Fixes to grunt file 2019-02-25 14:26:22 -05:00
Aaron Carlisle 5e734b4424 Remove GA from layout 2019-02-25 14:09:05 -05:00
Aaron Carlisle 62069146e3 Move ga to js file 2019-02-25 14:04:54 -05:00
Aaron Carlisle d2cd909f6b Merge branch 'master' into Blendify/fix-726 2019-02-25 13:42:13 -05:00
Aaron Carlisle 5d10a1f2fb Move logic to js 2019-02-25 13:39:10 -05:00
Aaron Carlisle 966d5e4ba7 Remove inline JS 2019-02-25 13:27:36 -05:00
Aaron Carlisle 0aae6ce01a Update grunt file after file rename 2019-02-25 13:24:21 -05:00
Aaron Carlisle 8d6ce57c87 Rename theme.js to theme.js_t 2019-02-25 13:20:15 -05:00
Aaron Carlisle c8a20f3e08 Defer search index 2019-02-25 13:19:30 -05:00
4 changed files with 34 additions and 42 deletions

No files matched your search

+9 -9
View File
@@ -85,21 +85,21 @@ module.exports = function(grunt) {
options: {
external: ['jquery'],
alias: {
'sphinx-rtd-theme': './js/theme.js'
'sphinx-rtd-theme': './js/theme.js_t'
}
},
src: ['js/*.js'],
dest: 'sphinx_rtd_theme/static/js/theme.js'
src: ['js/*.js_t'],
dest: 'sphinx_rtd_theme/static/js/theme.js_t'
},
build: {
options: {
external: ['jquery'],
alias: {
'sphinx-rtd-theme': './js/theme.js'
'sphinx-rtd-theme': './js/theme.js_t'
}
},
src: ['js/*.js'],
dest: 'sphinx_rtd_theme/static/js/theme.js'
src: ['js/*.js_t'],
dest: 'sphinx_rtd_theme/static/js/theme.js_t'
}
},
uglify: {
@@ -113,7 +113,7 @@ module.exports = function(grunt) {
},
files: [{
expand: true,
src: ['sphinx_rtd_theme/static/js/*.js', '!sphinx_rtd_theme/static/js/*.min.js'],
src: ['sphinx_rtd_theme/static/js/*.js_t', '!sphinx_rtd_theme/static/js/*.min.js_t'],
dest: 'sphinx_rtd_theme/static/js/',
rename: function (dst, src) {
// Use unminified file name for minified file
@@ -131,7 +131,7 @@ module.exports = function(grunt) {
linebreak: true
},
files: {
src: [ 'sphinx_rtd_theme/static/js/theme.js', 'sphinx_rtd_theme/static/css/theme.css' ]
src: [ 'sphinx_rtd_theme/static/js/theme.js_t', 'sphinx_rtd_theme/static/css/theme.css' ]
}
}
},
@@ -163,7 +163,7 @@ module.exports = function(grunt) {
},
/* JavaScript */
browserify: {
files: ['js/*.js'],
files: ['js/*.js_t','js/*.js'],
tasks: ['browserify:dev']
},
/* live-reload the docs if sphinx re-builds */
+16
View File
@@ -66,7 +66,11 @@ function ThemeNav () {
// TODO remove this with a split in theme and Read the Docs JS logic as
// well, it's only here to support 0.3.0 installs of our theme.
nav.enableSticky = function() {
{%- if theme_sticky_navigation|tobool %}
this.enable(true);
{%- else %}
this.enable(false);
{%- endif %}
};
nav.init = function ($) {
@@ -239,3 +243,15 @@ if (typeof(window) != 'undefined') {
clearTimeout(id);
};
}());
{# Do not conflict with RTD insertion of analytics script #}
{%- if not READTHEDOCS %}
{%- if theme_analytics_id %}
window.addEventListener("load", function(){
ga('create', '{{ theme_analytics_id }}', 'auto');
ga('send', 'pageview');
})
{%- endif %}
{%- endif %}
+6 -25
View File
@@ -54,6 +54,11 @@
{%- endfor %}
{% endif %}
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
{%- if not READTHEDOCS %}
{%- if theme_analytics_id %}
<script src="https://ssl.google-analytics.com/analytics.js" async id="ga"></script>
{%- endif %}
{%- endif %}
{# OPENSEARCH #}
{%- if use_opensearch %}
@@ -204,31 +209,7 @@
</section>
</div>
{% include "versions.html" %}
<script type="text/javascript">
jQuery(function () {
SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }});
});
</script>
{# Do not conflict with RTD insertion of analytics script #}
{% if not READTHEDOCS %}
{% if theme_analytics_id %}
<!-- Theme Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', '{{ theme_analytics_id }}', 'auto');
ga('send', 'pageview');
</script>
{% endif %}
{% endif %}
{%- include "versions.html" %}
{%- block footer %} {% endblock %}
</body>
+3 -8
View File
@@ -10,15 +10,10 @@
{%- extends "layout.html" %}
{% set title = _('Search') %}
{% set script_files = script_files + ['_static/searchtools.js'] %}
{% block footer %}
<script type="text/javascript">
jQuery(function() { Search.loadIndex("{{ pathto('searchindex.js', 1) }}"); });
</script>
{# this is used when loading the search index using $.ajax fails,
such as on Chrome for documents on localhost #}
<script type="text/javascript" id="searchindexloader"></script>
{%- block extrahead %}
<script type="text/javascript" src="{{ pathto('searchindex.js', 1) }}" defer></script>
{{ super() }}
{% endblock %}
{%- endblock %}
{% block body %}
<noscript>
<div id="fallback" class="admonition warning">