Move help result up if shows

This commit is contained in:
Borys Levytskyi
2015-04-04 22:57:49 +03:00
parent f1aee5be38
commit 232b99a37e

View File

@@ -5,6 +5,11 @@ app.run(function() {
dispatcher.commands({
'help': function() {
var helpResult = document.querySelector('.result .help');
if(helpResult != null) {
moveHelpResultUp(helpResult);
return;
}
return new app.models.HelpResult();
},
'clear': function() {
@@ -23,4 +28,16 @@ app.run(function() {
return app.get('expression').parse(input);
}
});
function moveHelpResultUp(helpResult) {
var container = helpResult.parentNode.parentNode;
if(container.parentNode.firstChild != container) {
var out = container.parentNode;
out.removeChild(container);
out.insertBefore(container, out.firstChild);
}
}
});