Simple fixes

This commit is contained in:
RainLoop Team 2016-08-30 23:24:02 +03:00
parent b28d4f8cf3
commit 9e38a59df3
4 changed files with 46 additions and 8 deletions

View file

@ -40,11 +40,40 @@ function cmdHelp(cmds) {
return require('Html/Cmds/Help.html').replace('{{ commands }}', cmds.join(' '));
}
/**
* @returns {void}
*/
function initGlass() {
let state = null;
try {
if (window.localStorage && window.localStorage.setItem)
{
state = '1' === '' + window.localStorage.getItem('rl-labs-glass');
}
}
catch (e) {} // eslint-disable-line no-empty
if (null !== state)
{
$html.toggleClass('glass', !!state);
}
}
/**
* @returns {string}
*/
function cmdGlass() {
$html.toggleClass('glass', !$html.hasClass('glass'));
const state = !$html.hasClass('glass');
try {
if (window.localStorage && window.localStorage.setItem)
{
window.localStorage.setItem('rl-labs-glass', state ? '1' : '0');
}
}
catch (e) {} // eslint-disable-line no-empty
$html.toggleClass('glass', state);
return '';
}
@ -199,8 +228,8 @@ class CmdContoller
onCmd(isTab) {
const
cmdLine = trim(this.cmd()).replace(/[\s]+/, ' '),
cmdParts = cmdLine.replace().split(/[\s]+/),
cmdLine = this.cmd().replace(/[\s]+/, ' '),
cmdParts = trim(cmdLine).replace().split(/[\s]+/),
cmd = cmdParts.shift();
if (isTab)
@ -348,3 +377,6 @@ export function toggle()
}, 50);
}
}
// init
initGlass();