|
|
@ -1,5 +1,36 @@
|
|
|
|
var search = {}
|
|
|
|
var search = {}
|
|
|
|
search.find = function(id,_domid){
|
|
|
|
search.find = function(id,_domid,_attr){
|
|
|
|
|
|
|
|
var nodes = jx.dom.get.children(id)
|
|
|
|
|
|
|
|
jx.dom.set.focus(_domid)
|
|
|
|
|
|
|
|
var term = jx.dom.get.value(_domid).trim()
|
|
|
|
|
|
|
|
term = term == ''?'*':term
|
|
|
|
|
|
|
|
if (term.length < 2){
|
|
|
|
|
|
|
|
$(nodes).show()
|
|
|
|
|
|
|
|
jx.dom.set.value('found',nodes.length)
|
|
|
|
|
|
|
|
return ;}
|
|
|
|
|
|
|
|
$(nodes).hide()
|
|
|
|
|
|
|
|
term = RegExp(term.replace(/ /,'|'),'ig')
|
|
|
|
|
|
|
|
_count = 0
|
|
|
|
|
|
|
|
jx.utils.patterns.visitor (nodes,function(_node){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _data = _node.getAttribute('data') ;
|
|
|
|
|
|
|
|
if (_data[0] == '{' || _data[0] == '['){
|
|
|
|
|
|
|
|
_data = JSON.parse(_data)
|
|
|
|
|
|
|
|
_found = 0
|
|
|
|
|
|
|
|
_attr.forEach(function(_name){
|
|
|
|
|
|
|
|
_found += _data[_name].match(term) !=null?1:0
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
_found = _data.match(term)!=null?1:0
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
_count += _found
|
|
|
|
|
|
|
|
if (_found > 0){
|
|
|
|
|
|
|
|
$(_node).show()
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
jx.dom.set.value('found',_count)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
search._find = function(id,_domid){
|
|
|
|
var nodes = jx.dom.get.children(id)
|
|
|
|
var nodes = jx.dom.get.children(id)
|
|
|
|
$(nodes).hide()
|
|
|
|
$(nodes).hide()
|
|
|
|
jx.dom.set.focus(_domid)
|
|
|
|
jx.dom.set.focus(_domid)
|
|
|
@ -51,3 +82,4 @@ search.find = function(id,_domid){
|
|
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|