1
|
|
|
|
2
|
|
|
$( document ).ready(function() { |
3
|
|
|
/* |
4
|
|
|
//gets the current date information to be used in the datepicker |
5
|
|
|
var date = new Date(); |
6
|
|
|
var currentMonth = date.getMonth(); |
7
|
|
|
var currentDate = date.getDate(); |
8
|
|
|
var currentYear = date.getFullYear(); |
9
|
|
|
|
10
|
|
|
$( "#start_date" ).datetimepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: new Date(2014, 04 - 1, 12), maxDate: new Date(currentYear, currentMonth, currentDate, 23, 59) }); |
11
|
|
|
$( "#end_date" ).datetimepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: new Date(2014, 04 - 1, 12), maxDate: new Date(currentYear, currentMonth, currentDate, 23, 59) }); |
12
|
|
|
$( "#date" ).datepicker({ dateFormat: 'yy-mm-dd', changeMonth: true, changeYear: true, minDate: new Date(2014, 04 - 1, 12), maxDate: new Date(currentYear, currentMonth, currentDate) }); |
13
|
|
|
*/ |
14
|
|
|
//custom select boxes |
15
|
|
|
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) { |
|
|
|
|
16
|
|
|
$('.selectpicker').selectpicker('mobile'); |
17
|
|
|
} else { |
18
|
|
|
$('.selectpicker').selectpicker(); |
19
|
|
|
} |
20
|
|
|
|
21
|
|
|
//search |
22
|
|
|
$("body.page-search .sub-menu input[type=text]").click(function(){ |
23
|
|
|
this.select(); |
24
|
|
|
}); |
25
|
|
|
|
26
|
|
|
//bootstrap popover |
27
|
|
|
$('[data-toggle="popover"]').popover({ |
28
|
|
|
trigger: 'hover', |
29
|
|
|
'placement': 'bottom' |
30
|
|
|
}); |
31
|
|
|
|
32
|
|
|
|
33
|
|
|
}); |
34
|
|
|
|
35
|
|
|
function showSearchContainers(){ |
36
|
|
|
$(".search-explore").hide(); |
37
|
|
|
$(".search-containers").slideDown(); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
function showSubMenu(){ |
41
|
|
|
$(".sub-menu-statistic").hide(); |
42
|
|
|
$(".sub-menu-container").slideDown(); |
43
|
|
|
} |
44
|
|
|
function language(selectObj) { |
45
|
|
|
var idx = selectObj.selectedIndex; |
46
|
|
|
var lang = selectObj.options[idx].value; |
47
|
|
|
document.cookie = 'language='+lang+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
48
|
|
|
window.location.reload(); |
49
|
|
|
} |
50
|
|
|
function populate(obj,str,selected) { |
51
|
|
|
//console.log('populate'); |
52
|
|
|
$.ajax({ |
53
|
|
|
url:'search-ajax.php', |
54
|
|
|
type:'GET', |
55
|
|
|
data: 'ask=' + str, |
56
|
|
|
dataType: 'json', |
57
|
|
|
success: function( json ) { |
58
|
|
|
var options = ""; |
59
|
|
|
$.each(json, function(i, item){ |
60
|
|
|
if ($.inArray(item.id,selected) != -1) { |
61
|
|
|
options += "<option value="+item.id+" selected>"+item.value+"</option>"; |
62
|
|
|
} else { |
63
|
|
|
options += "<option value="+item.id+">"+item.value+"</option>"; |
64
|
|
|
} |
65
|
|
|
}); |
66
|
|
|
obj.append(options); |
67
|
|
|
} |
68
|
|
|
}); |
69
|
|
|
} |
70
|
|
View Code Duplication |
function statsdatechange(e) { |
|
|
|
|
71
|
|
|
var form = document.getElementById('changedate'); |
72
|
|
|
var yearmonth = form.date.value.split("-"); |
73
|
|
|
var pagename = location.pathname; |
74
|
|
|
pagename = pagename.split('/'); |
75
|
|
|
var i = 0; |
76
|
|
|
var page = ''; |
77
|
|
|
for (i = 0; i < pagename.length; i++) { |
78
|
|
|
if (pagename[i] != '') { |
79
|
|
|
if (isNaN(pagename[i])) page = page +'/'+ pagename[i]; |
|
|
|
|
80
|
|
|
} |
81
|
|
|
} |
82
|
|
|
if (typeof yearmonth[1] != 'undefined') { |
83
|
|
|
form.action = page+'/'+yearmonth[0]+'/'+yearmonth[1]; |
84
|
|
|
} else { |
85
|
|
|
form.action = page; |
86
|
|
|
} |
87
|
|
|
form.submit(); |
88
|
|
|
} |
89
|
|
View Code Duplication |
function statsairlinechange(e) { |
|
|
|
|
90
|
|
|
var form = document.getElementById('changeairline'); |
91
|
|
|
var airline = form.airline.value; |
92
|
|
|
var pagename = location.pathname; |
93
|
|
|
pagename = pagename.split('/'); |
94
|
|
|
var i = 0; |
95
|
|
|
var page = ''; |
96
|
|
|
var add = false; |
97
|
|
|
for (i = 0; i < pagename.length; i++) { |
98
|
|
|
if (pagename[i] != '') { |
99
|
|
|
if (pagename[i].length != 3) page = page+'/'+pagename[i]; |
|
|
|
|
100
|
|
|
else { |
101
|
|
|
add = true; |
102
|
|
|
if (airline != 'all') page = page+'/'+airline; |
|
|
|
|
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
if (add === false) page = page+'/'+airline; |
|
|
|
|
107
|
|
|
form.action = page; |
108
|
|
|
form.submit(); |
109
|
|
|
} |
110
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.