import '../scss/index.scss';
import 'promise-polyfill/src/polyfill';

/**
 * Blog entry point
 *
 * @author John Noel <john.noel@chaostangent.com>
 * @package Blog
 */

/*
 * Videos
 */
const videoElems = document.querySelectorAll('video');
if (videoElems.length > 0) {
    import(/* webpackChunkName: "videos" */ './videos').then(module => {
        module.default(videoElems);
    });
}

/*
 * Slideshows
 */
const slideshows = document.querySelectorAll('.slideshow');
if (slideshows.length > 0) {
    import(/* webpackChunkName: "slideshows" */ './slideshows').then(module => {
        const Slideshow = module.default;

        for (let i = 0; i < slideshows.length; i++) {
            new Slideshow(slideshows[i]);
        }
    });
}

/*
 * Image strip
 */
const imagestrip = document.querySelector('.imagestrip');
if (imagestrip !== null) {
    import(/* webpackChunkName: "imagestrip" */ './imagestrip').then(module => {
        const ImageStrip = module.default;
        new ImageStrip(imagestrip);
    });
}

/*
 * Kudos
 */
const kudos = document.querySelector('#kudos');
if (kudos !== null) {
    import(/* webpackChunkName: "kudos" */ './kudos').then(module => {
        module.default(kudos);
    });
}
