-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
executable file
·307 lines (289 loc) · 13.7 KB
/
index.html
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="../../favicon.ico">
<title>Yelp Group 3</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"
integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/bootstrap/latest/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.css">
<link href="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/css/select2.min.css" rel="stylesheet" />
<!-- Custom styles for this template -->
<link href="dashboard.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Visualize Potential News Using Yelp Reviews</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<!--<ul class="nav navbar-nav navbar-right">-->
<!--<li><a href="#">Dashboard</a></li>-->
<!--<li><a href="#">Settings</a></li>-->
<!--<li><a href="#">Profile</a></li>-->
<!--<li><a href="#">Help</a></li>-->
<!--</ul>-->
<!--<div id="search-box">-->
<!--<form class="navbar-form navbar-right">-->
<!--<input type="text" class="form-control" placeholder="Search...">-->
<!--</form>-->
<!--</div>-->
<div id="business-time">
<form class="navbar-form navbar-right">
<!--<input type="text" class="form-control" name="datefilter" placeholder="01/01/2004-12/31/2014">-->
<div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; border: 1px solid #ccc; width: 100%">
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
<span></span> <b class="caret"></b>
</div>
</form>
</div>
<!--<div id="filters">-->
<!--<ul class="nav navbar-nav">-->
<!--<!–<input id="business-time" type="text" name="datefilter" value="">–>-->
<!--<li class="dropdown">-->
<!--<a class="dropdown-toggle" data-toggle="dropdown" href="#">Category-->
<!--<span class="caret"></span></a>-->
<!--<ul id="category-filter" class="dropdown-menu dropdown-filter">-->
<!--<!–<li><a href="#">Page 1-1</a></li>–>-->
<!--</ul>-->
<!--</li>-->
<!--<li class="dropdown">-->
<!--<a class="dropdown-toggle" data-toggle="dropdown" href="#">Location-->
<!--<span class="caret"></span></a>-->
<!--<ul id="location-filter" class="dropdown-menu dropdown-filter">-->
<!--</ul>-->
<!--</li>-->
<!--</ul>-->
<!--</div>-->
</div>
</div>
</nav>
<div class="container-fluid">
<div id="business-list" class="col-sm-2 main">
<h5 class="sub-header">Business List</h5>
<!--<h6>Category: <span class="label label-info category-info">None</span>-->
<!--Location: <span class="label label-info location-info">None</span></h6>-->
<!--<h6></h6>-->
<div id="filters">
<div class="filter">
<span class="filter-name">Category: </span>
<select id="category-filter" class="js-example-basic-single"></select>
</div>
<div class="filter">
<span class="filter-name">Location: </span>
<select id="location-filter" class="js-example-basic-single"></select>
</div>
</div>
<div class="table-responsive">
<table class="table table-striped">
<!--<thead>-->
<!--<tr>-->
<!--<th>Business</th>-->
<!--</tr>-->
<!--</thead>-->
<tbody>
</tbody>
</table>
</div>
<!--<div id="page-buttons">-->
<!--<ul class="pager">-->
<!--<li class="previous"><a id="previous-page" href="#">Previous</a></li>-->
<!--<li class="next"><a id="next-page" href="#">Next</a></li>-->
<!--</ul>-->
<!--</div>-->
<nav id="page-buttons">
<ul class="pager">
<li class="previous"><a id="previous-page" href="#"><span aria-hidden="true">←</span> Upper</a></li>
<li class="next"><a id="next-page" href="#">Lower <span aria-hidden="true">→</span></a></li>
</ul>
</nav>
</div>
<div id="line-charts" class="col-sm-6 main">
<div class="line-chart-title">
<div class="center-title">
<h5>Review Amount</h5>
</div>
<!--<div id="show-tooltip" class="has-warning">-->
<!--<div class="checkbox">-->
<!--<label>-->
<!--<input type="checkbox" id="checkboxWarning" value="option1">-->
<!--Show Tooltip-->
<!--</label>-->
<!--</div>-->
<!--</div>-->
</div>
<div id="review-amount-line-chart">
</div>
<div><h5>Star Amount</h5></div>
<div id="star-amount-line-chart">
</div>
</div>
<div id="review-list" class="col-sm-4 main">
<h5 class="sub-header">Reviews of <span id="selected-business-name" class="text-clicked"></span></h5>
<span id="review-address">Address: <span id="full-address"></span></span>
<!--<div id="key-words">-->
<!--</div>-->
<!--<span class="label label-default key-words-init">Default</span>-->
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Time</th>
<th>Reviews</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div id="tooltip" class="panel panel-info">
<div id="business-name" class="panel-heading">Business Name</div>
<div class="panel-body">
<span class="tooltip-content">Date: </span><span id="selected-date"></span></br>
<p class="tooltip-amount"><span class="tooltip-content">Review Amount: </span><span id="review-amount"></span></br></p>
<p class="tooltip-amount"><span class="tooltip-content">Average Star: </span><span id="star-amount"></span></p>
<p class="tooltip-empty"><span class="tooltip-content">No reviews today. </span></p>
</div>
</div>
<!--Core JavaScript-->
<!--==================================================-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script src="//cdn.jsdelivr.net/bootstrap.daterangepicker/2/daterangepicker.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/select2/4.0.1/js/select2.min.js"></script>
<script src="util/elasticsearch.jquery.js" charset="utf-8"></script>
<script src="util/util_get_business_list_based_on_abnormality_score.js" charset="utf-8"></script>
<script src="util/util_get_review_details_within_time_range.js" charset="utf-8"></script>
<script src="util/util_get_significant_terms_within_time_range.js" charset="utf-8"></script>
<script src="util/util_get_business_list_by_next_or_prev_button.js" charset="utf-8"></script>
<script src="dashboard.js" charset="utf-8"></script>
<script>
var client = new $.es.Client({
host: 'http://vgc.poly.edu/projects/r2sense/'
});
var global_state_filter = ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ",
"NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC",
"SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "DC", "None"];
var global_category_filter = [];
var global_next_prev_click_times = 0;
var global_line_chart_start_time = "2004-01-01";
var global_line_chart_end_time = "2015-03-01";
var global_line_chart_max_review_amount = 0;
var clickedBusinessIndex = 1;
var clickedBusinessID = '';
var selectedCategoryFilter = '';
var selectedLocationFilter = '';
var reviewListRendered = false;
var global_sortKey = '';
var global_business_size = 12;
get_businesses_list_based_on_abnormality_score("yelp", "business1216", global_business_size, 0, "", "", "abnormality_score_" + global_sortKey);
//options: abnormality_score, abnormality_score_20110101, abnormality_score_20130101, abnormality_score_20150101
//get_business_list_by_next_button("yelp", "business1208v3", 10, "wi", "bars");
//get_business_list_by_prev_button("yelp", "business1208v3", 10, "wi", "bars");
//get_review_details_within_time_range("yelp", "review1208v3", "g10zmpUzmMJOOIjj_JJPvg", 100, "desc", "2012-11-01", "2014-12-01");
//get_significant_terms_in_review_details_within_time_range("yelp", "review1208v3", "g10zmpUzmMJOOIjj_JJPvg, Lml0-yTNsMYsP9IrSMxw9A", 100, "2012-11-01", "2014-12-01");
//get_category_filter("yelp", "business1208v3", 10, "2004-11-01", "2015-12-01");
var businessList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
var reviewList = [
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'},
{'time': '2015-11-12', 'review': 'hello world'}
];
renderCategoryFilter();
renderLocationFilter();
$('#previous-page').on('click', function (d) {
get_business_list_by_prev_button("yelp", "business1216", 10, selectedLocationFilter, selectedCategoryFilter, "abnormality_score_" + global_sortKey);
});
$('#next-page').on('click', function (d) {
get_business_list_by_next_button("yelp", "business1216", 10, selectedLocationFilter, selectedCategoryFilter, "abnormality_score_" + global_sortKey);
});
// $('input[name="datefilter"]').daterangepicker({
// autoUpdateInput: false,
// locale: {
// cancelLabel: 'Clear'
// }
// });
// $('input[name="datefilter"]').on('apply.daterangepicker', function(ev, picker) {
// $(this).val(picker.startDate.format('MM/DD/YYYY') + ' - ' + picker.endDate.format('MM/DD/YYYY'));
// global_line_chart_start_time = picker.startDate.format('YYYY-MM-DD');
// global_line_chart_end_time = picker.endDate.format('YYYY-MM-DD');
// console.log(global_line_chart_start_time);
// });
// $('input[name="datefilter"]').on('cancel.daterangepicker', function(ev, picker) {
// $(this).val('');
// });
function cb(start, end) {
var startDate = moment(new Date(start)).subtract(-1, 'days');
var endDate = moment(new Date(end)).subtract(-1, 'days');
$('#reportrange span').html(startDate.format('MMMM D, YYYY') +
' - ' +
endDate.format('MMMM D, YYYY'));
var newStartDate = timeFormate(new Date(startDate));
global_sortKey = newStartDate.replace(/\-/g, '');
if (global_sortKey == '20040101') {
global_sortKey = '';
}
console.log(global_sortKey);
get_businesses_list_based_on_abnormality_score("yelp", "business1216", global_business_size, 0, selectedLocationFilter, selectedCategoryFilter, "abnormality_score_" + global_sortKey);
}
// cb(moment().subtract(29, 'days'), moment());
cb(global_line_chart_start_time, global_line_chart_end_time);
$('#reportrange').daterangepicker({
ranges: {
// 'Today': [moment(), moment()],
// 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
// 'Last 7 Days': [moment().subtract(6, 'days'), moment()],
// 'Last 30 Days': [moment().subtract(29, 'days'), moment()],
// 'This Month': [moment().startOf('month'), moment().endOf('month')],
// 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
'All': [moment(new Date(global_line_chart_start_time)),
moment(new Date(global_line_chart_end_time))],
'From 2015-01-01': [moment(new Date('2015-01-01')),
moment(new Date(global_line_chart_end_time))],
'From 2013-01-01': [moment(new Date('2013-01-01')),
moment(new Date(global_line_chart_end_time))],
'From 2011-01-01': [moment(new Date('2011-01-01')),
moment(new Date(global_line_chart_end_time))]
}
}, cb);
$('.ranges ul li:first-child').trigger('click');
$('.calendar').remove();
$('.ranges li').last().remove();
$('.range_inputs').remove();
</script>
</body>
</html>