Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- StatusUpdates();
- StatusComments();
- MessageBox();
- DeleteComment();
- DeleteStatus();
- });
- function MessageBox() {
- // Status MessageBox
- var textholder = $('#StatusMessageMessage').val();
- $('#StatusMessageMessage').focus(function () {
- if ($(this).val() == textholder) $(this).val("");
- $(this).animate({
- "height": "48px",
- }, "fast");
- $('.share').slideDown("fast");
- $(this).TextAreaExpander(48, 75);
- });
- $('#StatusMessageMessage').blur(function () {
- if ($(this).val() == "") {
- $(this).val(textholder);
- $('.share').slideUp("fast");
- $(this).animate({
- "height": "18px"
- }, "fast");
- }
- });
- // Comment Box
- $('.user-comment').click(function () {
- var id = $(this).attr('id');
- $("#commentbox-" + id).slideToggle("fast", function () {
- $("#commentbox-" + id + " .comment" + id).focus();
- });
- return false;
- });
- var textholder1 = $('.commenttextarea').val();
- $('.commenttextarea').focus(function () {
- if ($(this).val() == textholder1) $(this).val("");
- $(this).TextAreaExpander(35, 75);
- });
- $('.commenttextarea').blur(function () {
- if ($(this).val() == "") {
- $(this).val(textholder1);
- }
- });
- }
- function StatusUpdates() {
- $('#updateStatus').submit(function () {
- $(this).ajaxSubmit(options);
- return false; // prevent a new request
- });
- var options = {
- target: '.user-status',
- // target element(s) to be updated with server response
- beforeSubmit: showRequest,
- // pre-submit callback
- success: showResponse,
- // post-submit callback
- // other available options:
- //url: url // override for form's 'action' attribute
- //type: type // 'get' or 'post', override for form's 'method' attribute
- //dataType: null // 'xml', 'script', or 'json' (expected server response type)
- //clearForm: true // clear all form fields after successful submit
- resetForm: true // reset the form after successful submit
- // $.ajax options can be used here too, for example:
- //timeout: 3000
- };
- function showRequest(formData, jqForm, options) {
- var textbox = $('#StatusMessageMessage').val();
- if ((textbox == '') || (textbox == "What have you been eating ?")) {
- alert('Please Enter Something and click submit.');
- return false;
- } else {
- $('#StatusMessageMessage').attr('disabled', true);
- }
- }
- function showResponse(responseText, statusText, xhr, $form) {
- $('#StatusMessageMessage').attr('disabled', false);
- $('.share').slideUp("fast");
- $('#StatusMessageMessage').animate({
- "height": "18px"
- }, "fast");
- }
- }
- function StatusComments() {
- $('.comment').click(function(e) {
- e.preventDefault();
- $(this).ajaxSubmit(options);
- return false;
- });
- var options = {
- beforeSubmit: showRequest,
- success: showResponse,
- resetForm: true
- };
- function showRequest(formData, jqForm, options) {
- var textbox = $('#StatusMessageReplyMessage').val();
- alert(textbox);
- }
- function showResponse(responseText, statusText, xhr, $form) {
- }
- }
- // Delete Comment
- function DeleteComment() {
- $('.comment-delete').click(function () {
- if (confirm("Are you sure you wanna delete the comment ?")) {
- var deleteID = $(this).attr('id');
- $.ajax({
- url: "account/deleteComment/" + deleteID,
- success: function () {
- $("#comment-" + deleteID).slideUp("fast");
- }
- });
- }
- return false;
- });
- }
- // Delete Status Message
- function DeleteStatus() {
- $('.status-delete').click(function () {
- if (confirm("Are you sure you wanna delete the Status Message ?")) {
- var deleteID = $(this).attr('id');
- $.ajax({
- url: "account/deleteStatus/" + deleteID,
- success: function () {
- $("#record-" + deleteID).slideUp("fast");
- }
- });
- }
- return false;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement