diff --git a/source/javascripts/casper.js b/source/javascripts/casper.js index 87b859c..991c839 100644 --- a/source/javascripts/casper.js +++ b/source/javascripts/casper.js @@ -1,5 +1,5 @@ (function() { - document.addEventListener('DOMContentLoaded', function() { + (function() { document.querySelectorAll('.menu-button, .nav-cover, .nav-close').forEach(function(element) { element.addEventListener('click', function(event) { event.preventDefault(); @@ -12,7 +12,7 @@ document.body.className = body_classes.join(' '); }); }); - }, false); + })(); // slightly adapted from http://stackoverflow.com/a/26798337/421705 window.requestAnimFrame = (function(){ @@ -74,7 +74,7 @@ tick(); } - document.addEventListener('DOMContentLoaded', function() { + (function() { document.querySelectorAll('.scroll-down').forEach(function(element) { element.addEventListener('click', function(event) { event.preventDefault(); @@ -97,5 +97,5 @@ } }); }); - }, false); + })(); })(); diff --git a/source/javascripts/obfuscate.js b/source/javascripts/obfuscate.js index 44ce499..86b22d0 100644 --- a/source/javascripts/obfuscate.js +++ b/source/javascripts/obfuscate.js @@ -16,7 +16,7 @@ return buf.join(''); }; - document.addEventListener("DOMContentLoaded", function() { + (function() { var elements = document.getElementsByClassName("hidden-email"); Array.prototype.forEach.call(elements, function(element){ var encoded = element.getAttribute("data-email"); @@ -29,5 +29,5 @@ var link = "<" + "a h" + "ref=\"mai" + "lto:" + decoded + "\">" + decoded + ""; element.innerHTML = link; }); - }, false); + })(); })(); diff --git a/source/layouts/layout.haml b/source/layouts/layout.haml index 862a52d..730738f 100644 --- a/source/layouts/layout.haml +++ b/source/layouts/layout.haml @@ -59,4 +59,4 @@ - if current_page.data.cover_license.present? = '| ' + markdown(current_page.data.cover_license) - = javascript_include_tag :application + = javascript_include_tag :application, async: true