focus on topic creator after selecting metacode set
This commit is contained in:
parent
c2b21ecc13
commit
cac3a7c93b
2 changed files with 55 additions and 49 deletions
|
@ -276,6 +276,7 @@ function updateMetacodeSet(set, index, custom) {
|
|||
});
|
||||
|
||||
$('#lightbox_overlay').hide();
|
||||
$('#topic_name').focus();
|
||||
|
||||
var mdata = {
|
||||
"metacodes": {
|
||||
|
@ -288,14 +289,10 @@ function updateMetacodeSet(set, index, custom) {
|
|||
url: "/user/updatemetacodes",
|
||||
data: mdata,
|
||||
success: function (data) {
|
||||
console.log('success updating metacodes');
|
||||
//setTimeout(function () {
|
||||
// $('.metacodeTitle').hide();
|
||||
// $('.showcard .icon').css('z-index', '1');
|
||||
//}, 500);
|
||||
console.log('selected metacodes saved');
|
||||
},
|
||||
error: function () {
|
||||
alert('failed to update metacodes');
|
||||
console.log('failed to save selected metacodes');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ app.configure(function() {
|
|||
}); */
|
||||
|
||||
//var rtg = require("url").parse("redis://redistogo:0ca046a3d56533cc162e2447db383192@pearlfish.redistogo.com:9060/"),
|
||||
//redis = require('redis').createClient(rtg.port, rtg.hostname, {no_ready_check: true});
|
||||
//redis = require('redis').createClient(rtg.port, rtg.hostname, {no_ready_check: true});
|
||||
|
||||
var io = require('socket.io').listen(5001);
|
||||
var redis = require('redis').createClient();
|
||||
|
@ -27,52 +27,61 @@ var redis = require('redis').createClient();
|
|||
//});
|
||||
|
||||
function start() {
|
||||
redis.subscribe('maps');
|
||||
redis.subscribe('maps');
|
||||
|
||||
io.on('connection', function(socket){
|
||||
io.on('connection', function (socket) {
|
||||
|
||||
// this will ping everyone on a map with updates to the map
|
||||
redis.on('message', function(channel, message){
|
||||
console.log(message);
|
||||
var m = JSON.parse(message);
|
||||
var room = 'maps-' + m.mapid;
|
||||
// this will ping everyone on a map with updates to the map
|
||||
redis.on('message', function (channel, message) {
|
||||
console.log(message);
|
||||
var m = JSON.parse(message);
|
||||
var room = 'maps-' + m.mapid;
|
||||
|
||||
socket.emit(room, m);
|
||||
});
|
||||
|
||||
// this will ping a new person with awareness of who's already on the map
|
||||
socket.on('updateNewMapperList', function(data) {
|
||||
var existingUser = { userid: data.userid, username: data.username };
|
||||
socket.broadcast.emit(data.userToNotify + '-' + data.mapid + '-UpdateMapperList', existingUser);
|
||||
});
|
||||
|
||||
// this will ping everyone on a map that there's a person just joined the map
|
||||
socket.on('newMapperNotify', function (data) {
|
||||
socket.set('mapid', data.mapid);
|
||||
socket.set('userid', data.userid);
|
||||
socket.set('username', data.username);
|
||||
|
||||
var newUser = { userid: data.userid, username: data.username };
|
||||
|
||||
socket.broadcast.emit('maps-' + data.mapid + '-newmapper', newUser);
|
||||
});
|
||||
|
||||
// this will ping everyone on a map that there's a person just left the map
|
||||
socket.on('disconnect', function () {
|
||||
var socketUserName, socketUserID;
|
||||
socket.get('userid', function (err, id) {
|
||||
socketUserID = id;
|
||||
socket.emit(room, m);
|
||||
});
|
||||
socket.get('username', function (err, name) {
|
||||
socketUserName = name;
|
||||
});
|
||||
var data = { username: socketUserName, userid: socketUserID };
|
||||
socket.get('mapid', function (err, mapid) {
|
||||
socket.broadcast.emit('maps-' + mapid + '-lostmapper', data);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
// this will ping a new person with awareness of who's already on the map
|
||||
socket.on('updateNewMapperList', function (data) {
|
||||
var existingUser = {
|
||||
userid: data.userid,
|
||||
username: data.username
|
||||
};
|
||||
socket.broadcast.emit(data.userToNotify + '-' + data.mapid + '-UpdateMapperList', existingUser);
|
||||
});
|
||||
|
||||
// this will ping everyone on a map that there's a person just joined the map
|
||||
socket.on('newMapperNotify', function (data) {
|
||||
socket.set('mapid', data.mapid);
|
||||
socket.set('userid', data.userid);
|
||||
socket.set('username', data.username);
|
||||
|
||||
var newUser = {
|
||||
userid: data.userid,
|
||||
username: data.username
|
||||
};
|
||||
|
||||
socket.broadcast.emit('maps-' + data.mapid + '-newmapper', newUser);
|
||||
});
|
||||
|
||||
// this will ping everyone on a map that there's a person just left the map
|
||||
socket.on('disconnect', function () {
|
||||
var socketUserName, socketUserID;
|
||||
socket.get('userid', function (err, id) {
|
||||
socketUserID = id;
|
||||
});
|
||||
socket.get('username', function (err, name) {
|
||||
socketUserName = name;
|
||||
});
|
||||
var data = {
|
||||
username: socketUserName,
|
||||
userid: socketUserID
|
||||
};
|
||||
socket.get('mapid', function (err, mapid) {
|
||||
socket.broadcast.emit('maps-' + mapid + '-lostmapper', data);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
start();
|
Loading…
Reference in a new issue