Вход Регистрация
Файл: adultscript-2.0.3-pro/files/templates/defboot/js/profile.js
Строк: 262
<?php
$(document).ready(function() {
    var 
user_id    = $("input[name='user_id']").val();
    
    $(
"#more-info").click(function(e) {
        if ($(
this).hasClass('show-more')) {
            $(
this).removeClass('show-more').addClass('show-less');
            $(
this).text(show_less);
            $(
".more").show();
        } else {
            $(
this).removeClass('show-less').addClass('show-more');
            $(
this).text(show_more);
            $(
".more").hide();
        }
    });

    $(
"#connect-friend").on('click''button#profile-friend-del, button#profile-friend-add', function() {
        var 
action = $(this).attr('id').match(/profile-friend-(.*)/)[1];
        
        $.
ajax({
            
urlbase_url '/ajax.php?s=friend_' action,
            
cachefalse,
            
type"POST",
            
dataType"json",
            
data: { user_iduser_id },
            
success: function(response){
                if (
response.status == '1') {
                    $(
"#connect-response").removeClass('alert-danger').addClass('alert-success');
                } else {
                    $(
"#connect-response").removeClass('alert-success').addClass('alert-danger');
                }
                
                if (
response.code != '') {
                      $(
"#connect-friend").html(response.code);
                }
                
                $(
"#connect-response").append(response.msg);
                $(
"#connect-response").show();
            }
        });
    }); 

    $(
"#connect-subscribe").on('click''button#profile-subscribe-del, button#profile-subscribe-add', function() {
        var 
action = $(this).attr('id').match(/profile-subscribe-(.*)/)[1];
        
        $.
ajax({
            
urlbase_url '/ajax.php?s=subscribe_' action,
            
cachefalse,
            
type"POST",
            
dataType"json",
            
data: { user_iduser_id },
            
success: function(response){
                if (
response.status == '1') {
                    $(
"#connect-response").removeClass('alert-danger').addClass('alert-success');
                } else {
                    $(
"#connect-response").removeClass('alert-success').addClass('alert-danger');
                }
                
                if (
response.code != '') {
                      $(
"#connect-subscribe").html(response.code);
                }
                
                $(
"#connect-response").append(response.msg);
                $(
"#connect-response").show();
            }
        });
    }); 

    $(
"#connect-block").on('click''button#profile-block-del, button#profile-block-add', function() {
        var 
action = $(this).attr('id').match(/profile-block-(.*)/)[1];
        
        $.
ajax({
            
urlbase_url '/ajax.php?s=block_' action,
            
cachefalse,
            
type"POST",
            
dataType"json",
            
data: { user_iduser_id },
            
success: function(response){
                if (
response.status == '1') {
                    $(
"#connect-response").removeClass('alert-danger').addClass('alert-success');
                } else {
                    $(
"#connect-response").removeClass('alert-success').addClass('alert-danger');
                }
                
                if (
response.code != '') {
                      $(
"#connect-block").html(response.code);
                }
                
                $(
"#connect-response").append(response.msg);
                $(
"#connect-response").show();
            }
        });
    }); 

    $(
"button[id='profile-report-add']").click(function(e) {
        
e.preventDefault();
        
        $.
ajax({
            
urlbase_url '/ajax.php?s=report',
            
cachefalse,
            
type"POST",
            
dataType"json",
            
data: { user_iduser_id },
            
success: function(response) {
                if (
response.status == '1') {
                    $(
"#connect-response").removeClass('alert-danger').addClass('alert-success');
                } else {
                    $(
"#connect-response").removeClass('alert-success').addClass('alert-danger');
                }
                
                $(
"#connect-report").html(response.code);
                $(
"#connect-response").html(response.msg);
                $(
"#connect-response").show();
            }
        });
    });
    
    $(
"button[id='post-comment']").click(function(e) {
          
e.preventDefault();
    
        var 
comment  = $("textarea[name='comment']").val();
        var 
error    false;
        var 
message  'Your message has been posted!';

        if (
comment == '') {
            
message 'Please enter message!';
            
error   true;
        } else if (
comment.length 500) {
            
message 'Comment can contain maximum 500 characters!';
            
error   true;
        }
    
        if (
error) {
            $(
"#response-comment").html(close message);
            $(
"#response-comment").removeClass('alert-succes').addClass('alert-danger');
            $(
"#response-comment").show();
            
            return;
        }
        
        $.
ajax({
            
urlbase_url '/ajax.php?s=comment',
            
cachefalse,
            
type"POST",
            
dataType"json",
            
data: { user_iduser_idcommentcomment},
            
success: function(response) {
                if (
response.status == '1') {
                    $(
"textarea[name='comment']").val('');
                    $(
"#no-comments").hide();
                    $(
"#comments-container").prepend(response.code);                   
                    $(
"#response-comment").removeClass('alert-danger').addClass('alert-success');
                } else {
                    $(
"#response-comment").removeClass('alert-success').addClass('alert-danger');
                }
                
                $(
"#response-comment").html(close response.msg);
                $(
"#response-comment").show();
            }
        });
    });

    $(
"#comments-container").on('click'"button[id^='comment-delete-']", function(e) {
        
e.preventDefault();
        var 
comment_id = $(this).attr('id').match(/comment-delete-(.*)/)[1];

        $.
ajax({
            
urlbase_url '/ajax.php?s=comment_delete',
            
cachefalse,
            
type"POST",
            
dataType"json",
            
data: { comment_idcomment_id },
            
success: function(response) {
                if (
response.status == '1') {
                      $(
"#comment-" comment_id).css('border''1px solid red');
                    $(
"#comment-" comment_id).fadeOut(1000);
                }

                if (!$(
".media:visible").length) {
                      $(
"#comments-container").html('<div id="no-comments" class="none">No comments yet!</div>');
                }
            }
        });
    });
    
    $(
"button[id='comment-pagination']").click(function(e) {
        
e.preventDefault();        
        var 
page        = $("input[name='comment-page']").val();
        $.
ajax({
            
urlbase_url '/ajax.php?s=comment_pagination',
            
cachefalse,
            
type"POST",
            
dataType"json",
            
data: { user_iduser_idpagepage },
            
success: function(response) {
                if (
response.status == '1') {
                      $(
"input[name='comment-page']").val(response.page);
                      $(
"#comments-container").append(response.code);
                      
                      if (
response.end == '1') {
                          $(
"button[id='comment-pagination']").fadeOut();
                      }
                }
            }
        });
    });
});
?>
Онлайн: 3
Реклама