Advertisement
Guest User

Harsha

a guest
Nov 16th, 2010
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.51 KB | None | 0 0
  1. $(document).ready(function () {
  2.     StatusUpdates();
  3.     StatusComments();
  4.     MessageBox();
  5.     DeleteComment();
  6.     DeleteStatus();
  7.  
  8.  
  9.  
  10. });
  11.  
  12. function MessageBox() {
  13.     // Status MessageBox
  14.     var textholder = $('#StatusMessageMessage').val();
  15.  
  16.     $('#StatusMessageMessage').focus(function () {
  17.         if ($(this).val() == textholder) $(this).val("");
  18.  
  19.         $(this).animate({
  20.             "height": "48px",
  21.         }, "fast");
  22.         $('.share').slideDown("fast");
  23.         $(this).TextAreaExpander(48, 75);
  24.  
  25.     });
  26.  
  27.     $('#StatusMessageMessage').blur(function () {
  28.         if ($(this).val() == "") {
  29.             $(this).val(textholder);
  30.             $('.share').slideUp("fast");
  31.             $(this).animate({
  32.                 "height": "18px"
  33.             }, "fast");
  34.         }
  35.     });
  36.  
  37.     // Comment Box
  38.     $('.user-comment').click(function () {
  39.         var id = $(this).attr('id');
  40.         $("#commentbox-" + id).slideToggle("fast", function () {
  41.             $("#commentbox-" + id + " .comment" + id).focus();
  42.         });
  43.         return false;
  44.     });
  45.  
  46.     var textholder1 = $('.commenttextarea').val();
  47.  
  48.     $('.commenttextarea').focus(function () {
  49.         if ($(this).val() == textholder1) $(this).val("");
  50.         $(this).TextAreaExpander(35, 75);
  51.  
  52.     });
  53.  
  54.     $('.commenttextarea').blur(function () {
  55.         if ($(this).val() == "") {
  56.             $(this).val(textholder1);
  57.         }
  58.     });
  59.  
  60. }
  61.  
  62. function StatusUpdates() {
  63.     $('#updateStatus').submit(function () {
  64.         $(this).ajaxSubmit(options);
  65.         return false; // prevent a new request
  66.     });
  67.  
  68.     var options = {
  69.         target: '.user-status',
  70.         // target element(s) to be updated with server response
  71.         beforeSubmit: showRequest,
  72.         // pre-submit callback
  73.         success: showResponse,
  74.         // post-submit callback
  75.         // other available options:
  76.         //url:       url         // override for form's 'action' attribute
  77.         //type:      type        // 'get' or 'post', override for form's 'method' attribute
  78.         //dataType:  null        // 'xml', 'script', or 'json' (expected server response type)
  79.         //clearForm: true        // clear all form fields after successful submit
  80.         resetForm: true // reset the form after successful submit
  81.         // $.ajax options can be used here too, for example:
  82.         //timeout:   3000
  83.     };
  84.  
  85.     function showRequest(formData, jqForm, options) {
  86.  
  87.         var textbox = $('#StatusMessageMessage').val();
  88.         if ((textbox == '') || (textbox == "What have you been eating ?")) {
  89.             alert('Please Enter Something and click submit.');
  90.             return false;
  91.         } else {
  92.             $('#StatusMessageMessage').attr('disabled', true);
  93.         }
  94.  
  95.     }
  96.  
  97.     function showResponse(responseText, statusText, xhr, $form) {
  98.         $('#StatusMessageMessage').attr('disabled', false);
  99.         $('.share').slideUp("fast");
  100.         $('#StatusMessageMessage').animate({
  101.             "height": "18px"
  102.         }, "fast");
  103.     }
  104.  
  105. }
  106.  
  107. function StatusComments() {
  108.  
  109.     $('.comment').click(function(e) {
  110.         e.preventDefault();
  111.         $(this).ajaxSubmit(options);
  112.         return false;
  113.     });
  114.  
  115.     var options = {
  116.         beforeSubmit: showRequest,
  117.         success: showResponse,
  118.         resetForm: true
  119.     };
  120.  
  121.     function showRequest(formData, jqForm, options) {
  122.         var textbox = $('#StatusMessageReplyMessage').val();
  123.         alert(textbox);
  124.  
  125.     }
  126.  
  127.     function showResponse(responseText, statusText, xhr, $form) {
  128.  
  129.     }
  130.  
  131. }
  132.  
  133. // Delete Comment
  134. function DeleteComment() {
  135.     $('.comment-delete').click(function () {
  136.  
  137.         if (confirm("Are you sure you wanna delete the comment ?")) {
  138.             var deleteID = $(this).attr('id');
  139.             $.ajax({
  140.                 url: "account/deleteComment/" + deleteID,
  141.                 success: function () {
  142.                     $("#comment-" + deleteID).slideUp("fast");
  143.                 }
  144.             });
  145.         }
  146.        
  147.         return false;
  148.     });
  149. }
  150.  
  151. // Delete Status Message
  152. function DeleteStatus() {
  153.     $('.status-delete').click(function () {
  154.  
  155.         if (confirm("Are you sure you wanna delete the Status Message ?")) {
  156.             var deleteID = $(this).attr('id');
  157.             $.ajax({
  158.                 url: "account/deleteStatus/" + deleteID,
  159.                 success: function () {
  160.                     $("#record-" + deleteID).slideUp("fast");
  161.                 }
  162.             });
  163.         }
  164.        
  165.         return false;
  166.     });
  167. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement