This repository was archived by the owner on Mar 16, 2022. It is now read-only.
Commit 642ba8d 1 parent 1cef786 commit 642ba8d Copy full SHA for 642ba8d
File tree 2 files changed +10
-12
lines changed
2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -3,16 +3,16 @@ module.exports = {
3
3
setOptions : setOptions
4
4
}
5
5
6
- var opt = { }
7
- opt . templatePattern = / \{ ( .* ?) \} / g
6
+ var options = { }
7
+ options . templatePattern = / \{ ( .* ?) \} / g
8
8
9
- function setOptions ( _opt ) {
10
- opt = _opt || { }
11
- opt . templatePattern = _opt . templatePattern || / \{ ( .* ?) \} / g
9
+ function setOptions ( _options ) {
10
+ options = _options || { }
11
+ options . templatePattern = _options . templatePattern || / \{ ( .* ?) \} / g
12
12
}
13
13
14
- function compile ( t , data ) {
15
- return t . replace ( opt . templatePattern , function ( match , prop ) {
14
+ function compile ( template , data ) {
15
+ return template . replace ( options . templatePattern , function ( match , prop ) {
16
16
return data [ prop ] || match
17
17
} )
18
18
}
Original file line number Diff line number Diff line change 72
72
73
73
function registerInput ( ) {
74
74
options . searchInput . addEventListener ( 'keyup' , function ( e ) {
75
- if ( e . target . value . length == 0 ) {
76
- emptyResultsContainer ( )
77
- return
75
+ emptyResultsContainer ( )
76
+ if ( e . target . value . length > 0 ) {
77
+ render ( repository . search ( e . target . value ) )
78
78
}
79
- render ( repository . search ( e . target . value ) )
80
79
} )
81
80
}
82
81
83
82
function render ( results ) {
84
- emptyResultsContainer ( )
85
83
if ( results . length == 0 ) {
86
84
return appendToResultsContainer ( options . noResultsText )
87
85
}
You can’t perform that action at this time.
0 commit comments