1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-06-27 21:05:53 +00:00

3.5.369. Re-add Hide Promoted Games. Add high-DPI FFZ badges. Fix moderation card additional buttons with multiple commands.

This commit is contained in:
SirStendec 2016-11-12 11:58:38 -05:00
parent 830726432b
commit 35b0665618
9 changed files with 129 additions and 64 deletions

View file

@ -1,7 +1,7 @@
FrankerFaceZ
============
Copyright (c) 2016 FrankerFaceZ
Copyright (c) 2016 Dan Salvato LLC
Licensed under the Apache License, Version 2.0. See LICENSE.

View file

@ -1,3 +1,14 @@
<div class="list-header">3.5.369 <time datetime="2016-11-12">(2016-11-12)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Option to Hide Promoted Games had been removed because I thought that feature was gone. Clearly, it's not.</li>
</ul>
<div class="list-header">3.5.368 <time datetime="2016-11-11">(2016-11-11)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Sending multiple lines via moderation card additional buttons was broken.</li>
<li>Changed: Use high-DPI images for FrankerFaceZ badges and Transparent (Colored) badges.</li>
</ul>
<div class="list-header">3.5.367 <time datetime="2016-11-09">(2016-11-09)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Bug showing button to dismiss a pinned cheer twice.</li>
@ -65,19 +76,5 @@
<li>Fixed: Update to the latest version of FileSaver.js to, hopefully, fix issues saving settings with Safari.</li>
</ul>
<div class="list-header">3.5.357 <time datetime="2016-10-27">(2016-10-27)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Chat Replay is not darkening properly after a component was removed.</li>
<li>Fixed: If you had multiple subscription emoticons with the same suffix (eg. chrisHi, cirHi, p4ntzHi) tab-completion will now show all of them when completing without the prefix.</li>
<li>Fixed: Tab-complete single-letter subscription emoticons without a prefix.</li>
</ul>
<div class="list-header">3.5.356 <time datetime="2016-10-27">(2016-10-27)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: Option to disable "Your friend is now watching" in chat.</li>
<li>Changed: Disabling Friends entirely will also hide those messages.</li>
<li>Fixed: Event emoticons not appearing for some users due to a race condition.</li>
</ul>
<div class="list-header" id="ffz-old-news-button"><a href="#">View Older</a></div>
<div id="ffz-old-news"></div>

View file

@ -1,3 +1,17 @@
<div class="list-header">3.5.357 <time datetime="2016-10-27">(2016-10-27)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Fixed: Chat Replay is not darkening properly after a component was removed.</li>
<li>Fixed: If you had multiple subscription emoticons with the same suffix (eg. chrisHi, cirHi, p4ntzHi) tab-completion will now show all of them when completing without the prefix.</li>
<li>Fixed: Tab-complete single-letter subscription emoticons without a prefix.</li>
</ul>
<div class="list-header">3.5.356 <time datetime="2016-10-27">(2016-10-27)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: Option to disable "Your friend is now watching" in chat.</li>
<li>Changed: Disabling Friends entirely will also hide those messages.</li>
<li>Fixed: Event emoticons not appearing for some users due to a race condition.</li>
</ul>
<div class="list-header">3.5.355 <time datetime="2016-10-27">(2016-10-27)</time></div>
<ul class="chat-menu-content menu-side-padding">
<li>Added: Auto-Pause Hosted Channels is back! The player doesn't break anymore if you try to pause it immediately.</li>

View file

@ -376,8 +376,8 @@ FFZ.prototype.get_badges = function(user, room_id, badges, msg) {
if ( ! replaces )
continue;
old_badge.image = badge.image || full_badge.image;
old_badge.klass += ' ffz-badge-replacement';
old_badge.image = badge.image || null;
old_badge.klass += ' ffz-badge-replacement ffz-replacer-ffz-badge-' + (badge.id || full_badge.id);
old_badge.title += ', ' + (badge.title || full_badge.title);
continue;
}
@ -508,12 +508,15 @@ FFZ.prototype.render_badges = function(badges) {
if ( badge.image )
if ( is_colored && setting === 6 )
css += '-webkit-mask-image:url("' + utils.quote_attr(badge.image) + '");';
css += (constants.IS_WEBKIT ? '-webkit-' : '') + 'mask-image:url("' + utils.quote_attr(badge.image) + '");';
else
css += 'background-image:url("' + utils.quote_attr(badge.image) + '");';
if ( badge.srcSet && (setting !== 6 || !is_colored) )
css += constants.IS_WEBKIT ? 'background-image:-webkit-image-set(' + badge.srcSet + ');' : 'background-image:image-set(' + badge.srcSet + ');';
if ( badge.srcSet )
if ( is_colored && setting === 6 )
css += (constants.IS_WEBKIT ? '-webkit-mask-image:-webkit-' : 'mask-image:') + 'image-set(' + badge.srcSet + ');';
else
css += 'background-image:' + (constants.IS_WEBKIT ? '-webkit-' : '') + 'image-set(' + badge.srcSet + ');';
if ( badge.color )
if ( is_colored && setting === 6 )
@ -628,9 +631,9 @@ FFZ.prototype.bttv_badges = function(data) {
for(var i=0; i < data.badges.length; i++) {
var b = data.badges[i];
if ( b.type === full_badge.replaces_type ) {
b.type = "ffz-badge-replacement " + b.type;
b.type += " ffz-badge-replacement ffz-replacer-ffz-badge-" + (badge.id || full_badge.id);
b.description += ", " + (badge.title || full_badge.title) +
'" style="background-image: url(' + utils.quote_attr('"' + (badge.image || full_badge.image) + '"') + ')';
(badge.image ? '" style="background-image: url(' + utils.quote_attr('"' + badge.image + '"') + ')' : '');
replaced = true;
break;
}
@ -742,9 +745,6 @@ FFZ.prototype._load_badge_json = function(badge_id, data) {
data.replaces = true;
}
if ( data.name === 'developer' )
data.no_invert = true;
if ( data.name === 'bot' )
data.visible = function(r,user) { return !(this.has_bttv && FFZ.bttv_known_bots.indexOf(user)!==-1); };

View file

@ -1006,31 +1006,45 @@ FFZ.prototype.modify_moderation_card = function(component) {
if ( is_mod && f.settings.mod_card_buttons && f.settings.mod_card_buttons.length ) {
line = utils.createElement('div', 'extra-interface interface clearfix');
var add_btn_click = function(cmd) {
var user = controller.get('cardInfo.user'),
chat_controller = utils.ember_lookup('controller:chat'),
room = chat_controller && chat_controller.get('currentRoom'),
cm = utils.replace_cmd_variables(cmd, user, room),
var build_cmd = function(user, room, cmd) {
var lines = utils.replace_cmd_variables(cmd, user, room).split(/\s*<LINE>\s*/g),
reason = ban_reason();
if ( reason ) {
var match = TO_REG.exec(cm);
if ( match ) {
if ( ! match[2] )
cm += " 600";
if ( ! match[3] )
cm += reason;
for(var i=0; i < lines.length; i++) {
var match = TO_REG.exec(lines[i]);
if ( match ) {
if ( ! match[2] )
lines[i] += ' 600';
if ( ! match[3] )
lines[i] += reason;
} else {
match = BAN_REG.exec(cm);
if ( match && ! match[2] ) {
cm += reason;
break;
} else {
match = BAN_REG.exec(lines[i]);
if ( match ) {
if ( ! match[2] )
lines[i] += reason;
break;
}
}
}
}
room && room.send(cm, true);
return lines;
},
add_btn_click = function(cmd) {
var user = controller.get('cardInfo.user'),
chat_controller = utils.ember_lookup('controller:chat'),
room = chat_controller && chat_controller.get('currentRoom');
if ( ! room )
return;
var lines = build_cmd(user, room, cmd);
for(var i=0; i < lines.length; i++)
room.send(lines[i], true);
},
add_btn_make = function(label, cmd) {
@ -1044,11 +1058,10 @@ FFZ.prototype.modify_moderation_card = function(component) {
chat_controller = utils.ember_lookup('controller:chat'),
room = chat_controller && chat_controller.get('currentRoom');
title = utils.replace_cmd_variables(cmd, user, room);
lines = build_cmd(user, room, cmd),
title = _.map(lines, utils.sanitize).join('<br>');
title = _.map(title.split(/\s*<LINE>\s*/g, utils.sanitize).join("<br>"));
return "Custom Command" + (title.indexOf('<br>') !== -1 ? 's' : '') +
return "Custom Command" + (lines.length > 1 ? 's' : '') +
"<br>" + title;
}
});

View file

@ -74,7 +74,7 @@ FFZ.settings_info.sidebar_hide_prime = {
};
/*FFZ.settings_info.sidebar_hide_promoted_games = {
FFZ.settings_info.sidebar_hide_promoted_games = {
type: "boolean",
value: false,
@ -85,7 +85,7 @@ FFZ.settings_info.sidebar_hide_prime = {
help: "Hide the Promoted Games section from the sidebar.",
on_update: utils.toggle_cls('ffz-hide-promoted-games')
};*/
};
@ -196,7 +196,7 @@ FFZ.settings_info.sidebar_directly_to_followed_channels = {
FFZ.prototype.setup_sidebar = function() {
// CSS to Hide Stuff
//utils.toggle_cls('ffz-hide-promoted-games')(this.settings.sidebar_hide_promoted_games);
utils.toggle_cls('ffz-hide-promoted-games')(this.settings.sidebar_hide_promoted_games);
utils.toggle_cls('ffz-hide-recommended-channels')(this.settings.sidebar_hide_recommended_channels);
utils.toggle_cls('ffz-hide-recommended-friends')(this.settings.sidebar_hide_recommended_friends);
utils.toggle_cls('ffz-hide-friends-collapsed')(this.settings.sidebar_hide_friends_collapsed);

View file

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

View file

@ -1,5 +1,6 @@
var FFZ = window.FrankerFaceZ,
constants = require('./constants');
constants = require('./constants'),
WEBKIT = constants.IS_WEBKIT ? '-webkit-' : '';
var createElement = function(tag, className, content) {
@ -1006,11 +1007,43 @@ module.exports = FFZ.utils = {
badge_css: function(badge, klass) {
klass = klass || ('ffz-badge-' + badge.id);
var out = ".badges ." + klass + (badge.no_color ? ":not(.colored)" : "") + " { background-color: " + badge.color + '; background-image: url("' + badge.image + '"); ' + (badge.css || "") + '}';
var urls = badge.urls || {1: badge.image},
image_set = image = 'url("' + urls[1] + '")';
if ( urls[2] || urls[4] ) {
image_set += ' 1x';
if ( urls[2] )
image_set += ', url("' + urls[2] + '") 2x';
if ( urls[4] )
image_set += ', url("' + urls[4] + '") 4x'
image_set = WEBKIT + 'image-set(' + image_set + ')';
}
var out = '.badges .' + klass + (badge.no_color ? ':not(.colored){' : '{') +
'background-color:' + badge.color + ';' +
'background-image:' + image + ';' +
'background-image:' + image_set + ';' +
(badge.css || '') + '}' +
'.badges .badge.ffz-badge-replacement.ffz-replacer-' + klass + ':not(.colored){' +
'background-image:' + image + ';' +
'background-image:' + image_set + '}';
if ( ! badge.no_color )
out += ".badges ." + klass + ".colored { background: linear-gradient(" + badge.color + "," + badge.color + '); -webkit-mask-image: url("' + badge.image + '"); ' + (badge.css || "") + '}';
out += '.badges .badge.ffz-badge-replacement.ffz-replacer-' + klass + '.colored{' +
WEBKIT + 'mask-image:' + image + ';' +
WEBKIT + 'mask-image:' + image_set + '}' +
'.badges .' + klass + '.colored {' +
'background: linear-gradient(' + badge.color + ',' + badge.color + ');' +
WEBKIT + 'mask-image:' + image + ';' +
WEBKIT + 'mask-image:' + image_set + ';' +
(badge.css || '') + '}';
if ( badge.alpha_image )
out += ".badges .badge.alpha." + klass + ",.ffz-transparent-badges .badges ." + klass + ' { background-image: url("' + badge.alpha_image + '"); }';
out += '.badges .badge.alpha.' + klass + ',' +
'.ffz-transparent-badges .badges .' + klass + ' {' +
'background-image:url("' + badge.alpha_image + '")}';
return out;
},
@ -1022,7 +1055,7 @@ module.exports = FFZ.utils = {
return '.from-display-preview[data-room="' + room_id + '"] .badge.' + badge_id + '.version-' + version +
',.chat-line[data-room="' + room_id + '"] .badge.' + badge_id + '.version-' + version + '{' +
'background-image:url("' + img_1x + '");' +
'background-image:' + (constants.IS_WEBKIT ? '-webkit-' : '') + 'image-set(url("' + img_1x + '") 1x' + (img_2x ? ',url("' + img_2x + '") 2x' : '') + (img_4x ? ',url("' + img_4x + '") 4x' : '') + ')}';
'background-image:' + WEBKIT + 'image-set(url("' + img_1x + '") 1x' + (img_2x ? ',url("' + img_2x + '") 2x' : '') + (img_4x ? ',url("' + img_4x + '") 4x' : '') + ')}';
},
cdn_badge_css: function(badge_id, version, data, room) {
@ -1031,16 +1064,23 @@ module.exports = FFZ.utils = {
is_svg = base_image.substr(-4) === '.svg',
image_1x = base_image + (is_svg ? '' : "1.png"),
image_2x = base_image + (is_svg ? '' : "2.png"),
image_4x = base_image + (is_svg ? '' : "4.png");
image_4x = base_image + (is_svg ? '' : "4.png"),
return '.badge.' + badge_id + '.version-' + version + (room ? '[data-room="' + room + '"]' : '') + (data.no_color ? '' : ':not(.colored)') + ' {' +
'background: url("' + image_1x + '") ' + color + ';' +
(is_svg ? '}' : 'background-image: -webkit-image-set(url("' + image_1x + '") 1x, url("' + image_2x + '") 2x, url("' + image_4x + '") 4x);' +
'background-image: image-set(url("' + image_1x + '") 1x, url("' + image_2x + '") 2x, url("' + image_4x + '") 4x); }') +
(data.no_color ? '' : '.badge.' + badge_id + '.version-' + version + (room ? '[data-room="' + room + '"]' : '') + '.colored {' +
image_set = image = 'url("' + image_1x + '")';
if ( ! is_svg )
image_set = WEBKIT + 'image-set(' + image +
' 1x, url("' + image_2x + '") 2x, url("' + image_4x + '") 4x)';
return '.badge.' + badge_id + '.version-' + version + (room ? '[data-room="' + room + '"]' : '') + (data.no_color ? '' : ':not(.colored)') + '{' +
'background:' + image + ' ' + color + ';' +
(is_svg ? '}' : 'background-image:' + image_set + '}' ) +
(data.no_color ? '' : '.badge.' + badge_id + '.version-' + version + (room ? '[data-room="' + room + '"]' : '') + '.colored{' +
'background: linear-gradient(' + color + ',' + color + ');' +
(is_svg ? '-webkit-mask-size: 18px 18px;mask-size: 18px 18px;' : '') +
'-webkit-mask-image: url("' + image_1x + '");' +
'mask-image: url("' + image_1x + '");}');
(is_svg ? WEBKIT + 'mask-size:18px 18px;' : '') +
WEBKIT + 'mask-image:' + image + ';' +
(is_svg ? '}' : WEBKIT + 'mask-image:' + image_set + '}')
);
}
}

View file

@ -44,6 +44,7 @@ body:not(.ffz-show-bits-tags) .bits-tag--container,
.ffz-hide-more-at-twitch nav .tse-content > .warp__list:last-of-type,
.ffz-hide-recommended-friends .recommended-friends,
.ffz-hide-recommended-channels .js-recommended-channels,
.drawer.closed .promotedGames .warp__item--header,
.ffz-hide-promoted-games .promotedGames,
.ffz-hide-recent-past-broadcast .recent-past-broadcast,
.ffz-hide-view-count .stat.twitch-channel-views,