diff --git a/src/server.js b/src/server.js index c26f332..5b65631 100644 --- a/src/server.js +++ b/src/server.js @@ -138,6 +138,12 @@ app.engine('handlebars', handlebars({ }, slug(string) { return string.toLowerCase().replaceAll(/ /g, '-'); + }, + section(name, options) { + if (!this._sections) this._sections = {}; + if (!this._sections[name]) this._sections[name] = []; + this._sections[name].push(options.fn(this)); + return null; } } })); diff --git a/views/account/account.handlebars b/views/account/account.handlebars index 0e629c6..f8bdf71 100644 --- a/views/account/account.handlebars +++ b/views/account/account.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}} {{> header}} @@ -205,4 +207,6 @@ - +{{#section 'foot'}} + +{{/section}} diff --git a/views/account/login.handlebars b/views/account/login.handlebars index 4c2461f..f145462 100644 --- a/views/account/login.handlebars +++ b/views/account/login.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}} {{> header}} diff --git a/views/account/miieditor.handlebars b/views/account/miieditor.handlebars index 84faca1..aeb374b 100644 --- a/views/account/miieditor.handlebars +++ b/views/account/miieditor.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}}
@@ -567,7 +569,9 @@
- - +{{#section 'foot'}} + + +{{/section}} diff --git a/views/account/register.handlebars b/views/account/register.handlebars index 4a0b7fd..ba3fbbb 100644 --- a/views/account/register.handlebars +++ b/views/account/register.handlebars @@ -1,5 +1,7 @@ - - +{{#section 'head'}} + + +{{/section}} {{> header}} diff --git a/views/account/upgrade.handlebars b/views/account/upgrade.handlebars index 8dea3df..ae1ff64 100644 --- a/views/account/upgrade.handlebars +++ b/views/account/upgrade.handlebars @@ -1,4 +1,7 @@ - +{{#section 'head'}} + +{{/section}} +
@@ -97,14 +100,16 @@
- +{{#section 'foot'}} + - - - +{{#section 'foot'}} + + + + +{{/section}} diff --git a/views/docs/docs.handlebars b/views/docs/docs.handlebars index b080960..c6940bc 100644 --- a/views/docs/docs.handlebars +++ b/views/docs/docs.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}}
@@ -48,9 +50,11 @@
- +{{#section 'foot'}} + - - - - + + + + +{{/section}} diff --git a/views/docs/install.handlebars b/views/docs/install.handlebars index 81be478..8f5f194 100644 --- a/views/docs/install.handlebars +++ b/views/docs/install.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}}
@@ -64,9 +66,11 @@
- +{{#section 'foot'}} + - - - - + + + + +{{/section}} diff --git a/views/docs/search.handlebars b/views/docs/search.handlebars index b05907a..83d087a 100644 --- a/views/docs/search.handlebars +++ b/views/docs/search.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}}
@@ -53,63 +55,64 @@
- +{{#section 'foot'}} + - + - - + + - + input.classList.add('has-matches'); + if (matches.length > 0) { + matches.forEach(match => { + const errorCode = match.item.padEnd(12, 'X'); + const matchLink = document.createElement('a'); + matchLink.innerText = errorCode; + matchLink.href = `/docs/errors/${errorCode}`; + matchesContainer.appendChild(matchLink); + }); + } else { + const noMatch = document.createElement('p'); + noMatch.innerText = '{{ locale.docs.search.no_match }}'; + matchesContainer.appendChild(noMatch); + } + }); + +{{/section}} diff --git a/views/docs/welcome.handlebars b/views/docs/welcome.handlebars index 76d7b25..85b541b 100644 --- a/views/docs/welcome.handlebars +++ b/views/docs/welcome.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}}
@@ -92,9 +94,11 @@
- +{{#section 'foot'}} + - - - - + + + + +{{/section}} diff --git a/views/layouts/blog-opengraph.handlebars b/views/layouts/blog-opengraph.handlebars index 515fc1d..739e741 100644 --- a/views/layouts/blog-opengraph.handlebars +++ b/views/layouts/blog-opengraph.handlebars @@ -62,6 +62,10 @@ } + {{#each _sections.head}} + {{{this}}} + {{/each}} + @@ -72,5 +76,8 @@ + {{#each _sections.foot}} + {{{this}}} + {{/each}} diff --git a/views/layouts/main.handlebars b/views/layouts/main.handlebars index 7d91692..0552644 100644 --- a/views/layouts/main.handlebars +++ b/views/layouts/main.handlebars @@ -61,6 +61,10 @@ twemoji.parse(document.body, {folder: 'svg', ext: '.svg'}); } + + {{#each _sections.head}} + {{{this}}} + {{/each}}
@@ -69,5 +73,9 @@ + {{#each _sections.foot}} + {{{this}}} + {{/each}} + diff --git a/views/localization.handlebars b/views/localization.handlebars index eb1df66..1eab000 100644 --- a/views/localization.handlebars +++ b/views/localization.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}} {{> header}} @@ -25,4 +27,6 @@ {{> footer }} - + + + const randomSentences = [ + {{#each locale.footer.bandwidthRaccoonQuotes}} + `${unescapeHTML("{{this}}")}`, + {{/each}} + ] + + bandwidthRaccoon.addEventListener("click", () => + { + bandwidthRaccoonWrapper.classList.add("speak"); + if (!randomSentences[i]) { + i = 0 + } + bandwidthRaccoonBubbleText.innerText = randomSentences[i]; + i += 1; + }) + +{{/section}} diff --git a/views/progress.handlebars b/views/progress.handlebars index 4588bf2..274c2d1 100644 --- a/views/progress.handlebars +++ b/views/progress.handlebars @@ -1,4 +1,6 @@ - +{{#section 'head'}} + +{{/section}} {{> header}} @@ -43,12 +45,14 @@
- +{{#section 'foot'}} + +{{/section}}