Commit 1f88f22c authored by Hiro's avatar Hiro 🏄
Browse files

Move inline js

parent 372d4152
if (Modernizr.addTest('svgasimg', document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1'))) {
a = $('[class*="-png"]');
a.each(function(i, obj) {
var iterator = obj.classList.entries();
for(var value of iterator) {
if(/-png/.test(value)) {
cl = value[1];
$(obj).removeClass(cl);
ej = cl.replace(/-png/,"");
$(obj).addClass(ej)
console.log(obj);
}
}
});
}
$('.side-nav').click(function(){
if ($('.side-nav.active').length > 0) {
$('.side-nav.active').removeClass('active')
}
$(this).addClass('active');
});
if($('.show').length !== 1 ) {
$('.show').collapse();
}
// Coming from search result page click
if(window.location.hash !== "") {
// Somehow collapse is not working sync and calling show directly after
// yields no effect and there is no callback when it is ready
setTimeout(() => {
// Folds out the answer manually
$(window.location.hash).collapse('show')
// Avoids the answer being hidden by the floating header
window.scrollTo(0, $(window.location.hash).position().top)
}, 500)
}
......@@ -88,46 +88,6 @@
<script src="{{ '/static/js/bootstrap.bundle.min.js'|asseturl }}" ></script>
<script src="{{ '/static/js/scrollspy.min.js'|asseturl }}" ></script>
<script src="{{ '/static/js/modernizr.js'|asseturl }}" ></script>
<script type="text/javascript">
if (Modernizr.addTest('svgasimg', document.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#Image', '1.1'))) {
a = $('[class*="-png"]');
a.each(function(i, obj) {
var iterator = obj.classList.entries();
for(var value of iterator) {
if(/-png/.test(value)) {
cl = value[1];
$(obj).removeClass(cl);
ej = cl.replace(/-png/,"");
$(obj).addClass(ej)
console.log(obj);
}
}
});
}
$('.side-nav').click(function(){
if ($('.side-nav.active').length > 0) {
$('.side-nav.active').removeClass('active')
}
$(this).addClass('active');
});
if($('.show').length !== 1 ) {
$('.show').collapse();
}
// Coming from search result page click
if(window.location.hash !== "") {
// Somehow collapse is not working sync and calling show directly after
// yields no effect and there is no callback when it is ready
setTimeout(() => {
// Folds out the answer manually
$(window.location.hash).collapse('show')
// Avoids the answer being hidden by the floating header
window.scrollTo(0, $(window.location.hash).position().top)
}, 500)
}
</script>
<script src="{{ '/static/js/fallback.js'|asseturl }}" ></script>
{% include 'script-download.html' %}
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment