* FSE quote format is now configurable and random if there are 2:n available
* Remove old 3rd party string-format & replace with string_format.js version * Some fix some bugs with string_format.js padding, width, and number format
This commit is contained in:
@@ -8,6 +8,7 @@ const ViewController = require('../core/view_controller.js').ViewController;
|
||||
const ansi = require('../core/ansi_term.js');
|
||||
const theme = require('../core/theme.js');
|
||||
const getUserName = require('../core/user.js').getUserName;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -99,7 +100,6 @@ function BBSListModule(options) {
|
||||
self.setViewText(MciViewIds.view[mciName], '');
|
||||
});
|
||||
} else {
|
||||
// :TODO: we really need pipe code support for TextView!!
|
||||
const youSubmittedFormat = config.youSubmittedFormat || '{submitter} (You!)';
|
||||
|
||||
Object.keys(SELECTED_MCI_NAME_TO_ENTRY).forEach(mciName => {
|
||||
@@ -107,7 +107,7 @@ function BBSListModule(options) {
|
||||
if(MciViewIds.view[mciName]) {
|
||||
|
||||
if('SelectedBBSSubmitter' == mciName && entry.submitterUserId == self.client.user.userId) {
|
||||
self.setViewText(MciViewIds.view.SelectedBBSSubmitter, youSubmittedFormat.format(entry));
|
||||
self.setViewText(MciViewIds.view.SelectedBBSSubmitter, stringFormat(youSubmittedFormat, entry));
|
||||
} else {
|
||||
self.setViewText(MciViewIds.view[mciName], t);
|
||||
}
|
||||
@@ -120,8 +120,8 @@ function BBSListModule(options) {
|
||||
const listFormat = config.listFormat || '{bbsName}';
|
||||
const focusListFormat = config.focusListFormat || '{bbsName}';
|
||||
|
||||
entriesView.setItems(self.entries.map( e => listFormat.format(e) ) );
|
||||
entriesView.setFocusItems(self.entries.map( e => focusListFormat.format(e) ) );
|
||||
entriesView.setItems(self.entries.map( e => stringFormat(listFormat, e) ) );
|
||||
entriesView.setFocusItems(self.entries.map( e => stringFormat(focusListFormat, e) ) );
|
||||
};
|
||||
|
||||
this.displayBBSList = function(clearScreen, cb) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
'use strict';
|
||||
|
||||
var MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -86,10 +87,10 @@ function ErcClientModule(options) {
|
||||
try {
|
||||
if(data.userName) {
|
||||
// user message
|
||||
text = self.chatEntryFormat.format(data);
|
||||
text = stringFormat(self.chatEntryFormat, data);
|
||||
} else {
|
||||
// system message
|
||||
text = self.systemEntryFormat.format(data);
|
||||
text = stringFormat(self.systemEntryFormat, data);
|
||||
}
|
||||
} catch(e) {
|
||||
return self.client.log.warn( { error : e.message }, 'ERC: chatEntryFormat error');
|
||||
|
||||
@@ -8,6 +8,7 @@ const StatLog = require('../core/stat_log.js');
|
||||
const getUserName = require('../core/user.js').getUserName;
|
||||
const loadProperties = require('../core/user.js').loadProperties;
|
||||
const isRootUserId = require('../core/user.js').isRootUserId;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const moment = require('moment');
|
||||
@@ -123,12 +124,9 @@ LastCallersModule.prototype.mciReady = function(mciData, cb) {
|
||||
);
|
||||
},
|
||||
function populateList(callback) {
|
||||
const listFormat = self.menuConfig.config.listFormat || '{userName} - {location} - {affils} - {ts}';
|
||||
const listFormat = self.menuConfig.config.listFormat || '{userName} - {location} - {affiliation} - {ts}';
|
||||
|
||||
callersView.setItems(_.map(loginHistory, ce => listFormat.format(ce) ) );
|
||||
|
||||
// :TODO: This is a hack until pipe codes are better implemented
|
||||
callersView.focusItems = callersView.items;
|
||||
callersView.setItems(_.map(loginHistory, ce => stringFormat(listFormat, ce) ) );
|
||||
|
||||
callersView.redraw();
|
||||
return callback(null);
|
||||
|
||||
@@ -8,6 +8,7 @@ const messageArea = require('../core/message_area.js');
|
||||
const displayThemeArt = require('../core/theme.js').displayThemeArt;
|
||||
const displayThemedPause = require('../core/theme.js').displayThemedPause;
|
||||
const resetScreen = require('../core/ansi_term.js').resetScreen;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -152,7 +153,7 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
|
||||
const areaListView = vc.getView(MCICodesIDs.AreaList);
|
||||
let i = 1;
|
||||
areaListView.setItems(_.map(self.messageAreas, v => {
|
||||
return listFormat.format({
|
||||
return stringFormat(listFormat, {
|
||||
index : i++,
|
||||
areaTag : v.area.areaTag,
|
||||
name : v.area.name,
|
||||
@@ -162,7 +163,7 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
|
||||
|
||||
i = 1;
|
||||
areaListView.setFocusItems(_.map(self.messageAreas, v => {
|
||||
return focusListFormat.format({
|
||||
return stringFormat(focusListFormat, {
|
||||
index : i++,
|
||||
areaTag : v.area.areaTag,
|
||||
name : v.area.name,
|
||||
|
||||
@@ -122,4 +122,8 @@ AreaViewFSEModule.prototype.restoreSavedState = function(savedState) {
|
||||
this.messageList = savedState.messageList;
|
||||
this.messageIndex = savedState.messageIndex;
|
||||
this.messageTotal = savedState.messageTotal;
|
||||
};
|
||||
};
|
||||
|
||||
AreaViewFSEModule.prototype.getMenuResult = function() {
|
||||
return this.messageIndex;
|
||||
};
|
||||
|
||||
@@ -8,6 +8,7 @@ const messageArea = require('../core/message_area.js');
|
||||
const displayThemeArt = require('../core/theme.js').displayThemeArt;
|
||||
const displayThemedPause = require('../core/theme.js').displayThemedPause;
|
||||
const resetScreen = require('../core/ansi_term.js').resetScreen;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -121,7 +122,7 @@ MessageConfListModule.prototype.mciReady = function(mciData, cb) {
|
||||
const confListView = vc.getView(MCICodeIDs.ConfList);
|
||||
let i = 1;
|
||||
confListView.setItems(_.map(self.messageConfs, v => {
|
||||
return listFormat.format({
|
||||
return stringFormat(listFormat, {
|
||||
index : i++,
|
||||
confTag : v.conf.confTag,
|
||||
name : v.conf.name,
|
||||
@@ -131,7 +132,7 @@ MessageConfListModule.prototype.mciReady = function(mciData, cb) {
|
||||
|
||||
i = 1;
|
||||
confListView.setFocusItems(_.map(self.messageConfs, v => {
|
||||
return focusListFormat.format({
|
||||
return stringFormat(focusListFormat, {
|
||||
index : i++,
|
||||
confTag : v.conf.confTag,
|
||||
name : v.conf.name,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
const ViewController = require('../core/view_controller.js').ViewController;
|
||||
const messageArea = require('../core/message_area.js');
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -209,11 +210,11 @@ MessageListModule.prototype.mciReady = function(mciData, cb) {
|
||||
// which items are requested (e.g. their format at least) *as-needed* vs trying to get the format for all of them at once
|
||||
|
||||
msgListView.setItems(_.map(self.messageList, listEntry => {
|
||||
return listFormat.format(listEntry);
|
||||
return stringFormat(listFormat, listEntry);
|
||||
}));
|
||||
|
||||
msgListView.setFocusItems(_.map(self.messageList, listEntry => {
|
||||
return focusListFormat.format(listEntry);
|
||||
return stringFormat(focusListFormat, listEntry);
|
||||
}));
|
||||
|
||||
msgListView.on('index update', function indexUpdated(idx) {
|
||||
|
||||
@@ -154,7 +154,6 @@ function OnelinerzModule(options) {
|
||||
} );
|
||||
}));
|
||||
|
||||
entriesView.focusItems = entriesView.items; // :TODO: this is a hack
|
||||
entriesView.redraw();
|
||||
|
||||
return callback(null);
|
||||
|
||||
@@ -8,6 +8,7 @@ const theme = require('../core/theme.js');
|
||||
const resetScreen = require('../core/ansi_term.js').resetScreen;
|
||||
const StatLog = require('../core/stat_log.js');
|
||||
const renderStringLength = require('../core/string_util.js').renderStringLength;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -158,8 +159,8 @@ exports.getModule = class RumorzModule extends MenuModule {
|
||||
const listFormat = config.listFormat || '{rumor}';
|
||||
const focusListFormat = config.focusListFormat || listFormat;
|
||||
|
||||
entriesView.setItems(entries.map( e => listFormat.format( { rumor : e.log_value } ) ) );
|
||||
entriesView.setFocusItems(entries.map(e => focusListFormat.format( { rumor : e.log_value } ) ) );
|
||||
entriesView.setItems(entries.map( e => stringFormat(listFormat, { rumor : e.log_value } ) ) );
|
||||
entriesView.setFocusItems(entries.map(e => stringFormat(focusListFormat, { rumor : e.log_value } ) ) );
|
||||
entriesView.redraw();
|
||||
|
||||
return callback(null);
|
||||
|
||||
Binary file not shown.
@@ -5,10 +5,10 @@ var MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
//var userDb = require('../core/database.js').dbs.user;
|
||||
var getUserList = require('../core/user.js').getUserList;
|
||||
var ViewController = require('../core/view_controller.js').ViewController;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
var moment = require('moment');
|
||||
var async = require('async');
|
||||
var assert = require('assert');
|
||||
var _ = require('lodash');
|
||||
|
||||
/*
|
||||
@@ -92,11 +92,11 @@ UserListModule.prototype.mciReady = function(mciData, cb) {
|
||||
}
|
||||
|
||||
userListView.setItems(_.map(userList, function formatUserEntry(ue) {
|
||||
return listFormat.format(getUserFmtObj(ue));
|
||||
return stringFormat(listFormat, getUserFmtObj(ue));
|
||||
}));
|
||||
|
||||
userListView.setFocusItems(_.map(userList, function formatUserEntry(ue) {
|
||||
return focusListFormat.format(getUserFmtObj(ue));
|
||||
return stringFormat(focusListFormat, getUserFmtObj(ue));
|
||||
}));
|
||||
|
||||
userListView.redraw();
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
const MenuModule = require('../core/menu_module.js').MenuModule;
|
||||
const ViewController = require('../core/view_controller.js').ViewController;
|
||||
const getActiveNodeList = require('../core/client_connections.js').getActiveNodeList;
|
||||
const stringFormat = require('../core/string_format.js');
|
||||
|
||||
// deps
|
||||
const async = require('async');
|
||||
@@ -63,7 +64,7 @@ WhosOnlineModule.prototype.mciReady = function(mciData, cb) {
|
||||
});
|
||||
oe.userName = nonAuthUser;
|
||||
}
|
||||
return listFormat.format(oe);
|
||||
return stringFormat(listFormat, oe);
|
||||
}));
|
||||
|
||||
onlineListView.focusItems = onlineListView.items;
|
||||
|
||||
Reference in New Issue
Block a user