@@ -16,43 +16,41 @@ $( "[data-role='listview']" ).live( "listviewcreate", function() {
16
16
}
17
17
18
18
var wrapper = $ ( "<form>" , { "class" : "ui-listview-filter ui-bar-c" , "role" : "search" } ) ,
19
-
19
+
20
20
search = $ ( "<input>" , {
21
21
placeholder : "Filter results..." ,
22
22
"data-type" : "search"
23
23
} )
24
24
. bind ( "keyup change" , function ( ) {
25
25
var val = this . value . toLowerCase ( ) ,
26
- list_items = list . children ( ) ;
27
- list_items . show ( ) ;
26
+ listItems = list . children ( ) ;
27
+ listItems . show ( ) ;
28
28
if ( val ) {
29
29
// This handles hiding regular rows without the text we search for
30
30
// and any list dividers without regular rows shown under it
31
- var any_in_the_bucket = false ,
31
+ var childItems = false ,
32
32
item ;
33
-
34
- for ( var i = list_items . length ; i >= 0 ; i -- ) {
35
- item = $ ( list_items [ i ] ) ;
33
+
34
+ for ( var i = listItems . length ; i >= 0 ; i -- ) {
35
+ item = $ ( listItems [ i ] ) ;
36
36
if ( item . is ( "li[data-role=list-divider]" ) ) {
37
- if ( ! any_in_the_bucket ) {
37
+ if ( ! childItems ) {
38
38
item . hide ( ) ;
39
39
}
40
40
// New bucket!
41
- any_in_the_bucket = false ;
41
+ childItems = false ;
42
42
} else if ( item . text ( ) . toLowerCase ( ) . indexOf ( val ) === - 1 ) {
43
43
item . hide ( ) ;
44
44
} else {
45
45
// There's a shown item in the bucket
46
- any_in_the_bucket = true ;
46
+ childItems = true ;
47
47
}
48
48
}
49
49
}
50
-
51
- //listview._numberItems();
52
50
} )
53
51
. appendTo ( wrapper )
54
52
. textinput ( ) ;
55
-
53
+
56
54
wrapper . insertBefore ( list ) ;
57
55
} ) ;
58
56
0 commit comments