1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-07-28 21:48:31 +00:00

Added basic support for highlighting arbitrary words in chat. Added capitalization to auto-completion entries.

This commit is contained in:
SirStendec 2015-01-20 20:25:26 -05:00
parent 343a9c927b
commit 3d68cd45ab
5 changed files with 186 additions and 14 deletions

View file

@ -211,6 +211,7 @@ FFZ.prototype._load_room_json = function(room_id, callback, data) {
FFZ.prototype._modify_room = function(room) {
var f = this;
room.reopen({
// Track which rooms the user is currently in.
init: function() {
this._super();
f.add_room(this.id, this);
@ -221,6 +222,18 @@ FFZ.prototype._modify_room = function(room) {
f.remove_room(this.id);
},
getSuggestions: function() {
// This returns auto-complete suggestions for use in chat. We want
// to apply our capitalizations here. Overriding the
// filteredSuggestions property of the chat-input component would
// be even better, but I was already hooking the room model.
var suggestions = this._super();
if ( localStorage.ffzCapitalize != 'false' )
suggestions = _.map(suggestions, FFZ.get_capitalization);
return suggestions;
},
send: function(text) {
var cmd = text.split(' ', 1)[0].toLowerCase();
if ( cmd === "/ffz" ) {