forked from rishihahs/HackHouston
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstream.js
More file actions
80 lines (66 loc) · 2.08 KB
/
stream.js
File metadata and controls
80 lines (66 loc) · 2.08 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
jQuery(document).ready(function($) {
var all_deps = [ 'PWE',
'Health and Human Services',
'Houston Airport System',
'City Secretary',
'Department of Neighborhoods',
'Library',
'Administration and Regulatory Affairs',
'Finance',
'Parks and Recreation',
'Police',
'Municipal Courts Department',
'Solid Waste Management',
'Fire',
'Planning and Development',
'Mayor Office',
'City Controller' ];
var genre_template = Mustache.compile($.trim($("#genre_template").html()))
,$genre_container = $('#genre_criteria')
$.each(all_deps, function(i, g){
$genre_container.append(genre_template({genre: g}));
});
$.each(master_fees, function(i, m){ m.id = i+1; });
window.mf = MovieFilter(master_fees);
$('#genre_criteria :checkbox').prop('checked', true);
$('#all_genre').on('click', function(e){
$('#genre_criteria :checkbox:gt(0)').prop('checked', $(this).is(':checked'));
mf.filter();
});
});
var MovieFilter = function(data){
var template = Mustache.compile($.trim($("#template").html()));
var view = function(movie){
return template(movie);
};
var callbacks = {
show_search_count: function(result){
$('#total_movies').text(result.length);
},
};
options = {
filter_criteria: {
genre: ['#genre_criteria input:checkbox:gt(0)', 'ResponsibleDepartment']
},
and_filter_on: true,
callbacks: callbacks,
search: {input: '#searchbox'}/*,
streaming: {
data_url: 'data/top_movies_data.json',
stream_after: 1,
batch_size: 50,
before_add: function(data){
var offset = this.data.length;
if (offset == 450) this.clearStreamingTimer();
for(var i = 0, l = data.length; i < l; i++)
data[i].id = offset + i + 1;
},
after_add: function(data){
var percent = (this.data.length - 250)*100/250;
$('#stream_progress').text(percent + '%').attr('style', 'width: '+ percent +'%;');
if (percent == 100) $('#stream_progress').parent().fadeOut(1000);
}
}*/
}
return FilterJS(data, "#movies", view, options);
}