Файл: monst/core/j/chat.js
Строк: 78
<?php
var limit = 15;
function private_mess() {
var val = $("#p").text();
if ( val == 1 ) {
$("#p").empty();
$("#private_mess").css('color', '#333');
} else {
$("#p").append('1');
$("#private_mess").css('color', 'orangered');
}
}
function close_options() {
$("#options_div").slideUp();
$("#to_id").empty();
}
function add_mess() {
var to_id = $("#to_id").text();
var mess = $("#mess").val();
var p = parseInt($("#p").text());
mess = encodeURIComponent(mess);
$.ajax({
type: "POST",
url: "/core/jphp/chat/add_mess.php",
data: "mess=" + mess + "&to_id=" + to_id + "&p=" + p + "&room=" + room,
success: function(html) {
// alert(html);
load_mess();
$("#mess").val('');
}
});
}
function chat_online() {
$.ajax({
type: "POST",
url: "/core/jphp/chat/online.php",
data: "room=1 ",
success: function(html) {
$("#chat_online").empty();
$("#chat_online").append(html);
}
});
}
function load_mess(go_to_bottom) {
$.ajax({
type: "POST",
url: "/core/jphp/chat/load_mess.php",
data: "room=" + room,
success: function(html) {
$("#messages").empty();
$("#messages").append(html);
if ( go_to_bottom == 1) {
// window.location = '#bottom';
}
}
});
}
function key_down(e) {
if(e.keyCode == 13) {
add_mess();
}
}
function history() {
limit = limit + 15;
$.ajax({
type: "POST",
url: "/core/jphp/chat/load_mess.php",
data: "room=" + room + "&limit=" + limit,
success: function(html) {
$("#messages").empty();
$("#messages").append(html);
// window.location.href = mess_history_link;
}
});
}
function to(name, id, im) {
$("#options_div").slideDown(100);
$("#to").empty();
$("#to").append('<img src="' + im + '" alt="" width="30" class="av" style="margin-right: 5px; float: left;"/>' + name);
$("#to_id").empty();
$("#to_id").append(id);
}
function addTyping(user_id) {
$.ajax({
type: "POST",
url: "/core/jphp/chat/typing.php",
data: "s=add&user_id=" + user_id,
success: function(html) {
}
});
}
function typingUpd() {
$.ajax({
type: "POST",
url: "/core/jphp/chat/typing.php",
data: "s=upd",
success: function(html) {
}
});
}
function typingGET() {
$.ajax({
type: "POST",
url: "/core/jphp/chat/typing.php",
data: "s=GET",
success: function(html) {
$("#typing").empty();
$("#typing").append(html);
}
});
}
?>