Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function selectNick(el) {
- document.getElementById('chat_msg').value = el.innerHTML + ', ';
- return false;
- }
- function show() {
- $(".result_message").html("");
- var $xhr = $.getJSON("/api/game/chat/chat_display.php?chat=public");
- $xhr.done(function (messages) {
- $.each(messages, function (index, message)
- {
- $(".result_message").append(
- "<div class='block_inside'>" +
- "<div class='block_info'>" +
- "<div class='user no_padd'>" +
- "<label for='2' class='no_margin'>" +
- "<span class='flag inline'><span class='flag_country_"+message.flag+"'></span></span>" +
- "<div>" +
- "<span class='info'>Ур.<span class='yellow'>"+message.level+"</span></span>" +
- "<a href='#' onclick='selectNick(this)' class='green'>" + message.login + "</a>" +
- "<a href='/profile/enemy/info/" + message.user_id + "'><span class='icon_info'></span></a>" +
- "</div>" +
- "</label>" +
- "</div>" +
- "<div class='fl_right'><p>" + message.date + "</p></div>" +
- "<div class='clearFix'></div>" +
- "<p>" + message.text + "</p>" +
- "</div>" +
- "</div>" +
- "<div class='divider marg_top_5 marg_bot_5'></div>"
- );
- });
- });
- }
- function new_message() {
- var message = $("#chat_msg").val();
- if (message != '') {
- $.post('/api/game/chat/chat_new_mesage.php?chat=public', {data: message},
- function (response) {
- $("#validation").html("");
- $('#formx').trigger('reset');
- show();
- });
- } else {
- $("#validation").html("<div class='message padd_top_10 padd_bot_10 red'><div><p>ВНИМАНИЕ! нельзя отправить пустое сообщение</p></div></div>");
- }
- }
- show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement