You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
57 lines
1.8 KiB
function get_comment_action_parent(block){
|
|
var search = true;
|
|
if (!block.attr('readable_comment')) {
|
|
while (search) {
|
|
if (block.parent().attr('readable_comment')) {
|
|
search = false;
|
|
return block.parent();
|
|
} else {
|
|
block = block.parent()
|
|
}
|
|
}
|
|
} else {
|
|
return block;
|
|
}
|
|
}
|
|
|
|
window.results = {};
|
|
$( document.body ).on( "mouseover", "[readable_comment]", function( event ) {
|
|
var b = get_comment_action_parent($(event.target)).attr('readable_comment');
|
|
if (!(b in window.results)){
|
|
read_comment(b);
|
|
window.results[b] = undefined;
|
|
}
|
|
});
|
|
function read_comment(comment_id){
|
|
// Прочитать комментарий
|
|
$.ajax({type: 'POST',url: '/management/read_comment',data: {'comment': comment_id}});
|
|
}
|
|
|
|
function load_comment(id){
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '/courses/load_comment',
|
|
data: {'id': id},
|
|
success: function(data) {
|
|
if (data['code'] == '1'){
|
|
return data['data'];
|
|
} else {
|
|
return undefined;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function do_delete_comment(id, text){
|
|
$.ajax({
|
|
type: 'POST',
|
|
url: '/courses/delete_comment',
|
|
data: {'comment': id, 'text': text},
|
|
success: function(data){
|
|
if (data['code'] == '1'){
|
|
$('[name=comment'+id+']').fadeOut('slow');
|
|
} else {
|
|
show_system_message(data['response'])
|
|
}
|
|
}
|
|
});
|
|
} |