[rhmessaging-commits] rhmessaging commits: r3879 - mgmt/trunk/cumin/resources.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Tue Mar 23 14:32:07 EDT 2010
Author: eallen
Date: 2010-03-23 14:32:07 -0400 (Tue, 23 Mar 2010)
New Revision: 3879
Modified:
mgmt/trunk/cumin/resources/incrementalSearch.js
Log:
More changes from the original to use mootools library
Size the autocomplete list to match the associated edit box width
Modified: mgmt/trunk/cumin/resources/incrementalSearch.js
===================================================================
--- mgmt/trunk/cumin/resources/incrementalSearch.js 2010-03-23 18:29:24 UTC (rev 3878)
+++ mgmt/trunk/cumin/resources/incrementalSearch.js 2010-03-23 18:32:07 UTC (rev 3879)
@@ -29,15 +29,16 @@
};
p.show = function(){
- for(var thisObject = this, s = thisObject.c.style, o = thisObject.input, x = o.offsetLeft,
- y = o.offsetTop + o.offsetHeight; o = o.offsetParent; x += o.offsetLeft, y += o.offsetTop);
- s.left = x + "px", s.top = y + "px",
+ var i = $(this.input), s = $(this.c);
+ var iSize = i.getSize(), iPos = i.getPosition();
+ var sPos = iPos; sPos.y = iPos.y + iSize.y;
+ s.setPosition(sPos); s.setStyle('width', iSize.x);
+ var thisObject = this, s = thisObject.c.style;
thisObject.l.length ? (s.display = "block", !thisObject.visible && (thisObject._callEvent("onshow"), ++thisObject.visible), thisObject.highlite(0)) : s.display = "none";
};
p.hide = function(){
var thisObject = this, d = document, s = (thisObject.c && thisObject.c.parentNode.removeChild(thisObject.c),
thisObject.c = d.body.appendChild(d.createElement("div"))).style;
- //thisObject.c.width = thisObject.input.offsetwidth + "px";
thisObject.l = [], thisObject.i = -1, thisObject.c.className = thisObject.className, s.position = "absolute", s.display = "none";
thisObject._old = null, thisObject.visible && (thisObject._callEvent("onhide"), --thisObject.visible);
};
@@ -77,6 +78,7 @@
};
p._fadeOut = function(){
var f = (f = function(){arguments.callee.x.hide();}, f.x = this, setTimeout(f, 200));
+ this.select();
};
p._handler = function(e){
var thisObject = this, t = e.type, k = e.key;
@@ -94,29 +96,13 @@
return thisObject[e] instanceof Function ? thisObject[e].apply(thisObject, [].slice.call(arguments, 1)) : undefined;
};
}
-//-- Searches for multiple matches ----
-function Inc_CIAnywhere(o, search){
- if(search = search.toLowerCase()) {
- var ul = $(o.listObjectID);
- var list = ul.getElements("li");
- for(var i = -1, l = list.length; ++i < l;){
- /*searches all the matches of "search" and adds the indexes in an array */
- for(var j = 0, indices = []; j = list[i].firstChild.nodeValue.toLowerCase().indexOf(search, j) + 1;
- indices[indices.length] = j - 1);
- /*if any ocurrence was found, adds the item and pass the position of the matches*/
- if(indices.length)
- o.add(list[i].firstChild.nodeValue, indices);
- }
- }
- o.show();
-}
function Inc_CIBeginning(o, search) {
if (search = search.toLowerCase()) {
- var ul = $(o.listObjectID);
- var list = ul.getElements("li");
- for(var i = -1, l = list.length; ++i < l;)
- if( list[i].firstChild.nodeValue.toLowerCase().indexOf(search) == 0)
- o.add(list[i].firstChild.nodeValue, 0);
+ var select = $(o.listObjectID);
+ for (var i = 0, l = select.options.length; i < l; ++i) {
+ if (select.options[i].text.toLowerCase().indexOf(search) == 0)
+ o.add(select.options[i].text, 0, select.options[i].value);
+ }
}
if ((o.l.length == 0) && (search.length > 0)) {
o.add("No Matches", -1);
More information about the rhmessaging-commits
mailing list