Вход Регистрация
Файл: adultscript-2.0.3-pro/files/mobile/templates/default/js/jquery.photo-1.0.js
Строк: 143
<?php
$(document).ready(function() {
    $(
"button[id^='rate-']").click(function(e) {
        
e.preventDefault();
        
        var 
rating     = 5;
        if ($(
this).attr('id') == 'rate-down') {
            
rating      = 0;
        }
        
        var 
photo_id = $("input[name='photo_id']").val();
        
        $.
ajax({
              
url: mobile_url + '/ajax.php?s=photo_rate&d=mobile',
            
cache: false,
            
type: "POST",
            
dataType: "json",
            
data: {rating: rating, photo_id: photo_id},
            
success: function(response) {
                  if (
response.status == '1') {
                      $(
"span#rating-result").html(response.code);
                  } 
                  
                  $(
"#response").html(response.msg);
                  $(
"#response").show();    
            }
        });
    });

    $(
"button[id='post-comment']").click(function(e) {
          
e.preventDefault();
    
        var 
photo_id = $("input[name='photo_id']").val();
        var 
comment  = $("textarea[name='comment']").val();
        var 
nickname = $("input[name='nickname']").val();
        
        $(
this).val('Please wait...');

        $.
ajax({
            
url: mobile_url + '/ajax.php?s=photo_comment&d=mobile',
            
cache: false,
            
type: "POST",
            
dataType: "json",
            
data: { photo_id: photo_id, comment: comment, nickname: nickname },
            
success: function(response) {
                if (
response.status == '1') {
                    $(
"textarea[name='comment']").val('');
                    $(
"li#comments-post-container").after(response.code);
                    $(
"#comments").listview('refresh');
                      $(
"#response-comment").removeClass('error').addClass('success');
                } else {
                      $(
"#response-comment").removeClass('success').addClass('error');
                }
      
                $(
"#response-comment").html(response.msg);
                $(
"#response-comment").show();
            }
        });
    });

    $(
"button[id='favorite']").click(function(e) {
          
e.preventDefault();
    
        var 
photo_id = $("input[name='photo_id']").val();
        
        $.
ajax({
            
url: mobile_url + '/ajax.php?s=photo_favorite&d=mobile',
            
cache: false,
            
type: "POST",
            
dataType: "json",
            
data: { photo_id: photo_id },
            
success: function(response) {
                if (
response.status == '1') {
                      $(
"#favorite-result").html('<strong>' + response.code + '</strong>');
                      $(
"#response").removeClass('error').addClass('success');
                } else {
                      $(
"#response").removeClass('success').addClass('error');
                }
      
                $(
"#response").html(response.msg);
                $(
"#response").show();
            }
        });
    });
    
    $(
"button[id='more-comments']").click(function(e) {
        
e.preventDefault();
            
        var 
photo_id    = $("input[name='photo_id']").val();
        var 
page        = $("input[name='page']").val();

        $.
ajax({
            
url: mobile_url + '/ajax.php?s=photo_comment_pagination&d=mobile',
            
cache: false,
            
type: "POST",
            
dataType: "json",
            
data: { photo_id: photo_id, page: page },
            
success: function(response) {
                if (
response.status == '1') {
                      $(
"#comments").append(response.code).listview('refresh');
                      $(
"input[name='page']").val(response.page);
                      if (
response.end == '1') {
                          $(
"button[id='more-comments']").hide();
                      }
                }
            }
        });
    });    
    
    $(
"button[id^='comment-delete-']").on('click', function(e) {
        
e.preventDefault();
        var 
comment_id = $(this).attr('id').match(/comment-delete-(.*)/)[1];

        $.
ajax({
            
url: mobile_url + '/ajax.php?s=photo_comment_delete&d=mobile',
            
cache: false,
            
type: "POST",
            
dataType: "json",
            
data: { comment_id: comment_id },
            
success: function(response) {
                if (
response.status == '1') {
                    $(
"li#comment-" + comment_id).hide();
                }
                
                if (!$(
".comment:visible").length) {
                    $(
"#comments-post-container").after('<li class="none">No comments yet!</div>');
                    $(
"#comments").listview('refresh');
                }
            }
        });
    });    
});
?>
Онлайн: 0
Реклама