-
-
Notifications
You must be signed in to change notification settings - Fork 841
/
Copy pathboot.js
38 lines (29 loc) · 1.24 KB
/
boot.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import ScrollListener from 'flarum/utils/scroll-listener';
import mapRoutes from 'flarum/utils/map-routes';
import BackButton from 'flarum/components/back-button';
import HeaderPrimary from 'flarum/components/header-primary';
import HeaderSecondary from 'flarum/components/header-secondary';
import Modal from 'flarum/components/modal';
import Alerts from 'flarum/components/alerts';
import AdminNav from 'flarum/components/admin-nav';
export default function(app) {
var id = id => document.getElementById(id);
app.history = {
back: function() {
window.location = 'http://flarum.dev';
},
canGoBack: function() {
return true;
}
};
m.mount(id('back-control'), BackButton.component({ className: 'back-control', drawer: true }));
m.mount(id('back-button'), BackButton.component());
m.mount(id('header-primary'), HeaderPrimary.component());
m.mount(id('header-secondary'), HeaderSecondary.component());
m.mount(id('admin-nav'), AdminNav.component());
app.modal = m.mount(id('modal'), Modal.component());
app.alerts = m.mount(id('alerts'), Alerts.component());
m.route.mode = 'hash';
m.route(id('content'), '/', mapRoutes(app.routes));
new ScrollListener(top => $('body').toggleClass('scrolled', top > 0)).start();
}