1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-17 02:16:54 +00:00

3.5.435. More dark theme tweaks for notifications. Add color support to channel metadata. Add warning colors for stream latency. Closes #113

This commit is contained in:
SirStendec 2017-03-04 18:55:00 -05:00
parent ac8250928c
commit 3b38d12859
8 changed files with 173 additions and 25 deletions

View file

@ -8,8 +8,20 @@ var FFZ = window.FrankerFaceZ,
// ---------------
FFZ.settings_info.player_stats = {
type: "boolean",
value: false,
type: 'select',
options: {
0: ['Disabled', -2],
'-1': ['Monochrome', -1],
10: 'Warning Colors (10s+)',
15: 'Warning Colors (15s+)',
20: 'Warning Colors (20s+)',
25: 'Warning Colors (25s+)',
30: 'Warning Colors (30s+)',
},
value: 0,
process_value: utils.process_int(0, 0, -1),
no_mobile: true,
category: "Channel Metadata",

View file

@ -241,6 +241,7 @@ FFZ.prototype.setup_sidebar = function() {
// Navigation Component
this.update_views('component:twitch-navigation', this.modify_navigation);
this.update_views('component:recommended-channels', this.modify_recommended_channels);
// Navigation Service
var NavService = utils.ember_lookup('service:navigation');
@ -265,6 +266,16 @@ FFZ.prototype.setup_following_link = function() {
}
FFZ.prototype.modify_recommended_channels = function(component) {
utils.ember_reopen_view(component, {
ffz_init: function() {
var el = this.get('element');
el.classList.add('js-recommended-channels');
}
});
}
FFZ.prototype.modify_navigation = function(component) {
var f = this;

View file

@ -61,7 +61,7 @@ FFZ.channel_metadata = {};
// Version
var VER = FFZ.version_info = {
major: 3, minor: 5, revision: 433,
major: 3, minor: 5, revision: 435,
toString: function() {
return [VER.major, VER.minor, VER.revision].join(".") + (VER.extra || "");
}

View file

@ -111,6 +111,18 @@ metadata.player_stats = {
}
},
color: function(stats, delay, is_old) {
var setting = this.settings.player_stats;
if ( setting === -1 )
return '';
else if ( delay > (setting * 2) )
return '#fc3636';
else if ( delay > setting )
return '#fc7835';
},
click: function(event, button, stats, delay, is_old, player_cont) {
player_cont.$('.js-stats-toggle').click();
},
@ -239,9 +251,10 @@ FFZ.prototype.render_metadata = function(key, basic_info, metabar, timers, refre
if ( refresh )
timers[key] = setTimeout(function(){refresh_func(key)}, typeof refresh === "number" ? refresh : 1000);
var je, stat,
var je, stat, old_color,
dynamic_tooltip = typeof info.tooltip === 'function',
label = typeof info.label === 'function' ? info.label.apply(f, data) : info.label;
label = typeof info.label === 'function' ? info.label.apply(f, data) : info.label,
color = (typeof info.color === 'function' ? info.color.apply(f, data) : info.color) || '';
if ( ! label )
return close();
@ -352,15 +365,25 @@ FFZ.prototype.render_metadata = function(key, basic_info, metabar, timers, refre
});
}.bind(this, el))
old_color = '';
metabar.appendChild(el);
el = btn;
} else {
stat = el.querySelector('span.ffz-label');
old_color = el.dataset.color;
if ( dynamic_tooltip )
je = jQuery(el);
}
if ( old_color !== color ) {
el.dataset.color = color;
el.style.color = color;
var svg = el.querySelector('svg');
if ( svg )
svg.style.fill = color;
}
stat.innerHTML = label;
if ( dynamic_tooltip && je.data('hover') )
je.tipsy('hide').tipsy('show');