$(document).ready(function() { $(".close_form").click(function(){ $("#auth_block").hide(); $(".show_form a").each(function(){ $(this).removeClass("open"); $(".show_form #auth-button").addClass("open"); }) }); $(".auth").click(function(){ $("#auth_block").show(); }); $('.show_form a.but, .user_top_date ul a').on('click', function(e){ e.preventDefault(); if(!$(this).hasClass('open')) { var oldcontent = $('.show_form a.open, .user_top_date ul a.open').attr('href'); var newcontent = $(this).attr('href'); $(oldcontent).fadeOut('fast', function(){ $(newcontent).fadeIn().removeClass('hidden'); $(oldcontent).addClass('hidden'); }); $('.show_form a, .user_top_date ul a').removeClass('open'); $(this).addClass('open'); window.location.hash = $(this).attr('href'); } }); //Удаление комментариев $(".delete-comment").on('click', function(){ var elementId = parseInt($(this).attr("id").replace(/\D/g, '')); if(!isNaN(elementId) && isFinite(elementId)){ $.ajax({ url: "/index.php", method: "GET", data: {"API":'', "api-action":"deleteComment", "comment-id":elementId}, dataType: "HTML", success: function(response) { if (response == 'success') { $("#comment-" + elementId).children("div:first").html("НЛО приетело и опубликовало эту запись здесь"); popUpWindow('Комментарий удален', 'notice'); } else { popUpWindow('Произошла ошибка удаления комментария', 'error'); } }, error: function(){ popUpWindow('Произошла непредвиденная ошибка удаления комментария', 'error'); } }) } }); $(".simple-banner > a").on('click', function(event){ event.preventDefault(); window.open($(this).attr('href'), '_blank'); }); });