cfr #121 Co-authored-by: Christophe Siraut <d@tobald.eu.org> Co-authored-by: bkfox <thomas bkfox net> Co-authored-by: Thomas Kairos <thomas@bkfox.net> Reviewed-on: #131 Co-authored-by: Chris Tactic <ctactic@noreply.git.radiocampus.be> Co-committed-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
This commit is contained in:
@ -2,28 +2,27 @@
|
||||
* This module includes code available for both the public website and
|
||||
* administration interface)
|
||||
*/
|
||||
//-- vendor
|
||||
import '@fortawesome/fontawesome-free/css/all.min.css';
|
||||
|
||||
import 'vue'
|
||||
|
||||
//-- aircox
|
||||
import App, {PlayerApp} from './app'
|
||||
import Builder from './appBuilder'
|
||||
import VueLoader from './vueLoader'
|
||||
import Sound from './sound'
|
||||
import {Set} from './model'
|
||||
|
||||
import './assets/styles.scss'
|
||||
import './styles/common.scss'
|
||||
|
||||
|
||||
window.aircox = {
|
||||
// main application
|
||||
builder: new Builder(App),
|
||||
get app() { return this.builder.app },
|
||||
loader: null,
|
||||
get app() { return this.loader.app },
|
||||
|
||||
// player application
|
||||
playerBuilder: new Builder(PlayerApp),
|
||||
get playerApp() { return this.playerBuilder && this.playerBuilder.app },
|
||||
get player() { return this.playerBuilder.vm && this.playerBuilder.vm.$refs.player },
|
||||
playerLoader: null,
|
||||
get playerApp() { return this.playerLoader && this.playerLoader.app },
|
||||
get player() { return this.playerLoader.vm && this.playerLoader.vm.$refs.player },
|
||||
|
||||
Set, Sound,
|
||||
|
||||
@ -31,30 +30,38 @@ window.aircox = {
|
||||
/**
|
||||
* Initialize main application and player.
|
||||
*/
|
||||
init(props=null, {config=null, builder=null, initBuilder=true,
|
||||
initPlayer=true, hotReload=false, el=null}={})
|
||||
init(props=null, {hotReload=false, el=null,
|
||||
config=null, playerConfig=null,
|
||||
initApp=true, initPlayer=true,
|
||||
loader=null, playerLoader=null}={})
|
||||
{
|
||||
if(initPlayer) {
|
||||
let playerBuilder = this.playerBuilder
|
||||
playerBuilder.mount()
|
||||
playerConfig = playerConfig || PlayerApp
|
||||
playerLoader = playerLoader || new VueLoader(playerConfig)
|
||||
playerLoader.enable(false)
|
||||
this.playerLoader = playerLoader
|
||||
|
||||
document.addEventListener("keyup", e => this.onKeyPress(e), false)
|
||||
}
|
||||
|
||||
if(initBuilder) {
|
||||
builder = builder || this.builder
|
||||
this.builder = builder
|
||||
if(config || window.App)
|
||||
builder.config = config || window.App
|
||||
if(el)
|
||||
builder.config.el = el
|
||||
|
||||
builder.title = document.title
|
||||
builder.mount({props})
|
||||
|
||||
if(hotReload)
|
||||
builder.enableHotReload(hotReload)
|
||||
if(initApp) {
|
||||
config = config || window.App || App
|
||||
config.el = el || config.el
|
||||
loader = loader || new VueLoader({el, props, ...config})
|
||||
loader.enable(hotReload)
|
||||
this.loader = loader
|
||||
}
|
||||
},
|
||||
|
||||
onKeyPress(/*event*/) {
|
||||
/*
|
||||
if(event.key == " ") {
|
||||
this.player.togglePlay()
|
||||
event.stopPropagation()
|
||||
}
|
||||
*/
|
||||
},
|
||||
|
||||
/**
|
||||
* Filter navbar dropdown menu items
|
||||
*/
|
||||
@ -68,5 +75,10 @@ window.aircox = {
|
||||
else
|
||||
for(let item of container.querySelectorAll('a.navbar-item'))
|
||||
item.style.display = null;
|
||||
},
|
||||
|
||||
pickDate(url, date) {
|
||||
url = `${url}?date=${date.id}`
|
||||
this.loader.pageLoad.load(url)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user