code: function documentReady(callback) {
    document.readyState === "interactive" || document.readyState === "complete" ? callback() : document.addEventListener("DOMContentLoaded", callback);
  }
docs: http://beeker.io/jquery-document-ready-equivalent-vanilla-javascript