listbox.js 'remove' fix test3-handlers.js outputFilter added, outbound messages echoed to display test3-static.js added client ID to version reply /me commands echoed test3.css color changes git-svn-id: svn://10.0.0.236/trunk@47271 18797224-902f-48f8-a5cc-f745e15eee43
87 lines
1.6 KiB
JavaScript
87 lines
1.6 KiB
JavaScript
function CListBox ()
|
|
{
|
|
|
|
this.listContainer = document.createElement ("html:a");
|
|
this.listContainer.setAttribute ("class", "list");
|
|
|
|
}
|
|
|
|
CListBox.prototype.clear =
|
|
function lbox_clear (e)
|
|
{
|
|
var obj = this.listContainer.firstChild;
|
|
|
|
while (obj)
|
|
{
|
|
this.listContainer.removeChild (obj);
|
|
obj = obj.nextSibling;
|
|
}
|
|
|
|
}
|
|
|
|
CListBox.prototype.clickHandler =
|
|
function lbox_chandler (e)
|
|
{
|
|
var lm = this.listManager;
|
|
|
|
e.target = this;
|
|
if (lm && typeof lm.onClick == "function")
|
|
lm.onClick ({realTarget: this, event: e});
|
|
|
|
}
|
|
|
|
CListBox.prototype.onClick =
|
|
function lbox_chandler (e)
|
|
{
|
|
|
|
dd ("onclick: \n" + dumpObjectTree (e, 1));
|
|
|
|
}
|
|
|
|
CListBox.prototype.add =
|
|
function lbox_add (stuff, tag)
|
|
{
|
|
var option = document.createElement ("html:a");
|
|
option.setAttribute ("class", "list-option");
|
|
|
|
option.appendChild (stuff);
|
|
option.appendChild (document.createElement("html:br"));
|
|
option.onclick = this.clickHandler;
|
|
option.listManager = this;
|
|
option.tag = tag;
|
|
this.listContainer.appendChild (option);
|
|
|
|
}
|
|
|
|
CListBox.prototype.remove =
|
|
function lbox_remove (stuff)
|
|
{
|
|
var option = this.listContainer.firstChild;
|
|
|
|
while (option)
|
|
{
|
|
if (option.firstChild == stuff)
|
|
{
|
|
this.listContainer.removeChild (option);
|
|
return true;
|
|
}
|
|
option = option.nextSibling;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
CListBox.prototype.enumerateElements =
|
|
function lbox_enum (callback)
|
|
{
|
|
var i = 0;
|
|
var current = this.listContainer.firstChild;
|
|
|
|
while (current)
|
|
{
|
|
callback (current, i++);
|
|
current = current.nextSibling;
|
|
}
|
|
|
|
}
|