1
0
mirror of https://github.com/flarum/core.git synced 2025-10-14 08:24:28 +02:00

Massive JavaScript cleanup

- Use JSX for templates
- Docblock/comment everything
- Mostly passes ESLint (still some work to do)
- Lots of renaming, refactoring, etc.

CSS hasn't been updated yet.
This commit is contained in:
Toby Zerner
2015-07-15 14:00:11 +09:30
parent 4480e0a83f
commit ab6c03c0cc
220 changed files with 9785 additions and 5919 deletions

View File

@@ -1,12 +1,53 @@
/**
* The `Drawer` class controls the page's drawer. The drawer is the area the
* slides out from the left on mobile devices; it contains the header and the
* footer.
*/
export default class Drawer {
constructor() {
// Set up an event handler so that whenever the content area is tapped,
// the drawer will close.
$('.global-content').click(e => {
if (this.isOpen()) {
e.preventDefault();
this.hide();
}
});
}
/**
* Check whether or not the drawer is currently open.
*
* @return {Boolean}
* @public
*/
isOpen() {
return $('body').hasClass('drawer-open');
}
/**
* Hide the drawer.
*
* @public
*/
hide() {
$('body').removeClass('drawer-open');
}
/**
* Show the drawer.
*
* @public
*/
show() {
$('body').addClass('drawer-open');
}
/**
* Toggle the drawer.
*
* @public
*/
toggle() {
$('body').toggleClass('drawer-open');
}