
const config = require('../../config.js');

module.exports = {
    header: function(title, cssFiles, moreHeader) {
        var res = `<html><head><title>${title}</title><link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" />`;
        (cssFiles || []).forEach(function(i) {
            if (i[0] === '_') {
                res += '<style id="' +i.substr(1) +'"></style>';
            } else {
                res += '<link href="' +config.rootUrl +i +'" rel="stylesheet"/>';
            }
        });
        (moreHeader || []).forEach(function(i) {});
        res += '<link href="favicon_err.png" type="image/png" rel="icon" id="linkFavicon" /><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">';
        return res +`</head><body>`;
    }
    ,footer: function(jsFiles, rawJs) {
        var res = "";
        (jsFiles || []).forEach(function(i) {
            res += '<script src="' +config.rootUrl +i +'"></script>';
        });
        if (rawJs) {
            res += '<script>' +rawJs +'</script>';
        }
        return res +`</body></html>`;
    }
};

