* Add rumorz mod

* ANSI/pipe working properly in VerticalMenuView
* Fix bug in renderStringLength()
* Make initSequence() part of prototype chain for inheritance
* Use proper 'desc' field vs 'status' for menus when setting client/user status
* Move pipeToAnsi() to setItems/setFocusItems vs every render
* Add %RR random rumor MCI
* Predefined MCI's can be init @ startup - RR uses random as a test bed
* Add some StatLog functionality for ordering, keep forever, etc.
* Fix TextView redraw issue
* Better VerticalMenuView drawItem() logic
* Add 'key press' emit for View
* Enable formats for BBS list - works with MCI
* Remove old system_property.js
This commit is contained in:
Bryan Ashby 2016-08-10 22:48:13 -06:00
parent 2b68201f7d
commit 30ba609fb4
13 changed files with 492 additions and 241 deletions

View file

@ -4,6 +4,7 @@
// ENiGMA½
const View = require('./view.js').View;
const miscUtil = require('./misc_util.js');
const pipeToAnsi = require('./color_codes.js').pipeToAnsi;
// deps
const util = require('util');
@ -15,9 +16,11 @@ exports.MenuView = MenuView;
function MenuView(options) {
options.acceptsFocus = miscUtil.valueWithDefault(options.acceptsFocus, true);
options.acceptsInput = miscUtil.valueWithDefault(options.acceptsInput, true);
View.call(this, options);
this.disablePipe = options.disablePipe || false;
const self = this;
if(options.items) {
@ -60,10 +63,16 @@ function MenuView(options) {
util.inherits(MenuView, View);
MenuView.prototype.setItems = function(items) {
const self = this;
if(items) {
this.items = [];
items.forEach( itemText => {
this.items.push( { text : itemText } );
this.items.push(
{
text : self.disablePipe ? itemText : pipeToAnsi(itemText, self.client)
}
);
});
}
};
@ -110,10 +119,16 @@ MenuView.prototype.onKeyPress = function(ch, key) {
};
MenuView.prototype.setFocusItems = function(items) {
const self = this;
if(items) {
this.focusItems = [];
items.forEach( itemText => {
this.focusItems.push( { text : itemText } );
this.focusItems.push(
{
text : self.disablePipe ? itemText : pipeToAnsi(itemText, self.client)
}
);
});
}
};