diff --git a/src/badges.js b/src/badges.js
index 611275b5..1a1c9f5a 100644
--- a/src/badges.js
+++ b/src/badges.js
@@ -9,9 +9,9 @@ var FFZ = window.FrankerFaceZ,
],
badge_css = function(badge) {
- var out = ".badges .ffz-badge-" + badge.id + " { background-color: " + badge.color + '; background-image: url("' + badge.image + '"); ' + (badge.extra_css || "") + '}';
- if ( badge.transparent_image )
- out += ".badges .badge.alpha.ffz-badge-" + badge.id + ",.ffz-transparent-badges .badges .ffz-badge-" + badge.id + ' { background-image: url("' + badge.transparent_image + '"); }';
+ var out = ".badges .ffz-badge-" + badge.id + " { background-color: " + badge.color + '; background-image: url("' + badge.image + '"); ' + (badge.css || "") + '}';
+ if ( badge.alpha_image )
+ out += ".badges .badge.alpha.ffz-badge-" + badge.id + ",.ffz-transparent-badges .badges .ffz-badge-" + badge.id + ' { background-image: url("' + badge.alpha_image + '"); }';
return out;
};
@@ -151,8 +151,10 @@ FFZ.prototype.setup_badges = function() {
s.id = "ffz-badge-css";
document.head.appendChild(s);
- this.log("Adding legacy donor badges.");
- this._legacy_add_donors();
+ this.log("Loading badges.");
+ this.load_badges();
+ //this.log("Adding legacy donor badges.");
+ //this._legacy_add_donors();
}
@@ -161,8 +163,7 @@ FFZ.prototype.setup_badges = function() {
// --------------------
FFZ.ws_commands.reload_badges = function() {
- this._legacy_load_bots();
- this._legacy_load_donors();
+ this.load_badges();
}
@@ -403,13 +404,89 @@ FFZ.prototype.bttv_badges = function(data) {
// --------------------
-// Legacy Support
+// Badge Loading
// --------------------
FFZ.bttv_known_bots = ["nightbot","moobot","sourbot","xanbot","manabot","mtgbot","ackbot","baconrobot","tardisbot","deejbot","valuebot","stahpbot"];
+FFZ.prototype.load_badges = function(callback, tries) {
+ var f = this;
+ jQuery.getJSON(constants.API_SERVER + "v1/badges")
+ .done(function(data) {
+ var badge_total = 0,
+ badge_count = 0;
-FFZ.prototype._legacy_add_donors = function() {
+ for(var i=0; i < data.badges.length; i++) {
+ var badge = data.badges[i];
+ if ( badge && badge.name ) {
+ f._load_badge_json(badge.id, badge);
+ badge_total++;
+ }
+ }
+
+ if ( data.users )
+ for(var badge_id in data.users)
+ if ( data.users.hasOwnProperty(badge_id) && f.badges[badge_id] ) {
+ var badge = f.badges[badge_id],
+ users = data.users[badge_id];
+
+ for(var i=0; i < users.length; i++) {
+ var user = users[i],
+ ud = f.users[user] = f.users[user] || {},
+ badges = ud.badges = ud.badges || {};
+
+ badge_count++;
+ badges[badge.slot] = {id: badge.id};
+ }
+
+ f.log('Added "' + badge.name + '" badge to ' + utils.number_commas(users.length) + ' users.');
+ }
+
+ // Special Badges
+ var zw = f.users.zenwan = f.users.zenwan || {},
+ badges = zw.badges = zw.badges || {};
+ if ( ! badges[1] )
+ badge_count++;
+ badges[1] = {id: 2, image: "//cdn.frankerfacez.com/script/momiglee_badge.png", title: "WAN"};
+
+
+ f.log("Loaded " + utils.number_commas(badge_count) + " total badges across " + badge_total + " types.");
+ typeof callback === "function" && callback(true);
+
+ }).fail(function(data) {
+ if ( data.status === 404 )
+ return typeof callback === "function" && callback(false);
+
+ tries = (tries || 0) + 1;
+ if ( tries < 10 )
+ return setTimeout(f.load_badges.bind(f, callback, tries), 500 + 500*tries);
+
+ f.error("Unable to load badge data. [HTTP Status " + data.status + "]", data);
+ typeof callback === "function" && callback(false);
+ });
+}
+
+
+FFZ.prototype._load_badge_json = function(badge_id, data) {
+ this.badges[badge_id] = data;
+ if ( data.replaces ) {
+ data.replaces_type = data.replaces;
+ data.replaces = true;
+ }
+
+ if ( data.name === 'bot' )
+ data.visible = function(r,user) { return !(this.has_bttv && FFZ.bttv_known_bots.indexOf(user)!==-1); };
+
+ utils.update_css(this._badge_style, badge_id, badge_css(data));
+}
+
+
+
+// --------------------
+// Legacy Support
+// --------------------
+
+/*FFZ.prototype._legacy_add_donors = function() {
// Developer Badge
this.badges[0] = {id: 0, title: "FFZ Developer", color: "#FAAF19", image: "//cdn.frankerfacez.com/script/devicon.png", transparent_image: "//cdn.frankerfacez.com/script/devtransicon.png"};
utils.update_css(this._badge_style, 0, badge_css(this.badges[0]));
@@ -511,4 +588,4 @@ FFZ.prototype._legacy_parse_badges = function(callback, data, slot, badge_id, ti
callback(true, count);
return count;
-}
\ No newline at end of file
+}*/
\ No newline at end of file
diff --git a/src/ember/channel.js b/src/ember/channel.js
index a2882702..8ba72a32 100644
--- a/src/ember/channel.js
+++ b/src/ember/channel.js
@@ -222,7 +222,7 @@ FFZ.prototype._modify_cindex = function(view) {
tb.attr('title', 'Theater Mode (Alt+T)');
if ( opts && opts.options && typeof opts.options.gravity !== "function" )
- opts.options.gravity = utils.tooltip_placement(constants.TOOLTIP_DISTANCE, opts.options.gravity || 'n');*/
+ opts.options.gravity = utils.tooltip_placement(constants.TOOLTIP_DISTANCE, opts.options.gravity || 'n');//*/
this.ffzFixTitle();
this.ffzUpdateUptime();
diff --git a/src/ember/conversations.js b/src/ember/conversations.js
index 9ff4031c..aa1d7fc0 100644
--- a/src/ember/conversations.js
+++ b/src/ember/conversations.js
@@ -1,6 +1,8 @@
var FFZ = window.FrankerFaceZ,
utils = require('../utils'),
- constants = require('../constants');
+ constants = require('../constants'),
+
+ createElement = utils.createElement;
// ---------------
@@ -25,13 +27,27 @@ FFZ.settings_info.top_conversations = {
category: "Whispers",
name: "Position on Top",
- help: "Display the new conversation-style whisper UI at the top of the window instead of the bottom.",
+ help: "Display the whisper UI at the top of the window instead of the bottom.",
on_update: function(val) {
document.body.classList.toggle('ffz-top-conversations', val);
}
};
+FFZ.settings_info.hide_conversations_in_theatre = {
+ type: "boolean",
+ value: false,
+ no_mobile: true,
+
+ category: "Whispers",
+ name: "Hide Whispers in Theater Mode",
+ help: "Hide the whisper UI when the page is in theater mode.",
+ on_update: function(val) {
+ document.body.classList.toggle('ffz-theatre-conversations', val);
+ }
+ };
+
+
FFZ.settings_info.minimize_conversations = {
type: "boolean",
value: false,
@@ -39,7 +55,7 @@ FFZ.settings_info.minimize_conversations = {
category: "Whispers",
name: "Minimize Whisper UI",
- help: "Slide the Whisper UI mostly out of view when it's not being used and you have no unread messages.",
+ help: "Slide the whisper UI mostly out of view when it's not being used and you have no unread messages.",
on_update: function(val) {
document.body.classList.toggle('ffz-minimize-conversations', val);
}
@@ -53,23 +69,36 @@ FFZ.settings_info.minimize_conversations = {
FFZ.prototype.setup_conversations = function() {
document.body.classList.toggle('ffz-top-conversations', this.settings.top_conversations);
document.body.classList.toggle('ffz-minimize-conversations', this.settings.minimize_conversations);
+ document.body.classList.toggle('ffz-theatre-conversations', this.settings.hide_conversations_in_theatre);
- this.log("Hooking the Ember Conversation Window component.");
var ConvWindow = utils.ember_resolve('component:conversation-window');
if ( ConvWindow ) {
+ this.log("Hooking the Ember Conversation Window component.");
this._modify_conversation_window(ConvWindow);
try { ConvWindow.create().destroy() }
catch(err) { }
- }
+ } else
+ this.log("Unable to resolve: component:conversation-window");
+
+
+ var ConvSettings = utils.ember_resolve('component:conversation-settings-menu');
+ if ( ConvSettings ) {
+ this.log("Hooking the Ember Conversation Settings Menu component.");
+ this._modify_conversation_menu(ConvSettings);
+ try { ConvSettings.create().destroy() }
+ catch(err) { }
+ } else
+ this.log("Unable to resolve: component:conversation-settings-menu");
- this.log("Hooking the Ember Conversation Line component.");
var ConvLine = utils.ember_resolve('component:conversation-line');
if ( ConvLine ) {
+ this.log("Hooking the Ember Conversation Line component.");
this._modify_conversation_line(ConvLine);
try { ConvLine.create().destroy() }
catch(err) { }
- }
+ } else
+ this.log("Unable to resolve: component:conversation-line");
// TODO: Make this better later.
jQuery('.conversations-list').find('.html-tooltip').tipsy({live: true, html: true, gravity: utils.tooltip_placement(2*constants.TOOLTIP_DISTANCE, 'n')});
@@ -77,6 +106,36 @@ FFZ.prototype.setup_conversations = function() {
}
+FFZ.prototype._modify_conversation_menu = function(component) {
+ var f = this;
+
+ component.reopen({
+ didInsertElement: function() {
+ var user = this.get('thread.otherUsername'),
+ el = this.get('element'),
+ sections = el && el.querySelectorAll('.options-section');
+
+ if ( ! user || ! user.length || f.has_bttv )
+ return;
+
+ if ( sections && sections.length )
+ el.appendChild(createElement('div', 'options-divider'));
+
+ var ffz_options = createElement('div', 'options-section'),
+ card_link = createElement('a', 'ffz-show-card', "Open Moderation Card");
+
+ card_link.addEventListener('click', function(e) {
+ el.parentElement.classList.add('hidden');
+ FFZ.chat_commands.card.call(f, null, [user]);
+ });
+
+ ffz_options.appendChild(card_link);
+ el.appendChild(ffz_options);
+ }
+ })
+}
+
+
FFZ.prototype._modify_conversation_window = function(component) {
var f = this,
Layout = utils.ember_lookup('controller:layout');
diff --git a/src/ext/betterttv.js b/src/ext/betterttv.js
index 943f1467..707ac6d3 100644
--- a/src/ext/betterttv.js
+++ b/src/ext/betterttv.js
@@ -46,6 +46,7 @@ FFZ.prototype.setup_bttv = function(delay) {
if ( this.is_dashboard ) {
this._update_subscribers();
this._remove_dash_chart();
+ //this._remove_dash_feed();
}
document.body.classList.add('ffz-bttv');
@@ -224,7 +225,7 @@ FFZ.prototype.setup_bttv = function(delay) {
if ( text && text.length )
output.push(text);
var code = utils.quote_attr(data.raw);
- output.push(['']);
+ output.push(['
']);
text = null;
} else
text = (text || '') + match;
@@ -285,7 +286,7 @@ FFZ.prototype.setup_bttv = function(delay) {
text = [];
}
- new_tokens.push(['
']);
+ new_tokens.push(['
']);
if ( mine && l_room )
f.add_usage(l_room, emote);
diff --git a/src/main.js b/src/main.js
index cf259318..323cc7f0 100644
--- a/src/main.js
+++ b/src/main.js
@@ -35,7 +35,7 @@ FFZ.msg_commands = {};
// Version
var VER = FFZ.version_info = {
- major: 3, minor: 5, revision: 156,
+ major: 3, minor: 5, revision: 159,
toString: function() {
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
}
@@ -171,6 +171,7 @@ require('./ui/notifications');
require('./ui/viewer_count');
require('./ui/sub_count');
require('./ui/dash_stats');
+require('./ui/dash_feed');
require('./ui/menu_button');
require('./ui/following');
@@ -349,6 +350,7 @@ FFZ.prototype.init_dashboard = function(delay) {
this.setup_following_count(false);
this.setup_menu();
this.setup_dash_stats();
+ this.setup_dash_feed();
this._update_subscribers();
diff --git a/src/ui/about_page.js b/src/ui/about_page.js
index 5b170bb6..b3b298ce 100644
--- a/src/ui/about_page.js
+++ b/src/ui/about_page.js
@@ -1,7 +1,7 @@
var FFZ = window.FrankerFaceZ,
constants = require("../constants"),
utils = require("../utils"),
- createElement = document.createElement.bind(document),
+ createElement = utils.createElement,
NICE_DESCRIPTION = {
"cluster": null,
@@ -54,8 +54,7 @@ FFZ.ws_commands.update_news = function(version) {
var include_html = function(heading_text, filename) {
return function(view, container) {
- var heading = createElement('div');
- heading.className = 'chat-menu-content center';
+ var heading = createElement('div', 'chat-menu-content center');
heading.innerHTML = '
Developers | |||
---|---|---|---|
Dan Salvato | |||
Dan Salvato | |||
Stendec | |||
Version ' + FFZ.version_info + ' | Logs |