EVR.Beam = function(
container, color, width, height, range, alignment, size_relative)
{
EVR.Graphic.call(
this, container, RATIO_HEIGHT, range, alignment, size_relative);
if (!!color && typeof(width) != "undefined")
{
this.set_color(color);
height = height != null ? height : BEAM_HEIGHT_RATIO;
this.set_proportions(width, height);
this.append();
}
}
EVR.Beam.prototype = new EVR.Graphic;
EVR.Beam.prototype.toString = function()
{
return "[object EVR.Beam]";
}
EVR.Prompt = function(
container, text, color, size, background, depth, alignment, offset, spacing,
height)
{
if (!!container)
{
alignment = alignment || ALIGN_CENTER;
height = height || null;
EVR.Graphic.call(this, container, null, null, alignment);
this.set_proportions(1, height);
if (!!offset)
{
this.place(offset[0], offset[1]);
}
this.set_text(text, PROMPT_FONT, color, size);
this.text.css.background = background || "";
this.set_z(depth);
this.css.letterSpacing = spacing || PROMPT_LETTER_SPACING;
}
}
EVR.Prompt.prototype = new EVR.Graphic;
EVR.Prompt.prototype.toString = function()
{
return "[object EVR.Prompt]";
}
EVR.include("emoticon/features/Features.js");
EVR.Emoticon = function(container, range, alignment)
{
var alignment = alignment != null ? alignment : ALIGN_BOTTOM_LEFT;
EVR.Graphic.call(this, container, RATIO_HEIGHT, range, alignment);
this.set_color();
this.set_proportions(1, BEAM_HEIGHT_RATIO);
this.append();
this.features = new EVR.Emoticon.Features(this);
this.set_z(1);
this.shift();
this.element.style.overflow = "visible";
}
EVR.Emoticon.prototype = new EVR.Graphic;
EVR.Emoticon.prototype.draw = function()
{
EVR.Graphic.prototype.draw.call(this);
if (typeof(this.features) != "undefined")
{
this.features.draw();
}
}
EVR.Emoticon.prototype.shift = function()
{
var horizontal_offset = this.get_dimensions(true)[0] * 10;
// var vertical_offset = this.container.ground.get_dimensions(true)[1];
this.place(-horizontal_offset, 0);
}
EVR.Emoticon.prototype.set_color = function(color)
{
color = !!color ? color : EMOTICON_COLOR;
EVR.Graphic.prototype.set_color.call(this, color);
if (!!this.features)
{
this.features.mask.set_color(color);
this.features.guard.set_color(color);
}
}
EVR.Emoticon.prototype.toString = function()
{
return "[object EVR.Emoticon]";
}
EVR.include("emoticon/features/Mask.js");
EVR.include("emoticon/features/Guard.js");
EVR.Emoticon.Features = function(container)
{
EVR.Graphic.call(this, container, null, null, ALIGN_CENTER);
this.set_proportions();
this.set_color(EMOTICON_FEATURE_COLOR);
this.set_opacity(1);
this.append();
this.mask = new EVR.Emoticon.Features.Mask(this);
this.guard = new EVR.Emoticon.Features.Guard(this);
}
EVR.Emoticon.Features.prototype = new EVR.Graphic;
EVR.Emoticon.Features.prototype.set_proportions = function()
{
var ratio = 1 - EMOTICON_PADDING * 2;
EVR.Graphic.prototype.set_proportions.call(this, ratio, ratio);
}
EVR.Emoticon.Features.prototype.shape = function()
{
EVR.Graphic.prototype.shape.call(this);
var width = this.get_dimensions()[0];
var difference = this.container.get_dimensions()[0] - width;
if (difference % 2)
{
this.set_dimensions(width - 1, width - 1);
}
}
EVR.Emoticon.Features.prototype.draw = function()
{
EVR.Graphic.prototype.draw.call(this);
if (typeof(this.mask) != "undefined")
{
this.mask.draw();
this.guard.draw();
}
}
EVR.Emoticon.Features.prototype.toString = function()
{
return "[object EVR.Emoticon.Features]";
}
EVR.Emoticon.Features.Mask = function(container)
{
EVR.Graphic.call(this, container, null, null, ALIGN_TOP);
this.set_color(EMOTICON_COLOR);
this.set_proportions();
this.append();
}
EVR.Emoticon.Features.Mask.prototype = new EVR.Graphic;
EVR.Emoticon.Features.Mask.prototype.shape = function()
{
EVR.Graphic.prototype.shape.call(this);
var dimensions = this.get_dimensions();
var relative = this.container.get_dimensions();
var difference = relative[0] - dimensions[0];
if (difference % 2)
{
this.set_dimensions(dimensions[0] - 1);
}
if (relative[1] && relative[1] <= dimensions[1])
{
this.set_dimensions(null, relative[1] - 1);
}
}
EVR.Emoticon.Features.Mask.prototype.set_proportions = function()
{
var width_ratio = 1 - EMOTICON_FEATURES_WIDTH * 2;
var height_ratio = 1 - EMOTICON_FEATURES_HEIGHT;
EVR.Graphic.prototype.set_proportions.call(this, width_ratio, height_ratio);
}
EVR.Emoticon.Features.Mask.prototype.toString = function()
{
return "[object EVR.Emoticon.Features.Mask]";
}
EVR.Emoticon.Features.Guard = function(container)
{
EVR.Graphic.call(this, container, null, null, ALIGN_CENTER);
this.set_proportions(1, EMOTICON_FEATURES_MARGIN);
this.set_color(EMOTICON_COLOR);
this.element.style.overflow = "hidden";
this.append();
}
EVR.Emoticon.Features.Guard.prototype = new EVR.Graphic;
EVR.Emoticon.Features.Guard.prototype.toString = function()
{
return "[object EVR.Emoticon.Features.Guard]";
}
EVR.History.Parser = function(document)
{
this.document = document;
this.records = [];
this.parse();
}
EVR.History.Parser.prototype.parse = function()
{
var fields = this.document.split(/[\ \n]/);
var entry = [];
for (var ii = 0; ii < fields.length; ii++)
{
entry.push(fields[ii]);
if (entry.length == 3)
{
this.add_record(entry);
entry = [];
}
}
}
EVR.History.Parser.prototype.add_record = function(fields)
{
var record = new EVR.History.Record();
EVR.History.Record.apply(record, fields);
this.records.push(record);
}
EVR.History.Parser.prototype.toString = function()
{
return "[object EVR.History.Parser]";
}