June 7, 2018♦
EVR.History.View.Level.Heading = function(cell, level)
{
this.cell = cell;
this.level = level;
this.root = level.view.container.location;
this.size_relative = level.field;
this.fill();
}
EVR.History.View.Level.Heading.prototype.fill = function()
{
var cell = this.cell;
var id = this.level.id;
var name = this.get_level_name(id);
var style = cell.style;
style.background = this.select_color(id - 1);
style.fontWeight = HISTORY_LEVEL_NAME_FONT_WEIGHT;
style.fontStyle = HISTORY_LEVEL_NAME_FONT_STYLE;
style.letterSpacing = HISTORY_LEVEL_NAME_LETTER_SPACING;
style.border = HISTORY_LEVEL_NAME_BORDER;
style.padding = HISTORY_CELL_PADDING;
var font = HISTORY_FONT;
var color = HISTORY_LEVEL_NAME_FONT_COLOR;
var size = HISTORY_LEVEL_NAME_FONT_SIZE;
this.text = new EVR.Text(cell, name, font, color, size, this.size_relative);
}
EVR.History.View.Level.Heading.prototype.get_level_name = function(level)
{
var path = this.root + "/view/level/fetch_level_name.php";
var query = "id=" + level;
return new EVR.Requester(path, query, true).execute().toUpperCase();
}
EVR.History.View.Level.Heading.prototype.select_color = function(ii)
{
var palette = HISTORY_HEADING_PALETTE;
return palette[ii % palette.length];
}
EVR.History.View.Level.Heading.prototype.draw = function()
{
this.text.set_font_size();
}
EVR.History.View.Level.Heading.prototype.toString = function()
{
return "[object EVR.History.View.Level.Heading]";
}
EVR.include("history/view/level/Heading.js");
EVR.include("history/view/level/mode/Mode.js");
EVR.History.View.Level = function(view)
{
this.view = view;
this.record_index = view.record_index;
this.field = view.container.container;
this.records = view.records;
this.id = view.records[this.record_index].level;
this.modes = [];
this.add();
}
EVR.History.View.Level.prototype.add = function()
{
this.append_heading();
this.append_mode(HISTORY_TIME_TRIALS_HEADING);
}
EVR.History.View.Level.prototype.append_heading = function()
{
var view = this.view;
var row = view.insert_row();
var cell = view.insert_cell(row);
cell.colSpan = view.cell_count;
this.heading = new EVR.History.View.Level.Heading(cell, this);
}
EVR.History.View.Level.prototype.append_mode = function(heading)
{
var view = this.view;
this.modes.push(new EVR.History.View.Level.Mode(this, heading));
}
EVR.History.View.Level.prototype.draw = function()
{
var modes = this.modes;
this.heading.draw();
for (var ii = 0; ii < modes.length; ii++)
{
modes[ii].draw();
}
}
EVR.History.View.Level.prototype.toString = function()
{
return "[object EVR.History.View.Level]";
}
<?php
define("PATH", "../../../../../../../users/level_ids");
$levels = file(PATH, FILE_IGNORE_NEW_LINES);
$id = $_GET["id"] - 1;
$fields = explode("|", $levels[$id]);
echo $fields[1];
EVR.History.View.Level.Mode.Separator = function(row, count)
{
this.row = row;
this.count = count;
this.add();
}
EVR.History.View.Level.Mode.Separator.prototype.add = function()
{
var cell, style, row = this.row;
for (var ii = 0; ii < this.count; ii++)
{
cell = row.insertCell(-1);
style = cell.style;
style.border = HISTORY_SEPARATOR_BORDER;
style.background = this.select_color(ii);
style.padding = HISTORY_CELL_PADDING + " 0";
style.fontSize = "0px";
cell.innerHTML = " ";
}
}
EVR.History.View.Level.Mode.Separator.prototype.select_color = function(ii)
{
var palette = HISTORY_SEPARATOR_PALETTE;
return palette[ii % palette.length];
}
EVR.History.View.Level.Mode.Separator.prototype.toString = function()
{
return "[object EVR.History.View.Level.Mode.Separator]";
}
EVR.include("history/view/level/mode/Separator.js");
EVR.include("history/view/level/mode/Time.js");
EVR.History.View.Level.Mode = function(level, heading)
{
this.level = level;
this.view = level.view;
this.heading = heading;
this.cell_count = level.view.cell_count;
this.size_relative = level.field;
this.record_index = level.record_index;
this.times = [];
this.fill();
}
EVR.History.View.Level.Mode.prototype.fill = function()
{
this.append_separator();
this.append_heading();
this.append_separator();
this.append_times();
}
EVR.History.View.Level.Mode.prototype.append_separator = function()
{
var row = this.view.insert_row();
new EVR.History.View.Level.Mode.Separator(row, this.cell_count);
}
EVR.History.View.Level.Mode.prototype.append_heading = function()
{
var row = this.view.insert_row();
var cell = row.insertCell(-1);
var style = cell.style;
cell.colSpan = this.cell_count;
style.fontStyle = HISTORY_MODE_FONT_STYLE;
style.letterSpacing = HISTORY_MODE_LETTER_SPACING;
style.padding = 0;
var size = HISTORY_MODE_FONT_SIZE;
var font = HISTORY_FONT;
var text = this.heading;
this.text = new EVR.Text(cell, text, font, null, size, this.size_relative);
}
EVR.History.View.Level.Mode.prototype.append_times = function()
{
var view = this.view;
var records = view.records;
var rows = this.add_rows();
var row, record, time;
for (var ii = 0; ii < HISTORY_RECORD_LIMIT; ii++)
{
if (ii < 3)
{
row = rows[ii];
}
else
{
row = rows[ii % 3 + 3];
if (ii > 5)
{
row.insertCell(-1).colSpan = 2;
}
}
time = null;
if (this.record_index < records.length)
{
record = records[this.record_index];
if (record.level == this.level.id)
{
time = record.time;
}
}
this.times.push(
new EVR.History.View.Level.Mode.Time(
row, time, ii, this.size_relative));
this.record_index++;
}
}
EVR.History.View.Level.Mode.prototype.add_rows = function()
{
var view = this.view;
var rows = [];
for (var ii = 0; ii < 6; ii++)
{
rows.push(view.insert_row());
}
return rows;
}
EVR.History.View.Level.Mode.prototype.draw = function()
{
this.text.set_font_size();
var times = this.times;
for (var ii = 0; ii < times.length; ii++)
{
times[ii].draw();
}
}
EVR.History.View.Level.Mode.prototype.toString = function()
{
return "[object EVR.History.View.Level.Mode]";
}