$(function(){ $('.date-picker').datepicker(); $('.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"); $("#phone, #fax").mask("(999) 999-9999"); $("#publish-time").mask("99:99"); //teach select2 to accept data-attributes $(".chzn-select").each(function(){ $(this).select2($(this).data()); }); $("#article-tags").select2({ tags: ['photoshop', 'colors', 'plugins', 'themes', 'bike'] }); //changing default parsley behaviour so it adds error messages to labels. //label - is a parent of element $("#user-form").parsley({ errors: { container: function ( elem, isRadioOrCheckbox ) { return elem.parents(".control-group").children("label"); } } }); $("input:checkbox").iCheck({ checkboxClass: 'icheckbox_square-grey', radioClass: 'iradio_square-grey' }); var customWysihtml5Templates = { "font-styles": function(locale) { return "" }, "emphasis": function(locale) { return "
  • " + "
    " + "" + "" //,+ "Underline" + "
    " + "
  • " }, "lists": function(locale) { return "
  • " + "
    " + "" + "" + "" + "" + "
    " + "
  • " }, "link": function(locale) { return "
  • " + "" + "" + "
  • " }, "image": function(locale) { return "
  • " + "" + "" + "
  • " }, "html": function(locale) { return "
  • " + "
    " + "" + "
    " + "
  • " } }; $("#text").wysihtml5({ html: true, customTemplates: customWysihtml5Templates, stylesheets: [] }); });