Advertisement
imedvedev

Untitled

Sep 11th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function(){
  2.     // Настройка Fancybox
  3.     $("#add").fancybox({
  4.         'zoomSpeedIn'       : 600,
  5.         'zoomSpeedOut'      : 500,
  6.         'easingIn'          : 'easeOutBack',
  7.         'easingOut'         : 'easeInBack',
  8.         'hideOnContentClick': false,
  9.         'padding'           : 15
  10.     });
  11.  
  12.     $('.pr-title,.pr-body,.pr-performer').live('keyup',function(e){
  13.         if(!this.preview)
  14.             this.preview=$('#fancy_ajax .note');
  15.         this.preview.find($(this).attr('class').replace('pr-','.')).html($(this).val().replace(/<[^>]+>/ig,''));
  16.     });
  17.  
  18.     // Кнопка отправки
  19.     $('#note-submit').live('click',function(e){
  20.  
  21.         if($('.pr-title').val().length<4){
  22.             alert("Слишком короткий заголовок!")
  23.             return false;
  24.         }
  25.         if($('.pr-body').val().length<4){
  26.             alert("Слишком короткая задача!")
  27.             return false;
  28.         }
  29.         if($('.pr-performer').val().length<1){
  30.             alert("Не назначен исполнитель!")
  31.             return false;
  32.         }
  33.         $(this).replaceWith('<img src="img/ajax_load.gif" style="margin:30px auto;display:block" />');
  34.         var data = {
  35.             'title': $('.pr-title').val(),
  36.             'body': $('.pr-body').val(),
  37.             'performer': $('.pr-performer').val(),
  38.         };
  39.         $.post('app/post.php',data,function(msg){        
  40.             if(parseInt(msg))           {
  41.                 var tmp = $('#fancy_ajax .note').clone();
  42.                 tmp.appendTo($('#all'));   
  43.                 make_draggable(tmp)
  44.             }
  45.             $("#add").fancybox.close();
  46.         });
  47.         e.preventDefault();
  48.     })
  49.     $('.note-form').live('submit',function(e){e.preventDefault();});
  50.  
  51.     $("#dell").click(function(){
  52.         var self = this;
  53.         var id = $(self).data("id");
  54.         $.ajax({
  55.             url:"index.php",
  56.             data:"delete="+id;
  57.             success:function(result){
  58.                 $(self).parent().fadeOut();
  59.             }
  60.         });
  61.     });
  62. });
  63. function make_draggable(elements){}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement