Skip to content
Permalink
Browse files

Reduced script footprint 👣

- Converted coffee script to ES6
- Removed all jQuery code and plugins
- Removed bootstrap scripts and replaced them with light weight ones
  • Loading branch information...
veloxy committed Jul 20, 2017
1 parent 6e599c7 commit ae68b81cb4b1ca32ac681829b4e63cf200adb1ab

This file was deleted.

Oops, something went wrong.

This file was deleted.

Oops, something went wrong.
@@ -0,0 +1,36 @@
let isInView = function(elem) {
let $elem = document.getElementById(elem);

if ($elem === null) {
return;
}

let docViewTop = window.scrollY;
let docViewBottom = docViewTop + window.innerHeight;

let elemTop = $elem.offsetTop;
let elemBottom = elemTop + $elem.offsetHeight;

return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
};

let check = function() {
if (isInView('disqus_thread')) {
document.removeEventListener('scroll', check);

let disqus_config = function() {
this.page.url = window.location.href;
this.page.identifier = window.location.href;
};

(function() {
let d = document;
let s = d.createElement('script');
s.src = '//sourcebox.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
}
};

document.addEventListener('scroll', check);
Oops, something went wrong.

0 comments on commit ae68b81

Please sign in to comment.
You can’t perform that action at this time.