Skip to content

Commit 2900d92

Browse files
Move inline script to dottydoc.js
1 parent 5343a0f commit 2900d92

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

doc-tool/resources/_layouts/main.html

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,19 @@
3636
href="{{ site.baseurl }}/{{ css }}"
3737
>
3838
{% endfor %}
39+
40+
<script src="{{ site.baseurl }}/js/jquery.min.js"></script>
3941
</head>
4042
<body>
4143

4244
{{ content }}
4345

44-
<script src="{{ site.baseurl }}/js/jquery.min.js"></script>
4546
<script src="{{ site.baseurl }}/js/highlight.pack.js"></script>
4647
<script src="{{ site.baseurl }}/js/bootstrap.min.js"></script>
4748
{% for js in page.extraJS %}
4849
<script src="{{ site.baseurl }}/{{ js }}"></script>
4950
{% endfor %}
50-
<script>
51-
$(document).ready(function() {
52-
$('pre code').each(function(i, block) {
53-
hljs.highlightBlock(block);
54-
});
55-
56-
if (window.location.hash.length > 0) {
57-
window.scrollTo(0, $(window.location.hash).offset().top - 90);
58-
}
59-
});
60-
</script>
61-
51+
<script src="{{ site.baseurl }}/js/dottydoc.js"></script>
6252
<script>
6353
((window.gitter = {}).chat = {}).options = {
6454
room: 'lampepfl/dotty'

doc-tool/resources/js/dottydoc.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$(document).ready(function() {
2+
// Code hilighting (requires hilight.js to be loaded)
3+
$('pre code').each(function(i, block) {
4+
hljs.highlightBlock(block);
5+
});
6+
// Autoscroll to anchor
7+
if (window.location.hash.length > 0) {
8+
window.scrollTo(0, $(window.location.hash).offset().top - 90);
9+
}
10+
})

0 commit comments

Comments
 (0)