Файл: adultscript-2.0.3-pro/files/mobile/templates/default/js/jquery.profile-1.0.js
Строк: 133
<?php
$(document).ready(function() {
$("button[id^='profile-friend-']").on('click', function() {
var id = $(this).attr('id');
var user_id = $("input[name='user_id']").val();
var action = id.slice(id.lastIndexOf("-")+1).toLowerCase();
$.ajax({
url: mobile_url + '/ajax.php?s=friend_' + action + '&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { user_id: user_id },
success: function(response) {
reloadPage();
}
});
});
$("button[id^='profile-subscribe-']").on('click', function() {
var id = $(this).attr('id');
var user_id = $("input[name='user_id']").val();
var action = id.slice(id.lastIndexOf("-")+1);
$.ajax({
url: mobile_url + '/ajax.php?s=subscribe_' + action + '&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { user_id: user_id },
success: function(response) {
reloadPage();
}
});
});
$("button[id^='profile-block-']").on('click', function(e) {
e.preventDefault();
var id = $(this).attr('id');
var user_id = $("input[name='user_id']").val();
var action = id.slice(id.lastIndexOf("-")+1).toLowerCase();
$.ajax({
url: mobile_url + '/ajax.php?s=block_' + action + '&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { user_id: user_id },
success: function(response) {
reloadPage();
}
});
});
$("button[id='profile-report-add']").click(function(e) {
e.preventDefault();
var user_id = $("input[name='user_id']").val();
$.ajax({
url: mobile_url + '/ajax.php?s=report&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { user_id: user_id },
success: function(response) {
reloadPage();
}
});
});
$("button[id='post-comment']").on('click', function() {
var user_id = $("input[name='user_id']").val();
var comment = $("textarea[name='comment']").val();
$.ajax({
url: mobile_url + '/ajax.php?s=comment_user&d=mobile',
cache: false,
type: "POST",
dataType: "json",
data: { user_id: user_id, comment: comment },
success: function(response) {
if (response.status == '1') {
$("textarea[name='comment']").val('');
$("li[id='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^='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=comment_user_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');
}
}
});
});
$("a[id^='spam-']").click(function(e) {
e.preventDefault();
var split = $(this).attr('id').split('-');
var type = split[1];
var comment_id = split[2];
var parent_id = split[3];
$.ajax({
url: base_url + '/ajax.php?s=spam',
cache: false,
type: "POST",
dataType: "json",
data: { type: type, comment_id: comment_id, parent_id: parent_id },
success: function(response) {
$("span[id='spam-" + type + "-" + comment_id + "']").html(response.msg);
}
});
});
});
?>