Add ability to add custom html to bottom of body (for analytics, etc.)

This commit is contained in:
Robbie Antenesse 2019-01-29 16:13:57 -07:00
parent 86e6bcee61
commit fd085cc820
4 changed files with 13 additions and 0 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ public/history/*.json
.well-known/
settings.json
customHtmlAfterFooter.html

View File

@ -0,0 +1,5 @@
<script>
$(document).ready(function() {
console.log('This runs after everything else is loaded.');
});
</script>

View File

@ -26,6 +26,11 @@ module.exports = class {
.replace(/\{\{allowedFormats\}\}/g, settings.allowedFormats.join(','))
.replace(/\{\{maxFileSize\}\}/g, (settings.maxFileSize > 0 ? settings.maxFileSize + 'MB' : 'no'));
if (fs.existsSync(path.resolve('./customHtmlAfterFooter.html'))) {
const customHtmlAfterFooter = fs.readFileSync(path.resolve('./customHtmlAfterFooter.html'));
filledTemplate = filledTemplate.replace(/\{\{customHtmlAfterFooter\}\}/g, customHtmlAfterFooter);
}
for (let templateVar in templateVars) {
const regExp = new RegExp('\{\{' + templateVar + '\}\}', 'g')
filledTemplate = filledTemplate.replace(regExp, templateVars[templateVar]);

View File

@ -86,6 +86,8 @@
{{modal}}
<script src="{{resourcePath}}js/little-library.js"></script>
{{customHtmlAfterFooter}}
</body>
</html>