-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
36 lines (32 loc) · 921 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var Irxground
;(function(module) {
var starred;
var starredFilter = "";
function bindStarred() {
function apply(repos) {
var root = $("#starred_items");
root.empty();
$("#starred_template").tmpl(repos).appendTo(root);
}
var words = _.map(starredFilter.split(' '), function(s){
return s.toLowerCase();
});
var filtered = _.filter(starred, function(repo){
var search = (repo.full_name + repo.description).toLowerCase();
return _.all(words, function(word) { return search.indexOf(word) >= 0; });
});
apply(filtered);
};
$(document).ready(function(){
bindStarred();
$("#starred_search").keyup(function(event) {
if (starredFilter != this.value) {
starredFilter = this.value;
bindStarred();
}
});
});
module.setStarred = function(model) {
starred = model.data;
};
})(Irxground || (Irxground = {}));