0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00

move scripts to separate include so we can include them across layouts even if the footer isn't there

This commit is contained in:
Mark Otto 2017-05-29 10:52:13 -07:00 committed by Mark Otto
parent 5c704d77ca
commit 6ee35ced86
5 changed files with 54 additions and 51 deletions

View File

@ -10,54 +10,3 @@
<p>Currently v{{ site.current_version }}. Code licensed <a rel="license" href="https://github.com/twbs/bootstrap/blob/master/LICENSE" target="_blank">MIT</a>, docs <a rel="license" href="https://creativecommons.org/licenses/by/3.0/" target="_blank">CC BY 3.0</a>.</p>
</div>
</footer>
<script src="{{ site.cdn.jquery }}" integrity="{{ site.cdn.jquery_hash }}" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="{{ site.baseurl }}/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>
<script src="{{ site.baseurl }}/assets/js/vendor/popper.min.js"></script>
{% if site.github %}
<script src="{{ site.baseurl }}/dist/js/bootstrap.min.js"></script>
{% else %}
<script src="{{ site.baseurl }}/dist/js/bootstrap.js"></script>
{% endif %}
{% if site.github %}
<script src="{{ site.baseurl }}/assets/js/docs.min.js"></script>
{% else %}
<script src="{{ site.baseurl }}/assets/js/vendor/anchor.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/clipboard.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/holder.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/src/application.js"></script>
{% endif %}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{{ site.baseurl }}/assets/js/ie10-viewport-bug-workaround.js"></script>
<script src="{{ site.baseurl }}/assets/js/ie-emulation-modes-warning.js"></script>
{% if page.layout == "docs" %}
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
<script type="text/javascript">
var docsearch = docsearch({
apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
indexName: 'bootstrap-v4',
inputSelector: '#search-input',
transformData: function (hits) {
return hits.map(function (hit) {
hit.url = hit.url.replace('https://v4-alpha.getbootstrap.com', '');
return hit;
});
},
debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
{% endif %}
<script>
Holder.addTheme('gray', {
bg: '#777',
fg: 'rgba(255,255,255,.75)',
font: 'Helvetica',
fontweight: 'normal'
})
</script>

50
_includes/scripts.html Normal file
View File

@ -0,0 +1,50 @@
<script src="{{ site.cdn.jquery }}" integrity="{{ site.cdn.jquery_hash }}" crossorigin="anonymous"></script>
<script>window.jQuery || document.write('<script src="{{ site.baseurl }}/assets/js/vendor/jquery-slim.min.js"><\/script>')</script>
<script src="{{ site.baseurl }}/assets/js/vendor/popper.min.js"></script>
{% if site.github %}
<script src="{{ site.baseurl }}/dist/js/bootstrap.min.js"></script>
{% else %}
<script src="{{ site.baseurl }}/dist/js/bootstrap.js"></script>
{% endif %}
{% if site.github %}
<script src="{{ site.baseurl }}/assets/js/docs.min.js"></script>
{% else %}
<script src="{{ site.baseurl }}/assets/js/vendor/anchor.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/clipboard.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/vendor/holder.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/src/application.js"></script>
{% endif %}
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="{{ site.baseurl }}/assets/js/ie10-viewport-bug-workaround.js"></script>
<script src="{{ site.baseurl }}/assets/js/ie-emulation-modes-warning.js"></script>
{% if page.layout == "docs" %}
<script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script>
<script type="text/javascript">
var docsearch = docsearch({
apiKey: '48cb48b22351bc71ea5f12f4d1ede198',
indexName: 'bootstrap-v4',
inputSelector: '#search-input',
transformData: function (hits) {
return hits.map(function (hit) {
hit.url = hit.url.replace('https://v4-alpha.getbootstrap.com', '');
return hit;
});
},
debug: false // Set debug to true if you want to inspect the dropdown
});
</script>
{% endif %}
<script>
Holder.addTheme('gray', {
bg: '#777',
fg: 'rgba(255,255,255,.75)',
font: 'Helvetica',
fontweight: 'normal'
})
</script>

View File

@ -17,5 +17,6 @@
</main>
{% include footer.html %}
{% include scripts.html %}
</body>
</html>

View File

@ -31,5 +31,7 @@
{% endif %}
</div>
</div>
{% include scripts.html %}
</body>
</html>

View File

@ -15,5 +15,6 @@
{{ content }}
{% include footer.html %}
{% include scripts.html %}
</body>
</html>