You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
/**
|
|
|
|
* @param rec associative array
|
|
|
|
*/
|
|
|
|
jx.utils.keys=function(rec){
|
|
|
|
var keys = [] ;
|
|
|
|
for(var id in rec){
|
|
|
|
|
|
|
|
keys.push(id) ;
|
|
|
|
}
|
|
|
|
return keys ;
|
|
|
|
}//-- end jx.utils.keys
|
|
|
|
/**
|
|
|
|
* This function will returnt he unique elements of a list
|
|
|
|
* @param list list of elements (duplicates are expected)
|
|
|
|
*/
|
|
|
|
jx.utils.unique = function (list){
|
|
|
|
var obj = {}
|
|
|
|
for(var i=0; i < list.length; i++){
|
|
|
|
obj[list[i]]= 1 ;
|
|
|
|
}
|
|
|
|
return jx.utils.keys(obj);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Implementation of a few standard design patterns. Their use is user/dependent
|
|
|
|
* For more information on how/when to use a design pattern please use google/wikipedia ;-)
|
|
|
|
*/
|
|
|
|
lattr = attrib;
|
|
|
|
}else{
|
|
|
|
lattr = [attrib] ;
|
|
|
|
}
|
|
|
|
|
|
|
|
regex = keywords.toLowerCase();
|
|
|
|
ldoms = jx.dom.get.children(id) ;
|
|
|
|
//ldoms.push(document.getElementById(id)) ;
|
|
|
|
var imatch = function(_dom){
|
|
|
|
obj = null;
|
|
|
|
for(var j=0; j < lattr.length; j++){
|
|
|
|
id = lattr[j] ;
|
|
|
|
str = _dom[id] ;
|
|
|
|
str = (str != null)?str.toLowerCase():str;
|
|
|
|
if(str == null){
|
|
|
|
continue;
|
|
|
|
}else if(str.match(regex) != null){
|
|
|
|
obj = _dom.cloneNode(true) ;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
lmatches = jx.utils.patterns.visitor(ldoms,imatch)
|
|
|
|
return lmatches ;
|
|
|
|
}
|