2015-01-20 01:53:18 -05:00
|
|
|
var FFZ = window.FrankerFaceZ,
|
|
|
|
constants = require('../constants');
|
|
|
|
|
|
|
|
// --------------------
|
|
|
|
// Initialization
|
|
|
|
// --------------------
|
|
|
|
|
|
|
|
FFZ.prototype.build_ui_link = function(view) {
|
|
|
|
var link = document.createElement('a');
|
|
|
|
link.className = 'ffz-ui-toggle';
|
|
|
|
link.innerHTML = constants.CHAT_BUTTON;
|
|
|
|
|
|
|
|
link.addEventListener('click', this.build_ui_popup.bind(this, view));
|
|
|
|
|
|
|
|
this.update_ui_link(link);
|
|
|
|
return link;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FFZ.prototype.update_ui_link = function(link) {
|
2015-05-17 19:02:57 -04:00
|
|
|
var controller = window.App && App.__container__.lookup('controller:chat');
|
2015-01-20 01:53:18 -05:00
|
|
|
link = link || document.querySelector('a.ffz-ui-toggle');
|
|
|
|
if ( !link || !controller )
|
|
|
|
return;
|
|
|
|
|
|
|
|
var room_id = controller.get('currentRoom.id'),
|
|
|
|
room = this.rooms[room_id],
|
|
|
|
has_emotes = false,
|
|
|
|
|
|
|
|
dark = (this.has_bttv ? BetterTTV.settings.get('darkenedMode') : false),
|
|
|
|
blue = (this.has_bttv ? BetterTTV.settings.get('showBlueButtons') : false),
|
|
|
|
live = (this.feature_friday && this.feature_friday.live);
|
|
|
|
|
|
|
|
|
|
|
|
// Check for emoticons.
|
2015-06-05 03:59:28 -04:00
|
|
|
if ( room && room.set ) {
|
|
|
|
var set = this.emote_sets[room.set];
|
|
|
|
if ( set && set.count > 0 )
|
|
|
|
has_emotes = true;
|
2015-01-20 01:53:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
link.classList.toggle('no-emotes', ! has_emotes);
|
|
|
|
link.classList.toggle('live', live);
|
|
|
|
link.classList.toggle('dark', dark);
|
|
|
|
link.classList.toggle('blue', blue);
|
2016-03-23 19:28:22 -04:00
|
|
|
//link.classList.toggle('news', this._has_news);
|
2015-01-12 17:58:07 -05:00
|
|
|
}
|