Browse Source

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

master
Robbie Antenesse 3 years ago
parent
commit
fd085cc820
  1. 1
      .gitignore
  2. 5
      customHtmlAfterFooter.example.html
  3. 5
      templates/Templater.js
  4. 2
      templates/htmlContainer.html

1
.gitignore vendored

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

5
customHtmlAfterFooter.example.html

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

5
templates/Templater.js

@ -26,6 +26,11 @@ module.exports = class { @@ -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]);

2
templates/htmlContainer.html

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