mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-12 23:54:38 +02:00
Code cleanup (minor)
This commit is contained in:
parent
485711b5da
commit
2bd548d284
1 changed files with 14 additions and 9 deletions
|
@ -7,7 +7,6 @@ var strUtil = require('./string_util.js');
|
||||||
var ansi = require('./ansi_term.js');
|
var ansi = require('./ansi_term.js');
|
||||||
|
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
var assert = require('assert');
|
|
||||||
var _ = require('lodash');
|
var _ = require('lodash');
|
||||||
|
|
||||||
exports.TextView = TextView;
|
exports.TextView = TextView;
|
||||||
|
@ -51,6 +50,8 @@ function TextView(options) {
|
||||||
var textToDraw = _.isString(this.textMaskChar) ?
|
var textToDraw = _.isString(this.textMaskChar) ?
|
||||||
new Array(s.length + 1).join(this.textMaskChar) :
|
new Array(s.length + 1).join(this.textMaskChar) :
|
||||||
strUtil.stylizeString(s, this.hasFocus ? this.focusTextStyle : this.textStyle);
|
strUtil.stylizeString(s, this.hasFocus ? this.focusTextStyle : this.textStyle);
|
||||||
|
|
||||||
|
// :TODO: Add pipe code support
|
||||||
|
|
||||||
if(textToDraw.length > this.dimens.width) {
|
if(textToDraw.length > this.dimens.width) {
|
||||||
// XXXXXXXXXXXXXXXXX
|
// XXXXXXXXXXXXXXXXX
|
||||||
|
@ -117,6 +118,10 @@ TextView.prototype.getData = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
TextView.prototype.setText = function(text) {
|
TextView.prototype.setText = function(text) {
|
||||||
|
if(!_.isString(text)) {
|
||||||
|
text = text.toString();
|
||||||
|
}
|
||||||
|
|
||||||
var widthDelta = 0;
|
var widthDelta = 0;
|
||||||
if(this.text && this.text !== text) {
|
if(this.text && this.text !== text) {
|
||||||
widthDelta = Math.abs(this.text.length - text.length);
|
widthDelta = Math.abs(this.text.length - text.length);
|
||||||
|
@ -148,14 +153,14 @@ TextView.prototype.clearText = function() {
|
||||||
|
|
||||||
TextView.prototype.setPropertyValue = function(propName, value) {
|
TextView.prototype.setPropertyValue = function(propName, value) {
|
||||||
switch(propName) {
|
switch(propName) {
|
||||||
case 'textMaskChar' : this.textMaskChar = value.substr(0, 1); break;
|
case 'textMaskChar' : this.textMaskChar = value.substr(0, 1); break;
|
||||||
case 'textOverflow' : this.textOverflow = value; break;
|
case 'textOverflow' : this.textOverflow = value; break;
|
||||||
case 'maxLength' : this.maxLength = parseInt(value, 10); break;
|
case 'maxLength' : this.maxLength = parseInt(value, 10); break;
|
||||||
case 'password' :
|
case 'password' :
|
||||||
if(true === value) {
|
if(true === value) {
|
||||||
this.textMaskChar = this.client.currentTheme.helpers.getPasswordChar();
|
this.textMaskChar = this.client.currentTheme.helpers.getPasswordChar();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView.super_.prototype.setPropertyValue.call(this, propName, value);
|
TextView.super_.prototype.setPropertyValue.call(this, propName, value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue