Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var chatbox = {
- // Ajax URLs
- listenURL: null,
- sendURL: null,
- // Current site
- // Used to return chat for a certain game site
- // Gets different chat depending on the game
- game: null,
- // Logged in status
- auth: false,
- // DOM
- $chatbox: $('.chatbox'),
- $input: chatbox.$chatbox.find('.input input'),
- $box: chatbox.$chatbox.find('.inner'),
- setListenUrl: function(url) {
- chatbox.listenURL = url;
- },
- setSendURL: function(url) {
- chatbox.sendURL = url
- },
- setGame: function(game) {
- chatbox.game = game;
- },
- setAuth: function(auth) {
- chatbox.auth = auth;
- },
- // Setup chat feature
- init: function()
- {
- setInterval(chatbox.listen, 1000);
- },
- // listen for new chats
- listen: function()
- {
- $.getJSON(chatbox.listenUR + '?game=' + chatbox.game, function(response) {
- console.table(response);
- });
- },
- // send chat
- send: function()
- {
- },
- addMessage: function(author, message)
- {
- var $msg = $('<div class="message"></div>');
- var $p = $('<p><span class="author">'+author+'</span>' + message + '</p>');
- $p.appendTo($msg);
- $inner.append( $msg.html() );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement