Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Change title when an example is selected.
Browse files Browse the repository at this point in the history
  • Loading branch information
Potherca committed Aug 24, 2024
1 parent 99cd81d commit 77f4586
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/examples/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@ <h2>Result</h2>
console.log = message => outputList.insertAdjacentHTML('beforeend', `<li>${htmlEncoded(JSON.stringify(message, null, 4))}</li>`)

if (file && file !== '') {
title = file.replace(/\.1\.$/, '.')
// Remove the extension
.split('.').slice(0, -1).join(' ')
// Capitalize the first letter of each word
.split('/').map(word => word.charAt(0).toUpperCase() + word.slice(1)).join(' ')

document.title = `MetroJS - Examples - ${title}`
document.querySelector('main').attributes.removeNamedItem('hidden')

const container = document.querySelector('pre > code')
Expand Down

0 comments on commit 77f4586

Please sign in to comment.