mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +00:00
3.5.399. Refactor metadata rendering so it can be used on the dashboard. Generate less CSS for bits since there's way more of them now. Allow stacking of all cheer emotes, or just by type. Fix a bug with the My Emoticons menu not rendering if the user has a non-existent set.
This commit is contained in:
parent
b253f1a4d1
commit
48f2f331b7
9 changed files with 242 additions and 216 deletions
|
@ -1,3 +1,11 @@
|
|||
<div class="list-header">3.5.399 <time datetime="2016-12-14">(2016-12-14)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: Holiday cheer.</li>
|
||||
<li>Changed: The Bits Stacking option now lets you combine all cheer emoticons into one, or combine them by type.</li>
|
||||
<li>Changed: Refactor metadata rendering internally in preparation to add it to the new dashboard.</li>
|
||||
<li>Fixed: Bug rendering the My Emoticons menu if the user is registered to have an emote set that isn't currently loaded in the client.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.398 <time datetime="2016-12-14">(2016-12-14)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: Standalone Dashboard mode. Append <code>?standalone</code> to the end of the URL for your dashboard to see it. (Thanks to Warchamp7 for this idea.)</li>
|
||||
|
@ -65,21 +73,5 @@
|
|||
<li>Fixed: Stream latency display.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.388 <time datetime="2016-12-02">(2016-12-02)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Moderation cards.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.387 <time datetime="2016-11-30">(2016-11-30)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Removed: Mini Player. Twitch has its own feature for that now.</li>
|
||||
<li>Fixed: Twitch's mini player didn't get along with FFZ's.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.386 <time datetime="2016-11-30">(2016-11-30)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: Support high-DPI images for custom moderator badges.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header" id="ffz-old-news-button"><a href="#">View Older</a></div>
|
||||
<div id="ffz-old-news"></div>
|
|
@ -1,3 +1,19 @@
|
|||
<div class="list-header">3.5.388 <time datetime="2016-12-02">(2016-12-02)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Moderation cards.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.387 <time datetime="2016-11-30">(2016-11-30)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Removed: Mini Player. Twitch has its own feature for that now.</li>
|
||||
<li>Fixed: Twitch's mini player didn't get along with FFZ's.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.386 <time datetime="2016-11-30">(2016-11-30)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Added: Support high-DPI images for custom moderator badges.</li>
|
||||
</ul>
|
||||
|
||||
<div class="list-header">3.5.385 <time datetime="2016-11-30">(2016-11-30)</time></div>
|
||||
<ul class="chat-menu-content menu-side-padding">
|
||||
<li>Fixed: Mod cards not properly initializing in channels where you're not a mod.</li>
|
||||
|
|
|
@ -7,6 +7,25 @@ var FFZ = window.FrankerFaceZ,
|
|||
// Settings
|
||||
// --------------------
|
||||
|
||||
FFZ.settings_info.collect_bits = {
|
||||
type: "select",
|
||||
options: {
|
||||
0: "Disabled",
|
||||
1: "Grouped by Type",
|
||||
2: "All in One"
|
||||
},
|
||||
|
||||
value: 0,
|
||||
process_value: utils.process_int(0),
|
||||
|
||||
category: "Chat Appearance",
|
||||
no_bttv: true,
|
||||
|
||||
name: "Bits Stacking",
|
||||
help: "Collect all the bits emoticons in a message into a single one at the start of the message."
|
||||
};
|
||||
|
||||
|
||||
FFZ.settings_info.bits_animated = {
|
||||
type: "boolean",
|
||||
value: true,
|
||||
|
@ -17,7 +36,11 @@ FFZ.settings_info.bits_animated = {
|
|||
name: "Bits Animation",
|
||||
help: "Display bits with animation.",
|
||||
|
||||
on_update: utils.toggle_cls('ffz-animate-bits')
|
||||
on_update: function() {
|
||||
var bits = utils.ember_lookup('service:bits-rendering-config');
|
||||
if ( bits && bits.ffz_has_css )
|
||||
bits.ffz_update_css();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,7 +102,6 @@ FFZ.settings_info.bits_pinned_expand = {
|
|||
// --------------------
|
||||
|
||||
FFZ.prototype.setup_bits = function() {
|
||||
utils.toggle_cls('ffz-animate-bits')(this.settings.bits_animated);
|
||||
utils.toggle_cls('ffz-show-bits-tags')(this.settings.bits_tags_container);
|
||||
utils.toggle_cls('ffz-hide-pinned-cheers')(!this.settings.bits_pinned);
|
||||
utils.toggle_cls('ffz-pinned-cheer-expand-hover')(this.settings.bits_pinned_expand === 1);
|
||||
|
@ -134,20 +156,17 @@ FFZ.prototype.setup_bits = function() {
|
|||
_ffz_tier_css: function(ind, prefix, tier) {
|
||||
var selector = '.ffz-bit.bit-prefix-' + prefix + '.bit-tier-' + ind,
|
||||
color = f._handle_color(tier.color),
|
||||
animated = f.settings.bits_animated,
|
||||
output;
|
||||
|
||||
output = selector + '{' +
|
||||
'color: ' + color[0] + ';' +
|
||||
this._ffz_image_css(tier.images.light.static) +
|
||||
'}.ffz-animate-bits ' + selector + '{' +
|
||||
this._ffz_image_css(tier.images.light.animated) +
|
||||
this._ffz_image_css(tier.images.light[animated ? 'animated' : 'static']) +
|
||||
'}';
|
||||
|
||||
return output + '.tipsy ' + selector + ',.dark ' + selector + ',.force-dark ' + selector + ',.theatre ' + selector + '{' +
|
||||
'color: ' + color[1] + ';' +
|
||||
this._ffz_image_css(tier.images.dark.static) +
|
||||
'}.ffz-animate-bits .tipsy ' + selector + ',.ffz-animate-bits .dark ' + selector + ',.ffz-animate-bits .force-dark ' + selector + ',.ffz-animate-bits .theatre ' + selector + '{' +
|
||||
this._ffz_image_css(tier.images.dark.animated) +
|
||||
this._ffz_image_css(tier.images.dark[animated ? 'animated' : 'static']) +
|
||||
'}';
|
||||
},
|
||||
|
||||
|
|
|
@ -366,6 +366,8 @@ FFZ.prototype.modify_channel_live = function(view) {
|
|||
basic_info = [this, this.get(is_hosting ? 'channel.hostModeTarget' : 'channel'), is_hosting, this.get('channel')],
|
||||
timers = this.ffz_timers = this.ffz_timers || {},
|
||||
|
||||
refresh_func = this.ffzUpdateMetadata.bind(this),
|
||||
|
||||
container = this.get('element'),
|
||||
metabar = container && container.querySelector(is_hosting ? '.cn-hosting--bottom' : '.cn-metabar__more');
|
||||
|
||||
|
@ -374,162 +376,7 @@ FFZ.prototype.modify_channel_live = function(view) {
|
|||
return;
|
||||
|
||||
for(var i=0; i < keys.length; i++)
|
||||
this._ffzUpdateStat(keys[i], basic_info, timers, metabar, is_hosting);
|
||||
},
|
||||
|
||||
_ffzUpdateStat: function(key, basic_info, timers, metabar, is_hosting) {
|
||||
var t = this,
|
||||
info = FFZ.channel_metadata[key];
|
||||
|
||||
if ( timers[key] )
|
||||
clearTimeout(timers[key]);
|
||||
if ( ! info )
|
||||
return;
|
||||
|
||||
// Build the data we use for function calls.
|
||||
var data = info.setup ? info.setup.apply(f, basic_info) : basic_info,
|
||||
refresh = typeof info.refresh === "function" ? info.refresh.apply(f, data) : info.refresh;
|
||||
|
||||
// If we have a positive refresh value, schedule another go.
|
||||
if ( refresh )
|
||||
timers[key] = setTimeout(this.ffzUpdateMetadata.bind(this, key), typeof refresh === "number" ? refresh : 1000);
|
||||
|
||||
var el = metabar.querySelector('.cn-metabar__ffz[data-key="' + key + '"]'),
|
||||
je,
|
||||
stat,
|
||||
dynamic_tooltip = typeof info.tooltip === "function",
|
||||
label = typeof info.label === "function" ? info.label.apply(f, data) : info.label;
|
||||
|
||||
if ( ! label ) {
|
||||
if ( el )
|
||||
el.parentElement.removeChild(el);
|
||||
|
||||
if ( f._popup && f._popup.id === 'ffz-metadata-popup' && f._popup.getAttribute('data-key') === key )
|
||||
f.close_popup();
|
||||
|
||||
return;
|
||||
|
||||
} else if ( ! el ) {
|
||||
var btn,
|
||||
static_label = typeof info.static_label === "function" ? info.static_label.apply(f, data) : info.static_label,
|
||||
lbl_start = static_label && static_label.substr(0,4);
|
||||
|
||||
if ( ! static_label )
|
||||
static_label = '';
|
||||
else if ( lbl_start === '<svg' || lbl_start === '<img' )
|
||||
static_label = utils.createElement('figure', 'icon cn-metabar__icon', static_label + ' ');
|
||||
|
||||
if ( info.popup ) {
|
||||
btn = utils.createElement('button', 'button button--dropmenu', static_label)
|
||||
el = utils.createElement('div', 'cn-metabar__ffz flex__item ember-view balloon-wrapper inline-block', btn);
|
||||
|
||||
btn.classList.add(info.button ? 'button--hollow' : 'button--text');
|
||||
|
||||
} else if ( info.button ) {
|
||||
btn = utils.createElement('button', 'button', static_label);
|
||||
el = utils.createElement('div', 'cn-metabar__ffz flex__item ember-view inline-block', btn);
|
||||
|
||||
btn.classList.add(typeof info.button === 'string' ? info.button : 'button--hollow');
|
||||
|
||||
} else
|
||||
btn = el = utils.createElement('div', 'cn-metabar__ffz flex__item', static_label);
|
||||
|
||||
el.setAttribute('data-key', key);
|
||||
var order = (is_hosting ? info.host_order : null) || info.order;
|
||||
if ( order )
|
||||
el.style.order = order;
|
||||
|
||||
if ( ! dynamic_tooltip && info.tooltip ) {
|
||||
btn.classList.add('html-tooltip');
|
||||
btn.title = info.tooltip;
|
||||
}
|
||||
|
||||
stat = utils.createElement('span', 'ffz-label');
|
||||
btn.appendChild(stat);
|
||||
|
||||
if ( dynamic_tooltip ) {
|
||||
je = jQuery(btn)
|
||||
je.hover(
|
||||
function() { je.data("hover", true).tipsy("show") },
|
||||
function() { je.data("hover", false).tipsy("hide") })
|
||||
.data("hover", false)
|
||||
.tipsy({
|
||||
trigger: 'manual',
|
||||
html: true,
|
||||
gravity: utils.tooltip_placement(constants.TOOLTIP_DISTANCE, 'n'),
|
||||
title: function() {
|
||||
var data = info.setup ? info.setup.apply(f, basic_info) : basic_info;
|
||||
return info.tooltip.apply(f, data);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if ( info.click )
|
||||
btn.addEventListener('click', function(e) {
|
||||
if ( btn.disabled || btn.classList.contains('disabled') )
|
||||
return false;
|
||||
|
||||
e.update_stat = t._ffzUpdateStat.bind(t, key, basic_info, timers, metabar);
|
||||
|
||||
var data = info.setup ? info.setup.apply(f, basic_info) : basic_info;
|
||||
data.unshift(btn);
|
||||
data.unshift(e);
|
||||
return info.click.apply(f, data);
|
||||
});
|
||||
|
||||
if ( info.popup ) {
|
||||
btn.classList.add('button--dropmenu');
|
||||
btn.addEventListener('click', function(el, e) {
|
||||
if ( btn.disabled || btn.classList.contains('disabled') )
|
||||
return false;
|
||||
|
||||
var popup = f.close_popup();
|
||||
if ( popup && popup.id === 'ffz-metadata-popup' && popup.getAttribute('data-key') === key )
|
||||
return;
|
||||
|
||||
var data = info.setup ? info.setup.apply(f, basic_info) : basic_info,
|
||||
balloon = utils.createElement('div', 'balloon balloon--up show');
|
||||
|
||||
data.unshift(balloon);
|
||||
|
||||
balloon.id = 'ffz-metadata-popup';
|
||||
balloon.setAttribute('data-key', key);
|
||||
|
||||
var result = info.popup.apply(f, data);
|
||||
if ( result === false )
|
||||
return false;
|
||||
|
||||
// Set the balloon to face away from the nearest side of the channel.
|
||||
var container = t.get('element'),
|
||||
outer = container.getBoundingClientRect(),
|
||||
rect = el.getBoundingClientRect();
|
||||
|
||||
balloon.classList.toggle('balloon--right', (rect.left - outer.left) > (outer.right - rect.right));
|
||||
|
||||
f._popup_kill = info.on_popup_close ? function() { info.on_popup_close.apply(f, data) } : null;
|
||||
f._popup_allow_parent = true;
|
||||
f._popup = balloon;
|
||||
|
||||
el.appendChild(balloon);
|
||||
}.bind(this, el));
|
||||
}
|
||||
|
||||
metabar.appendChild(el);
|
||||
el = btn;
|
||||
|
||||
} else {
|
||||
stat = el.querySelector('span.ffz-label');
|
||||
if ( dynamic_tooltip )
|
||||
je = jQuery(el);
|
||||
}
|
||||
|
||||
stat.innerHTML = label;
|
||||
|
||||
if ( dynamic_tooltip && je.data("hover") )
|
||||
je.tipsy("hide").tipsy("show");
|
||||
|
||||
if ( info.hasOwnProperty('disabled') )
|
||||
el.classList.toggle('disabled', typeof info.disabled === "function" ? info.disabled.apply(f, data) : info.disabled);
|
||||
f.render_metadata(keys[i], basic_info, metabar, timers, refresh_func, is_hosting);
|
||||
},
|
||||
|
||||
ffzUpdateHostButton: function() {
|
||||
|
|
|
@ -152,28 +152,29 @@ FFZ.prototype.api_trigger = function(/*event, args...*/) {
|
|||
// ---------------------
|
||||
|
||||
API.prototype.register_metadata = function(key, data) {
|
||||
var real_key = this.id + '-' + key;
|
||||
data.source_ext = this.id;
|
||||
data.source_id = key;
|
||||
FFZ.channel_metadata[real_key] = data;
|
||||
if ( this.ffz._cindex )
|
||||
this.ffz._cindex.ffzUpdateMetadata(real_key);
|
||||
FFZ.channel_metadata[this.id + '-' + key] = data;
|
||||
this.update_metadata(key);
|
||||
}
|
||||
|
||||
|
||||
API.prototype.unregister_metadata = function(key) {
|
||||
var real_key = this.id + '-' + key;
|
||||
delete FFZ.channel_metadata[real_key];
|
||||
if ( this.ffz._cindex ) {
|
||||
this.ffz._cindex.$('.cn-metabar__ffz[data-key="' + real_key + '"]').remove();
|
||||
this.ffz._cindex.ffzUpdateMetadata(real_key);
|
||||
}
|
||||
delete FFZ.channel_metadata[this.id + '-' + key];
|
||||
this.update_metadata(key, true);
|
||||
}
|
||||
|
||||
|
||||
API.prototype.update_metadata = function(key) {
|
||||
if ( this.ffz._cindex )
|
||||
this.ffz._cindex.ffzUpdateMetadata(this.id + '-' + real_key);
|
||||
API.prototype.update_metadata = function(key, full_update) {
|
||||
var real_key = this.id + '-' + key,
|
||||
channel = this.ffz._cindex;
|
||||
|
||||
if ( channel ) {
|
||||
if ( full_update )
|
||||
channel.$('.cn-metabar__ffz[data-key="' + real_key + '"]').remove();
|
||||
|
||||
channel.ffzUpdateMetadata(real_key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ FFZ.channel_metadata = {};
|
|||
|
||||
// Version
|
||||
var VER = FFZ.version_info = {
|
||||
major: 3, minor: 5, revision: 398,
|
||||
major: 3, minor: 5, revision: 399,
|
||||
toString: function() {
|
||||
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
|
||||
}
|
||||
|
|
|
@ -160,18 +160,6 @@ FFZ.settings_info.timestamp_seconds = {
|
|||
};
|
||||
|
||||
|
||||
FFZ.settings_info.collect_bits = {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
|
||||
category: "Chat Appearance",
|
||||
no_bttv: true,
|
||||
|
||||
name: "Bits Stacking",
|
||||
help: "Collect all the bits emoticons in a message into a single one at the start of the message."
|
||||
};
|
||||
|
||||
|
||||
FFZ.settings_info.show_deleted_links = {
|
||||
type: "boolean",
|
||||
value: false,
|
||||
|
@ -406,7 +394,7 @@ FFZ.prototype.render_tooltip = function(el) {
|
|||
out += '<br>';
|
||||
individuals.sort().reverse();
|
||||
for(var i=0; i < individuals.length && i < 12; i++)
|
||||
out += f.render_token(false, false, true, {type: "bits", prefix: prefix, amount: individuals[i]});
|
||||
out += f.render_token(false, false, true, {type: "bits", prefix: individuals[i][1], amount: individuals[i][0]});
|
||||
|
||||
if ( individuals.length >= 12 )
|
||||
out += '<br>(and ' + (individuals.length - 12) + ' more)';
|
||||
|
@ -727,17 +715,19 @@ FFZ.prototype.tokenize_chat_line = function(msgObject, prevent_notification, del
|
|||
tokens = this._remove_banned(tokens);
|
||||
|
||||
if ( tags.bits && this.settings.collect_bits ) {
|
||||
var stuff = {};
|
||||
var total = 0, individuals = [];
|
||||
var stuff = {},
|
||||
into_one = this.settings.collect_bits === 2;
|
||||
|
||||
for(var i=0; i < tokens.length; i++)
|
||||
if ( tokens[i] && tokens[i].type === "bits" ) {
|
||||
tokens[i].hidden = true;
|
||||
var prefix = tokens[i].prefix,
|
||||
var real_prefix = tokens[i].prefix,
|
||||
prefix = into_one ? 'Cheer' : real_prefix,
|
||||
amount = tokens[i].amount || 0,
|
||||
grouped = stuff[prefix] = stuff[prefix] || {total: 0, individuals: []};
|
||||
|
||||
grouped.total += amount;
|
||||
grouped.individuals.push(amount);
|
||||
grouped.individuals.push([amount, real_prefix]);
|
||||
}
|
||||
|
||||
for(var prefix in stuff)
|
||||
|
|
|
@ -211,3 +211,165 @@ metadata.host = {
|
|||
// Rendering
|
||||
// ---------------
|
||||
|
||||
FFZ.prototype.render_metadata = function(key, basic_info, metabar, timers, refresh_func, is_hosting) {
|
||||
var f = this,
|
||||
info = metadata[key],
|
||||
el = metabar.querySelector('.cn-metabar__ffz[data-key="' + key + '"]'),
|
||||
|
||||
close = function() {
|
||||
if ( el )
|
||||
jQuery(el).remove();
|
||||
if ( f._popup && f._popup.id === 'ffz-metadata-popup' && f._popup.dataset.key === key )
|
||||
f.close_popup();
|
||||
};
|
||||
|
||||
if ( timers[key] )
|
||||
clearTimeout(timers[key]);
|
||||
|
||||
if ( ! info )
|
||||
return close();
|
||||
|
||||
var data = info.setup ? info.setup.apply(this, basic_info) : basic_info;
|
||||
if ( ! (data instanceof Promise) )
|
||||
data = Promise.resolve(data);
|
||||
|
||||
data.then(function(data) {
|
||||
el = metabar.querySelector('.cn-metabar__ffz[data-key="' + key + '"]');
|
||||
var refresh = typeof info.refresh === 'function' ? info.refresh.apply(f, data) : info.refresh;
|
||||
if ( refresh )
|
||||
timers[key] = setTimeout(function(){refresh_func(key)}, typeof refresh === "number" ? refresh : 1000);
|
||||
|
||||
var je, stat,
|
||||
dynamic_tooltip = typeof info.tooltip === 'function',
|
||||
label = typeof info.label === 'function' ? info.label.apply(f, data) : info.label;
|
||||
|
||||
if ( ! label )
|
||||
return close();
|
||||
|
||||
else if ( ! el ) {
|
||||
var btn,
|
||||
static_label = (typeof info.static_label === 'function' ? info.static_label.apply(f, data) : info.static_label) || '',
|
||||
lbl_start = static_label && static_label.substr(0,4);
|
||||
|
||||
if ( lbl_start === '<svg' || lbl_start === '<img' )
|
||||
static_label = utils.createElement('figure', 'icon cn-metabar__icon', static_label);
|
||||
|
||||
if ( info.popup || info.button ) {
|
||||
btn = utils.createElement('button', 'button', static_label);
|
||||
el = utils.createElement('div', 'cn-metabar__ffz flex__item ember-view inline-block', btn);
|
||||
|
||||
if ( info.popup ) {
|
||||
btn.classList.add('button--dropmenu');
|
||||
btn.classList.add(info.button ? 'button--hollow' : 'button--text');
|
||||
el.classList.add('balloon-wrapper');
|
||||
} else
|
||||
btn.classList.add(typeof info.button === 'string' ? info.button : 'button--hollow');
|
||||
} else
|
||||
btn = el = utils.createElement('div', 'cn-metabar__ffz flex__item', static_label);
|
||||
|
||||
el.setAttribute('data-key', key);
|
||||
var order = (is_hosting ? info.host_order : null) || info.order;
|
||||
if ( order )
|
||||
el.style.order = order;
|
||||
|
||||
stat = utils.createElement('span', 'ffz-label');
|
||||
btn.appendChild(stat);
|
||||
|
||||
if ( dynamic_tooltip ) {
|
||||
je = jQuery(btn);
|
||||
je.hover(
|
||||
function() { je.data("hover", true).tipsy("show") },
|
||||
function() { je.data("hover", false).tipsy("hide") })
|
||||
.data("hover", false)
|
||||
.tipsy({
|
||||
trigger: "manual",
|
||||
html: true,
|
||||
gravity: utils.tooltip_placement(constants.TOOLTIP_DISTANCE, 'n'),
|
||||
title: function() {
|
||||
// We can't wait for a promise to resolve now, so hope this hasn't changed.
|
||||
var dat = info.setup ? info.setup.apply(f, basic_info) : basic_info;
|
||||
return info.tooltip.apply(f, (dat instanceof Promise) ? data : dat);
|
||||
}
|
||||
});
|
||||
|
||||
} else if ( info.tooltip ) {
|
||||
btn.classList.add('html-tooltip');
|
||||
btn.title = info.tooltip;
|
||||
}
|
||||
|
||||
if ( info.click )
|
||||
btn.addEventListener('click', function(e) {
|
||||
if ( btn.disabled || btn.classList.contains('disabled') )
|
||||
return false;
|
||||
|
||||
e.update_stat = f.render_metadata.bind(f, key, basic_info, metabar, timers, refresh_func, is_hosting);
|
||||
var data = info.setup ? info.setup.apply(f, basic_info) : basic_info;
|
||||
if ( ! (data instanceof Promise) )
|
||||
data = Promise.resolve(data);
|
||||
|
||||
data.then(function(data) {
|
||||
data.unshift(btn);
|
||||
data.unshift(e);
|
||||
info.click.apply(f, data);
|
||||
});
|
||||
});
|
||||
|
||||
if ( info.popup )
|
||||
btn.addEventListener('click', function(el, e) {
|
||||
if ( btn.disabled || btn.classList.contains('disabled') )
|
||||
return false;
|
||||
|
||||
var popup = f.close_popup();
|
||||
if ( popup && popup.id === 'ffz-metadata-popup' && popup.dataset.key === key )
|
||||
return;
|
||||
|
||||
var data = info.setup ? info.setup.apply(f, basic_info) : basic_info;
|
||||
if ( ! (data instanceof Promise) )
|
||||
data = Promise.resolve(data);
|
||||
|
||||
data.then(function(data) {
|
||||
var balloon = utils.createElement('div', 'balloon balloon--up show');
|
||||
data.unshift(balloon);
|
||||
|
||||
balloon.id = 'ffz-metadata-popup';
|
||||
balloon.setAttribute('data-key', key);
|
||||
|
||||
var result = info.popup.apply(f, data);
|
||||
if ( result === false )
|
||||
return;
|
||||
|
||||
var container = basic_info[0].get('element'),
|
||||
outer = container.getBoundingClientRect(),
|
||||
rect = el.getBoundingClientRect();
|
||||
|
||||
balloon.classList.toggle('balloon--right', (rect.left - outer.left) > (outer.right - rect.right));
|
||||
|
||||
f._popup_kill = info.on_popup_close ? function() { info.on_popup_close.apply(f, data) } : null;
|
||||
f._popup_allow_parent = true;
|
||||
f._popup = balloon;
|
||||
|
||||
el.appendChild(balloon);
|
||||
});
|
||||
}.bind(this, el))
|
||||
|
||||
metabar.appendChild(el);
|
||||
el = btn;
|
||||
|
||||
} else {
|
||||
stat = el.querySelector('span.ffz-label');
|
||||
if ( dynamic_tooltip )
|
||||
je = jQuery(el);
|
||||
}
|
||||
|
||||
stat.innerHTML = label;
|
||||
if ( dynamic_tooltip && je.data('hover') )
|
||||
je.tipsy('hide').tipsy('show');
|
||||
|
||||
if ( info.hasOwnProperty('disabled') )
|
||||
el.classList.toggle('disabled', typeof info.disabled === 'function' ? info.disabled.apply(f, data) : info.disabled);
|
||||
|
||||
}).catch(function(err) {
|
||||
f.error("Error rendering metadata: " + key, err);
|
||||
close();
|
||||
});
|
||||
}
|
|
@ -232,17 +232,16 @@ FFZ.menu_pages.myemotes = {
|
|||
// Now, FFZ!
|
||||
for(var i=0; i < ffz_sets.length; i++) {
|
||||
var set_id = ffz_sets[i],
|
||||
set = this.emote_sets[set_id],
|
||||
set = this.emote_sets[set_id];
|
||||
if ( ! set || ! set.count || set.hidden || ( ! this.settings.global_emotes_in_menu && this.default_sets.indexOf(set_id) !== -1 ) )
|
||||
continue;
|
||||
|
||||
menu_id = set.hasOwnProperty('source_ext') ? 'ffz-ext-' + set.source_ext + '-' + set.source_id : 'ffz-' + set.id,
|
||||
var menu_id = set.hasOwnProperty('source_ext') ? 'ffz-ext-' + set.source_ext + '-' + set.source_id : 'ffz-' + set.id,
|
||||
favorites_list = this.settings.favorite_emotes[menu_id];
|
||||
|
||||
if ( favorites_only && (! favorites_list || ! favorites_list.length) )
|
||||
continue;
|
||||
|
||||
if ( ! set || ! set.count || set.hidden || ( ! this.settings.global_emotes_in_menu && this.default_sets.indexOf(set_id) !== -1 ) )
|
||||
continue;
|
||||
|
||||
var menu_id = set.title.toLowerCase(),
|
||||
sort_key = set.sort,
|
||||
menu = FFZ.menu_pages.myemotes.draw_ffz_set.call(this, view, set, favorites_only);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue