mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-06 22:30:57 +00:00
BetterTTV Integration
This commit is contained in:
parent
cc71863800
commit
4e6942e2f3
11 changed files with 576 additions and 100 deletions
|
@ -6,8 +6,6 @@ var FFZ = window.FrankerFaceZ,
|
|||
// --------------------
|
||||
|
||||
FFZ.prototype.build_ui_link = function(view) {
|
||||
// TODO: Detect dark mode from BTTV.
|
||||
|
||||
var link = document.createElement('a');
|
||||
link.className = 'ffz-ui-toggle';
|
||||
link.innerHTML = constants.CHAT_BUTTON;
|
||||
|
@ -22,14 +20,28 @@ FFZ.prototype.build_ui_link = function(view) {
|
|||
FFZ.prototype.update_ui_link = function(link) {
|
||||
var controller = App.__container__.lookup('controller:chat');
|
||||
link = link || document.querySelector('a.ffz-ui-toggle');
|
||||
if ( !link || !controller ) return;
|
||||
if ( !link || !controller ) return this.log("No button.");
|
||||
|
||||
var room_id = controller.get('currentRoom.id'),
|
||||
room = this.rooms[room_id],
|
||||
has_emotes = room && room.sets.length > 0;
|
||||
has_emotes = false,
|
||||
|
||||
if ( has_emotes )
|
||||
link.classList.remove('no-emotes');
|
||||
else
|
||||
link.classList.add('no-emotes');
|
||||
dark = (this.has_bttv ? BetterTTV.settings.get('darkenedMode') : false),
|
||||
blue = (this.has_bttv ? BetterTTV.settings.get('showBlueButtons') : false);
|
||||
|
||||
|
||||
// Check for emoticons.
|
||||
if ( room && room.sets.length ) {
|
||||
for(var i=0; i < room.sets.length; i++) {
|
||||
var set = this.emote_sets[room.sets[i]];
|
||||
if ( set && set.count > 0 ) {
|
||||
has_emotes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
link.classList.toggle('no-emotes', ! has_emotes);
|
||||
link.classList.toggle('dark', dark);
|
||||
link.classList.toggle('blue', blue);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue