|
|
@ -6,12 +6,14 @@ var socket,
|
|
|
|
|
|
|
|
|
|
|
|
// todo: cleanup,etc
|
|
|
|
// todo: cleanup,etc
|
|
|
|
(function() {
|
|
|
|
(function() {
|
|
|
|
|
|
|
|
RELATIVE_PATH = $('#relative_path').val();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadConfig(callback) {
|
|
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
$.ajax({
|
|
|
|
url: '/forum/config.json?v=' + new Date().getTime(),
|
|
|
|
url: RELATIVE_PATH + '/config.json?v=' + new Date().getTime(),
|
|
|
|
success: function(data) {
|
|
|
|
success: function(data) {
|
|
|
|
API_URL = data.api_url;
|
|
|
|
API_URL = data.api_url;
|
|
|
|
RELATIVE_PATH = data.relative_path;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
config = data;
|
|
|
|
config = data;
|
|
|
|
socket = io.connect(config.socket.address + (config.socket.port ? ':' + config.socket.port : ''));
|
|
|
|
socket = io.connect(config.socket.address + (config.socket.port ? ':' + config.socket.port : ''));
|
|
|
@ -68,6 +70,23 @@ var socket,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('api:user.get_online_users', function(users) {
|
|
|
|
|
|
|
|
jQuery('.username-field').each(function() {
|
|
|
|
|
|
|
|
if (this.processed === true) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var el = jQuery(this),
|
|
|
|
|
|
|
|
uid = el.parents('li').attr('data-uid');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uid && jQuery.inArray(uid, users) !== -1) {
|
|
|
|
|
|
|
|
el.prepend('<i class="icon-circle"></i> ');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
el.prepend('<i class="icon-circle-blank"></i> ');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
el.processed = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
function showDisconnectModal() {
|
|
|
|
function showDisconnectModal() {
|
|
|
|
$('#disconnect-modal').modal({
|
|
|
|
$('#disconnect-modal').modal({
|
|
|
|
backdrop:'static',
|
|
|
|
backdrop:'static',
|
|
|
@ -79,9 +98,12 @@ var socket,
|
|
|
|
window.location.reload();
|
|
|
|
window.location.reload();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
callback();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
async: false
|
|
|
|
async: false
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// takes a string like 1000 and returns 1,000
|
|
|
|
// takes a string like 1000 and returns 1,000
|
|
|
|
app.addCommas = function(text) {
|
|
|
|
app.addCommas = function(text) {
|
|
|
@ -209,24 +231,16 @@ var socket,
|
|
|
|
}, 100);
|
|
|
|
}, 100);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
socket.on('api:user.get_online_users', function(users) {
|
|
|
|
|
|
|
|
jQuery('.username-field').each(function() {
|
|
|
|
|
|
|
|
if (this.processed === true) return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var el = jQuery(this),
|
|
|
|
|
|
|
|
uid = el.parents('li').attr('data-uid');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (uid && jQuery.inArray(uid, users) !== -1) {
|
|
|
|
|
|
|
|
el.prepend('<i class="icon-circle"></i> ');
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
el.prepend('<i class="icon-circle-blank"></i> ');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
el.processed = true;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
jQuery('document').ready(function() {
|
|
|
|
jQuery('document').ready(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadConfig(function () {});
|
|
|
|
|
|
|
|
|
|
|
|
app.enter_room('global');
|
|
|
|
app.enter_room('global');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|