Skip to content
This repository has been archived by the owner on Oct 29, 2022. It is now read-only.

Commit

Permalink
Tweaked the user focus chat js, so that clicking on a name within a m…
Browse files Browse the repository at this point in the history
…essage never toggles off the focus of the sender.

Bumped to 1.6.14
  • Loading branch information
cene-co-za committed Aug 6, 2016
1 parent 42abaf6 commit f164fcb
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 21 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name" : "destiny/website",
"description": "Destiny.gg website",
"license": "proprietary",
"version": "1.6.13",
"version": "1.6.14",
"minimum-stability": "dev",
"require": {
"php" : ">=5.3.0",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Destiny",
"version": "1.6.13",
"version": "1.6.14",
"description": "Destiny.gg front-end",
"main": "GruntFile.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions static/chat/js/chat.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/chat/js/chat.min.js.map

Large diffs are not rendered by default.

46 changes: 33 additions & 13 deletions static/chat/js/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,10 @@
return false;
});

this.lines.on('mousedown', 'div.user-msg .chat-user', function() {
this.lines.on('mousedown', '.user-msg .chat-user', function() {
var username1 = $(this).closest('.user-msg').data('username');
var username2 = this.textContent.toLowerCase();
chat.toggleUserFocus(username1);
chat.addUserFocus(username1);
chat.toggleUserFocus(username2);
return false;
});
Expand Down Expand Up @@ -441,24 +441,44 @@
return this;
},

addUserFocusRule: function(username){
this.stylesheet.insertRule('.user-msg[data-username="' + username + '"]{opacity:1 !important;}', this.focusedUsers.length); // max 4294967295
this.focusedUsers.push(username);
this.ui.toggleClass('focus-user', this.focusedUsers.length > 0);
},

removeUserFocusRule: function(username, index){
this.stylesheet.deleteRule(index);
this.focusedUsers.splice(index, 1);
this.ui.toggleClass('focus-user', this.focusedUsers.length > 0);
},

clearUserFocus: function(){
for(var i=0; i<this.stylesheet.cssRules.length; ++i)
this.stylesheet.deleteRule(0);
this.focusedUsers = [];
for(var i=this.focusedUsers.length-1; i>=0; --i)
this.removeUserFocusRule(this.focusedUsers[i], i);
this.ui.toggleClass('focus-user', false);
},

addUserFocus: function(username){
if(username && this.focusedUsers.indexOf(username) === -1)
this.addUserFocusRule(username);
},

removeUserFocus: function(username){
if(!username) return;
username = username.toLowerCase();
var index = this.focusedUsers.indexOf(username);
if(index !== -1) this.removeUserFocusRule(username, index);
},

toggleUserFocus: function(username) {
if(!username) return;
username = username.toLowerCase();
var index = this.focusedUsers.indexOf(username);
if(index === -1){
this.stylesheet.insertRule('.user-msg[data-username="' + username + '"]{opacity:1 !important;}', this.focusedUsers.length);
this.focusedUsers.push(username);
} else {
this.stylesheet.deleteRule(index);
this.focusedUsers.splice(index, 1);
}
this.ui.toggleClass('focus-user', this.focusedUsers.length > 0);
if(index === -1)
this.addUserFocus(username);
else
this.removeUserFocus(username, index);
},

loadBacklog: function() {
Expand Down
2 changes: 1 addition & 1 deletion static/web/js/destiny.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/web/js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ $(function(){
updateStatus(status);
}
});
}, 30000);
}, 60000);

a.src = a.css('background-image');
a.animated = 'url('+ a.data('animated') +')';
Expand Down

0 comments on commit f164fcb

Please sign in to comment.