$(document).ready( function () { $("#datepicker").datepicker(); $(".confirm-export").confirm({ "text": "Mark current batch exported?", "title": "Export confirmation", "confirm": function(form) { form.submit(); }, }); if( $('.addedLink').length > 0) { setTimeout(function (){ window.close(); }, 500); } $("form.form-add").submit( function(e) { if ( $(".add-category").val() == -1) { e.preventDefault(); $(".add-category-col").addClass("has-error"); } }); $(".category-change-parent").change(function (e) { e.target.parentElement.submit(); }); $('.cat-delete').confirm({ text: "Are you sure you want to delete this category?", title: "Delete confrimation", confirm: function(form) { console.log("fooo"); form.submit(); } }); $(".confirm-news-delete").confirm({ "text": "Delete news item?", "title": "Delete confirmation", confirm: function(form) { form.submit(); } }); $(".content-slider").click(function (e) { var contentDiv = $(this).parents('.news-row').find('.post-content'); if (contentDiv.hasClass("state-up")) { contentDiv.removeClass('state-up').addClass('state-down').animate({'max-height': '100%', 'height': '100%'}); $(this).html('^'); } else { contentDiv.removeClass('state-down').addClass('state-up').animate({height: '5em'}); $(this).html('v'); } }); });