|
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
|
|
|
function statsdatechange(e) { |
|
71
|
|
|
console.log(e); |
|
|
|
|
|
|
72
|
|
|
var form = document.getElementById('changedate'); |
|
73
|
|
|
var yearmonth = form.date.value.split("-"); |
|
74
|
|
|
var pagename = location.pathname; |
|
75
|
|
|
pagename = pagename.split('/'); |
|
76
|
|
|
var i = 0; |
|
77
|
|
|
var page = ''; |
|
78
|
|
|
for (i = 0; i < pagename.length; i++) { |
|
79
|
|
|
if (isNaN(pagename[i])) page = page +'/'+ pagename[i]; |
|
|
|
|
|
|
80
|
|
|
} |
|
81
|
|
|
form.action = page+'/'+yearmonth[0]+'/'+yearmonth[1]; |
|
82
|
|
|
form.submit(); |
|
83
|
|
|
} |
|
84
|
|
|
|
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.