1
0
mirror of https://github.com/meineerde/holgerjust.de.git synced 2025-10-17 17:01:01 +00:00

Load application.js asynchronously

This commit is contained in:
Holger Just 2017-02-20 14:21:30 +01:00
parent 83713d3fd0
commit 96c72065ef
3 changed files with 7 additions and 7 deletions

View File

@ -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);
})();
})();

View File

@ -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 + "</" + "a>";
element.innerHTML = link;
});
}, false);
})();
})();

View File

@ -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