Completed
Push — master ( 95de79...31de30 )
by Askupa
02:40
created

assets/js/_search.js   B

Complexity

Conditions 1
Paths 2

Size

Total Lines 27

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 2
nop 0
dl 0
loc 27
rs 8.8571
c 1
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A $(ꞌ#settings-searchꞌ).keyup 0 23 3
1
(function(){
2
    var $fields = $('.amarkal-settings-field');
3
    
4
    $('#settings-search').on('keyup',function(e){
0 ignored issues
show
Unused Code introduced by
The parameter e is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
5
        var query    = $(this).val().toLowerCase(),
6
            matches  = [];
7
            
8
        if(query.length > 1) {
9
            $fields.hide().each(function(){
10
                var $field = $(this),
11
                    title  = $field.attr('data-title').toLowerCase();
12
                    
13
                if(title.match(query)){
14
                    matches.push($field);
15
                }
16
            });
17
            
18
            $(matches).map(function(){return this.toArray();}).show();
19
            
20
            $('#settings-search-results').text(matches.length ? matches.length+' settings found' : 'Nothing found');
21
        }
22
        else {
23
            $fields.show();
24
            $('#settings-search-results').text('');
25
        }
26
    });
27
})();