$(function(){
$("#tooltip-enabled, #max-length").tooltip();
$(".chzn-select").each(function(){
$(this).select2($(this).data());
});
$('.selectpicker').selectpicker();
//selectpicker doesn't seem to be flexible enough (can't change template), so need to replace span.caret externally
$('.selectpicker + .bootstrap-select span.caret').replaceWith("");
$('.selectpicker + .bootstrap-select span.pull-left').removeClass("pull-left");
$(".autogrow").autogrow();
var customWysihtml5Templates = {
"font-styles": function(locale) {
return "
" +
"" +
" " + locale.font_styles.normal + " " +
"" +
"" +
""
},
"emphasis": function(locale) {
return "" +
""
+ ""
},
"lists": function(locale) {
return ""
+ ""
+ "
"
+ "
"
+ "
"
+ "
"
+ "
"
+ ""
},
"link": function(locale) {
return ""
+ ""
+ ""
+ "
"
+ ""
+ "
"
+ ""
+ "
"
+ ""
+ ""
},
"image": function(locale) {
return ""
+ ""
+ ""
+ "
"
+ ""
+ "
"
+ ""
+ "
"
+ ""
+ ""
},
"html": function(locale) {
return ""
+ ""
+ ""
}
};
$("#wysiwyg").wysihtml5({
html: true,
customTemplates: customWysihtml5Templates,
stylesheets: []
});
$(".iCheck").iCheck({
checkboxClass: 'icheckbox_square-grey',
radioClass: 'iradio_square-grey'
});
$('.date-picker').datepicker({
autoclose: true
});
var $btnCalendar = $('#btn_select_calendar');
$btnCalendar.datepicker({
autoclose: true
}).on('changeDate', function(ev){
$('#btn_enabled_date').val($btnCalendar.data('date'));
$btnCalendar.datepicker('hide');
});
$('#color').colorpicker().on('changeColor', function(ev){
$("#color-holder").css("backgroundColor", ev.color.toHex());
});
$("#mask-phone").mask("(999) 999-9999");
$("#mask-date").mask("99-99-9999");
$("#mask-int-phone").mask("+999 999 999 999");
$("#mask-time").mask("99:99");
});