1
$(document).ready(function() {
3
$('#config-text').keyup(function() {
7
$('.configurator input, .configurator select').change(function() {
11
$('.demo i').click(function() {
12
$(this).parent().find('input').click();
15
$('#startDate').daterangepicker({
16
singleDatePicker: true,
17
startDate: moment().subtract(6, 'days')
20
$('#endDate').daterangepicker({
21
singleDatePicker: true,
27
function updateConfig() {
30
if ($('#singleDatePicker').is(':checked'))
31
options.singleDatePicker = true;
33
if ($('#showDropdowns').is(':checked'))
34
options.showDropdowns = true;
36
if ($('#minYear').val().length && $('#minYear').val() != 1)
37
options.minYear = parseInt($('#minYear').val(), 10);
39
if ($('#maxYear').val().length && $('#maxYear').val() != 1)
40
options.maxYear = parseInt($('#maxYear').val(), 10);
42
if ($('#showWeekNumbers').is(':checked'))
43
options.showWeekNumbers = true;
45
if ($('#showISOWeekNumbers').is(':checked'))
46
options.showISOWeekNumbers = true;
48
if ($('#timePicker').is(':checked'))
49
options.timePicker = true;
51
if ($('#timePicker24Hour').is(':checked'))
52
options.timePicker24Hour = true;
54
if ($('#timePickerIncrement').val().length && $('#timePickerIncrement').val() != 1)
55
options.timePickerIncrement = parseInt($('#timePickerIncrement').val(), 10);
57
if ($('#timePickerSeconds').is(':checked'))
58
options.timePickerSeconds = true;
60
if ($('#autoApply').is(':checked'))
61
options.autoApply = true;
63
if ($('#maxSpan').is(':checked'))
64
options.maxSpan = { days: 7 };
66
if ($('#ranges').is(':checked')) {
68
'Today': [moment(), moment()],
69
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
70
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
71
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
72
'This Month': [moment().startOf('month'), moment().endOf('month')],
73
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
77
if ($('#locale').is(':checked')) {
82
cancelLabel: 'Cancel',
85
customRangeLabel: 'Custom',
87
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
88
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
93
if (!$('#linkedCalendars').is(':checked'))
94
options.linkedCalendars = false;
96
if (!$('#autoUpdateInput').is(':checked'))
97
options.autoUpdateInput = false;
99
if (!$('#showCustomRangeLabel').is(':checked'))
100
options.showCustomRangeLabel = false;
102
if ($('#alwaysShowCalendars').is(':checked'))
103
options.alwaysShowCalendars = true;
105
if ($('#parentEl').val().length)
106
options.parentEl = $('#parentEl').val();
108
if ($('#startDate').val().length)
109
options.startDate = $('#startDate').val();
111
if ($('#endDate').val().length)
112
options.endDate = $('#endDate').val();
114
if ($('#minDate').val().length)
115
options.minDate = $('#minDate').val();
117
if ($('#maxDate').val().length)
118
options.maxDate = $('#maxDate').val();
120
if ($('#opens').val().length && $('#opens').val() != 'right')
121
options.opens = $('#opens').val();
123
if ($('#drops').val().length && $('#drops').val() != 'down')
124
options.drops = $('#drops').val();
126
if ($('#buttonClasses').val().length && $('#buttonClasses').val() != 'btn btn-sm')
127
options.buttonClasses = $('#buttonClasses').val();
129
if ($('#applyButtonClasses').val().length && $('#applyButtonClasses').val() != 'btn-primary')
130
options.applyButtonClasses = $('#applyButtonClasses').val();
132
if ($('#cancelButtonClasses').val().length && $('#cancelButtonClasses').val() != 'btn-default')
133
options.cancelClass = $('#cancelButtonClasses').val();
135
$('#config-demo').daterangepicker(options, function(start, end, label) { console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')'); });
137
if (typeof options.ranges !== 'undefined') {
141
var option_text = JSON.stringify(options, null, ' ');
143
var replacement = "ranges: {\n"
144
+ " 'Today': [moment(), moment()],\n"
145
+ " 'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],\n"
146
+ " 'Last 7 Days': [moment().subtract(6, 'days'), moment()],\n"
147
+ " 'Last 30 Days': [moment().subtract(29, 'days'), moment()],\n"
148
+ " 'This Month': [moment().startOf('month'), moment().endOf('month')],\n"
149
+ " 'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]\n"
151
option_text = option_text.replace(new RegExp('"ranges"\: \{\}', 'g'), replacement);
153
$('#config-text').val("$('#demo').daterangepicker(" + option_text + ", function(start, end, label) {\n console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');\n});");
157
$(window).scroll(function (event) {
158
var scroll = $(window).scrollTop();
160
$('.leftcol').css('position', 'fixed');
161
$('.leftcol').css('top', '10px');
163
$('.leftcol').css('position', 'absolute');
164
$('.leftcol').css('top', '180px');
168
var bg = new Trianglify({
169
x_colors: ["#e1f3fd", "#eeeeee", "#407dbf"],
171
width: document.body.clientWidth,
177
$('#jumbo').css('background-image', 'url(' + bg.png() + ')');