|
|
|
@ -31,7 +31,7 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
@@ -31,7 +31,7 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
|
|
|
|
|
|
|
|
|
|
BuddyTree.prototype.create = function(id, scope) { |
|
|
|
|
|
|
|
|
|
var sort = scope.displayName ? scope.displayName : "user "+scope.buddyIndexSortable+" "+id; |
|
|
|
|
var sort = scope.displayName ? scope.displayName : "session "+scope.buddyIndexSortable+" "+id; |
|
|
|
|
var data = { |
|
|
|
|
id: id, |
|
|
|
|
sort: sort + "z" + id |
|
|
|
@ -138,13 +138,17 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
@@ -138,13 +138,17 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
|
|
|
|
|
$element.on("mouseenter mouseleave", ".buddy", _.bind(function(event) { |
|
|
|
|
// Hover handler for on Buddy actions.
|
|
|
|
|
var buddyElement = $(event.currentTarget); |
|
|
|
|
this.hover(buddyElement, event.type === "mouseenter" ? true : false, buddyElement.scope().user.Id); |
|
|
|
|
this.hover(buddyElement, event.type === "mouseenter" ? true : false, buddyElement.scope().session.Id); |
|
|
|
|
}, this)); |
|
|
|
|
$element.on("click", ".buddy", _.bind(function(event) { |
|
|
|
|
var buddyElement = $(event.currentTarget); |
|
|
|
|
buddyElement.scope().doDefault(); |
|
|
|
|
}, this)); |
|
|
|
|
$element.attr("data-xthreshold", "10"); |
|
|
|
|
$element.on("swipeleft", ".buddy", _.bind(function(event) { |
|
|
|
|
event.preventDefault(); |
|
|
|
|
var buddyElement = $(event.currentTarget); |
|
|
|
|
this.hover(buddyElement, !buddyElement.hasClass("hovered"), buddyElement.scope().user.Id); |
|
|
|
|
this.hover(buddyElement, !buddyElement.hasClass("hovered"), buddyElement.scope().session.Id); |
|
|
|
|
}, this)); |
|
|
|
|
|
|
|
|
|
$window.setInterval(_.bind(this.soundLoop, this), 500); |
|
|
|
@ -184,7 +188,8 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
@@ -184,7 +188,8 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
|
|
|
|
|
Buddylist.prototype.onBuddyScope = function(scope) { |
|
|
|
|
|
|
|
|
|
scope.element = null; |
|
|
|
|
scope.doDefault = function(id) { |
|
|
|
|
scope.doDefault = function() { |
|
|
|
|
var id = scope.session.Id; |
|
|
|
|
if (scope.status.isMixer) { |
|
|
|
|
return scope.doAudioConference(id); |
|
|
|
|
} |
|
|
|
@ -355,18 +360,18 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
@@ -355,18 +360,18 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Buddylist.prototype.onJoined = function(user) { |
|
|
|
|
Buddylist.prototype.onJoined = function(session) { |
|
|
|
|
|
|
|
|
|
//console.log("Joined", user);
|
|
|
|
|
var id = user.Id; |
|
|
|
|
//console.log("Joined", session);
|
|
|
|
|
var id = session.Id; |
|
|
|
|
var scope = buddyData.get(id, this.$scope, _.bind(this.onBuddyScope, this)); |
|
|
|
|
scope.user = user; |
|
|
|
|
scope.session = session; |
|
|
|
|
buddyCount++; |
|
|
|
|
if (user.Status) { |
|
|
|
|
if (scope.status && scope.status.Rev >= user.Status.Rev) { |
|
|
|
|
console.warn("Received old status update in join", user.Status.Rev, scope.status.Rev); |
|
|
|
|
if (session.Status) { |
|
|
|
|
if (scope.status && scope.status.Rev >= session.Status.Rev) { |
|
|
|
|
console.warn("Received old status update in join", session.Status.Rev, scope.status.Rev); |
|
|
|
|
} else { |
|
|
|
|
scope.status = user.Status; |
|
|
|
|
scope.status = session.Status; |
|
|
|
|
scope.displayName = scope.status.displayName; |
|
|
|
|
this.updateBuddyPicture(scope.status); |
|
|
|
|
} |
|
|
|
@ -380,14 +385,14 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
@@ -380,14 +385,14 @@ define(['underscore', 'modernizr', 'avltree', 'text!partials/buddy.html', 'text!
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
Buddylist.prototype.onLeft = function(user) { |
|
|
|
|
Buddylist.prototype.onLeft = function(session) { |
|
|
|
|
|
|
|
|
|
//console.log("Left", user);
|
|
|
|
|
var id = user.Id; |
|
|
|
|
//console.log("Left", session);
|
|
|
|
|
var id = session.Id; |
|
|
|
|
this.tree.remove(id); |
|
|
|
|
var scope = buddyData.get(id); |
|
|
|
|
if (!scope) { |
|
|
|
|
//console.warn("Trying to remove buddy with no registered scope", user);
|
|
|
|
|
//console.warn("Trying to remove buddy with no registered scope", session);
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
if (buddyCount>0) { |
|
|
|
|