mirror of
https://github.com/liriliri/eruda.git
synced 2026-04-05 10:28:34 +08:00
Dev: Refactoring
This commit is contained in:
@@ -5,11 +5,6 @@ import config from '../lib/config.es6'
|
||||
|
||||
require('./DevTools.scss');
|
||||
|
||||
function activeEruda(flag)
|
||||
{
|
||||
window.localStorage.setItem('active-eruda', flag);
|
||||
}
|
||||
|
||||
export default class DevTools extends util.Emitter
|
||||
{
|
||||
constructor($parent)
|
||||
@@ -147,9 +142,7 @@ export default class DevTools extends util.Emitter
|
||||
}
|
||||
_setHalfScreen(flag)
|
||||
{
|
||||
this._$el.css({
|
||||
height: flag ? '50%': '100%'
|
||||
});
|
||||
this._$el.css({height: flag ? '50%': '100%'});
|
||||
}
|
||||
_appendTpl()
|
||||
{
|
||||
@@ -163,9 +156,9 @@ export default class DevTools extends util.Emitter
|
||||
_initNavBar()
|
||||
{
|
||||
this._navBar = new NavBar(this._$el.find('.eruda-nav-bar ul'));
|
||||
this._navBar.on('showTool', (name) =>
|
||||
{
|
||||
this.showTool(name);
|
||||
});
|
||||
this._navBar.on('showTool', name => this.showTool(name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var activeEruda = flag => window.localStorage.setItem('active-eruda', flag);
|
||||
|
||||
|
||||
@@ -36,16 +36,14 @@ export default class NavBar extends util.Emitter
|
||||
{
|
||||
var $this = util.$(this);
|
||||
|
||||
$this.text() === name ? $this.addClass('eruda-active') : $this.rmClass('eruda-active');
|
||||
$this[$this.text() === name ? 'addClass' : 'rmClass']('eruda-active');
|
||||
});
|
||||
}
|
||||
_bindEvent()
|
||||
{
|
||||
var $el = this._$el;
|
||||
|
||||
var self = this;
|
||||
|
||||
$el.on('click', 'li', function ()
|
||||
this._$el.on('click', 'li', function ()
|
||||
{
|
||||
self.emit('showTool', util.$(this).text());
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user