Added version
This commit is contained in:
parent
8863b4c139
commit
6b286431b7
12
css/main.css
12
css/main.css
@ -38,6 +38,18 @@ header .page {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
footer {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
text-align: center;
|
||||
color: #f0f;
|
||||
padding: 6px 0;
|
||||
font-size: 0.75em;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
#page-label {
|
||||
font-weight: 500;
|
||||
font-size: 1.25em;
|
||||
|
@ -28,5 +28,6 @@
|
||||
<div id="theme"></div>
|
||||
</header>
|
||||
<div id="sections"></div>
|
||||
<footer></footer>
|
||||
</body>
|
||||
</html>
|
||||
|
27
js/app.js
27
js/app.js
@ -9,6 +9,8 @@ class App {
|
||||
this.themes = { default: Theme.default() }
|
||||
this.sections = []
|
||||
|
||||
this.retrieveVersion()
|
||||
|
||||
this.retrieveThemes()
|
||||
.then(()=>this.retrieveConfig())
|
||||
.then(config=>this.parseConfig(config))
|
||||
@ -30,6 +32,18 @@ class App {
|
||||
})
|
||||
})
|
||||
}//}}}
|
||||
retrieveVersion() {//{{{
|
||||
return fetch('/VERSION')
|
||||
.then(res=>{
|
||||
if(res.ok)
|
||||
return res.text()
|
||||
throw `Error when fetching /${page}.yaml: ${res.status} ${res.statusText}`
|
||||
})
|
||||
.then(version=>{
|
||||
this.version = version
|
||||
document.querySelector('footer').innerHTML = `Dashie ${version}`
|
||||
})
|
||||
}//}}}
|
||||
retrieveConfig() {//{{{
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
let page = urlParams.get('page')
|
||||
@ -103,6 +117,12 @@ class App {
|
||||
|
||||
let sectionHTML = this.sections.map(s=>s.html())
|
||||
document.getElementById('sections').innerHTML = sectionHTML.join('')
|
||||
|
||||
// Footer
|
||||
let footer = document.querySelector('footer')
|
||||
footer.style.display = t.colors.page.footer.show ? 'block' : 'none';
|
||||
footer.style.color = t.colors.page.footer.text
|
||||
footer.style.backgroundColor = t.colors.page.footer.background
|
||||
}//}}}
|
||||
setTheme(theme) {//{{{
|
||||
this.theme = theme
|
||||
@ -159,7 +179,12 @@ class Theme {
|
||||
page: {
|
||||
text: '#fff',
|
||||
header: '#333',
|
||||
background: '#fff'
|
||||
background: '#fff',
|
||||
footer: {
|
||||
show: true,
|
||||
text: "#aaa",
|
||||
background: "#eee"
|
||||
}
|
||||
},
|
||||
|
||||
page_select: {
|
||||
|
Loading…
Reference in New Issue
Block a user