#include csrf.js
#include html.js
#include xhr.js

#include elems/head.js
#include np/init.js
#include tools/ascii.js
#include tools/whois.js

const makai = (() => {
    const header = new MakaiSiteHeader($query('.js-header'));

    const runIfPathStartsWith = (prefix, func, ...args) => {
        if(location.pathname === prefix || location.pathname.startsWith(`${prefix}/`))
            func(...args);
    };

    runIfPathStartsWith('/tools/ascii', MakaiASCII);
    runIfPathStartsWith('/tools/whois', MakaiWHOIS);

    const nowPlaying = MakaiNowPlayingInit(header);

    return {
        get header() { return header; },
        get nowPlaying() { return nowPlaying; },
    };
})();