Skip to content

Commit a2d14c4

Browse files
committed
Add new option for demo
1 parent f65adb0 commit a2d14c4

File tree

1 file changed

+47
-21
lines changed

1 file changed

+47
-21
lines changed

index.htm

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
bscss.prop('href', '//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css');
1616
bsdpcss.prop('href', 'bootstrap-datepicker/css/datepicker.css');
1717
page.bootstrap = 2;
18-
$(page).trigger('change:bootstrap', 2)
1918
}
2019
else{
2120
bscss.prop('href', '//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css');
2221
bsdpcss.prop('href', 'bootstrap-datepicker/css/datepicker3.css');
2322
page.bootstrap = 3;
24-
$(page).trigger('change:bootstrap', 3)
2523
}
24+
25+
$(page).trigger('change:bootstrap', page.bootstrap);
2626
}
2727
</script>
2828
<style>
@@ -232,6 +232,13 @@ <h2>bootstrap-datepicker sandbox <small>&alpha;lph&alpha;</small></h2>
232232
<option value="2">2 / years</option>
233233
</select>
234234
</label>
235+
<label for="maxViewMode">Max view mode
236+
<select class="span2 col-md-2 form-control" id="maxViewMode" name="maxViewMode">
237+
<option value="0">0 / days</option>
238+
<option value="1">1 / months</option>
239+
<option value="2" selected>2 / years</option>
240+
</select>
241+
</label>
235242
<label for="todayBtn" class="inline checkbox">Today button
236243
<select class="span2 col-md-2 form-control" id="todayBtn" name="todayBtn">
237244
<option value="false">disabled</option>
@@ -295,6 +302,18 @@ <h2>bootstrap-datepicker sandbox <small>&alpha;lph&alpha;</small></h2>
295302

296303
<br>
297304

305+
<span>Days of week highlighted:
306+
<label class="checkbox"><input type="checkbox" name="daysOfWeekHighlighted" value="0"> 0</label>
307+
<label class="checkbox"><input type="checkbox" name="daysOfWeekHighlighted" value="1"> 1</label>
308+
<label class="checkbox"><input type="checkbox" name="daysOfWeekHighlighted" value="2"> 2</label>
309+
<label class="checkbox"><input type="checkbox" name="daysOfWeekHighlighted" value="3"> 3</label>
310+
<label class="checkbox"><input type="checkbox" name="daysOfWeekHighlighted" value="4"> 4</label>
311+
<label class="checkbox"><input type="checkbox" name="daysOfWeekHighlighted" value="5"> 5</label>
312+
<label class="checkbox"><input type="checkbox" name="daysOfWeekHighlighted" value="6"> 6</label>
313+
</span>
314+
315+
<br>
316+
298317
<label for="calendarWeeks" class="inline checkbox">
299318
<input id="calendarWeeks" name="calendarWeeks" type="checkbox">
300319
Calendar weeks
@@ -323,7 +342,11 @@ <h2>bootstrap-datepicker sandbox <small>&alpha;lph&alpha;</small></h2>
323342
<input id="beforeShowMonth" name="beforeShowMonth" type="checkbox">
324343
Before-show-month callback
325344
</label>
326-
<label for="datesDisabled" class="inline checkbox">
345+
<label for="beforeShowYear" class="inline checkbox">
346+
<input id="beforeShowYear" name="beforeShowYear" type="checkbox">
347+
Before-show-year callback
348+
</label>
349+
<label for="datesDisabled" class="inline checkbox">
327350
<input id="datesDisabled" name="datesDisabled" type="checkbox">
328351
datesDisabled
329352
</label>
@@ -387,29 +410,32 @@ <h2>bootstrap-datepicker sandbox <small>&alpha;lph&alpha;</small></h2>
387410
var js = "$('#sandbox-container "+selector+"').datepicker({\n",
388411
val;
389412
for (var opt in $.extend({}, defaults, values)){
390-
console.log(opt);
391413
if (values[opt] != defaults[opt]){
392414
val = values[opt];
393-
if (opt == 'daysOfWeekDisabled') val = '"'+val+'"'
415+
if (opt == 'daysOfWeekDisabled' || opt == 'daysOfWeekHighlighted') val = '"'+val+'"'
394416
else if (opt == 'beforeShowDay') val = function(date){
395-
if (date.getMonth() == (new Date()).getMonth())
396-
switch (date.getDate()){
397-
case 4:
398-
return {
399-
tooltip: 'Example tooltip',
400-
classes: 'active'
401-
};
402-
case 8:
403-
return false;
404-
case 12:
405-
return "green";
406-
}
407-
}
408-
else if (opt == 'beforeShowMonth') val = function(date){
409-
switch (date.getMonth()){
417+
if (date.getMonth() == (new Date()).getMonth())
418+
switch (date.getDate()){
419+
case 4:
420+
return {
421+
tooltip: 'Example tooltip',
422+
classes: 'active'
423+
};
410424
case 8:
411425
return false;
412-
}
426+
case 12:
427+
return "green";
428+
}
429+
}
430+
else if (opt == 'beforeShowMonth') val = function(date){
431+
if (date.getMonth() == 8) {
432+
return false;
433+
}
434+
}
435+
else if (opt == 'beforeShowYear') val = function(date){
436+
if (date.getFullYear() == 2007) {
437+
return false;
438+
}
413439
}
414440
else if (opt == 'datesDisabled'){
415441
var date = new Date();

0 commit comments

Comments
 (0)