mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-07 06:40:54 +00:00
4.20.29
* Changed: Position the default `Reply to Message` in-line action after mod actions. * Fixed: The `Reply to Message` action not working as a User Context action. * Fixed: Twitch emotes appearing incorrectly within reply messages. * API Changed: `array_merge` settings now inherit their `default` values if the lowest profile has an inheritance point.
This commit is contained in:
parent
463c9f9a45
commit
c48423a7b2
6 changed files with 67 additions and 39 deletions
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "frankerfacez",
|
"name": "frankerfacez",
|
||||||
"author": "Dan Salvato LLC",
|
"author": "Dan Salvato LLC",
|
||||||
"version": "4.20.28",
|
"version": "4.20.29",
|
||||||
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
"description": "FrankerFaceZ is a Twitch enhancement suite.",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -65,11 +65,11 @@ export default class Actions extends Module {
|
||||||
),
|
),
|
||||||
|
|
||||||
default: [
|
default: [
|
||||||
{v: {action: 'reply', appearance: {type: 'icon', icon: 'ffz-i-reply'}, options: {}, display: {}}},
|
|
||||||
{v: {action: 'ban', appearance: {type: 'icon', icon: 'ffz-i-block'}, options: {}, display: {mod: true, mod_icons: true, deleted: false}}},
|
{v: {action: 'ban', appearance: {type: 'icon', icon: 'ffz-i-block'}, options: {}, display: {mod: true, mod_icons: true, deleted: false}}},
|
||||||
{v: {action: 'unban', appearance: {type: 'icon', icon: 'ffz-i-ok'}, options: {}, display: {mod: true, mod_icons: true, deleted: true}}},
|
{v: {action: 'unban', appearance: {type: 'icon', icon: 'ffz-i-ok'}, options: {}, display: {mod: true, mod_icons: true, deleted: true}}},
|
||||||
{v: {action: 'timeout', appearance: {type: 'icon', icon: 'ffz-i-clock'}, display: {mod: true, mod_icons: true}}},
|
{v: {action: 'timeout', appearance: {type: 'icon', icon: 'ffz-i-clock'}, display: {mod: true, mod_icons: true}}},
|
||||||
{v: {action: 'msg_delete', appearance: {type: 'icon', icon: 'ffz-i-trash'}, options: {}, display: {mod: true, mod_icons: true}}}
|
{v: {action: 'msg_delete', appearance: {type: 'icon', icon: 'ffz-i-trash'}, options: {}, display: {mod: true, mod_icons: true}}},
|
||||||
|
{v: {action: 'reply', appearance: {type: 'icon', icon: 'ffz-i-reply'}, options: {}, display: {}}}
|
||||||
],
|
],
|
||||||
|
|
||||||
type: 'array_merge',
|
type: 'array_merge',
|
||||||
|
@ -498,12 +498,14 @@ export default class Actions extends Module {
|
||||||
if ( current_level < 3 )
|
if ( current_level < 3 )
|
||||||
mod_icons = false;
|
mod_icons = false;
|
||||||
|
|
||||||
|
const chat_line = line;
|
||||||
|
|
||||||
return this.renderPopup(target, (t, tip) => {
|
return this.renderPopup(target, (t, tip) => {
|
||||||
const lines = [];
|
const lines = [];
|
||||||
let line = null;
|
let line = null;
|
||||||
|
|
||||||
const handle_click = event => {
|
const handle_click = event => {
|
||||||
this.handleClick(event);
|
this.handleClick(event, line);
|
||||||
tip.hide();
|
tip.hide();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -599,6 +601,7 @@ export default class Actions extends Module {
|
||||||
</div>);
|
</div>);
|
||||||
|
|
||||||
out.ffz_message = msg;
|
out.ffz_message = msg;
|
||||||
|
out.ffz_line = chat_line;
|
||||||
return out;
|
return out;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -723,11 +726,12 @@ export default class Actions extends Module {
|
||||||
if ( ! definition )
|
if ( ! definition )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
let user, room, message, loaded = false;
|
let user, room, message, loaded = false, line;
|
||||||
|
|
||||||
if ( pds ) {
|
if ( pds ) {
|
||||||
if ( pds.source === 'msg' && parent.ffz_message ) {
|
if ( pds.source === 'msg' && parent.ffz_message ) {
|
||||||
const msg = parent.ffz_message;
|
const msg = parent.ffz_message;
|
||||||
|
line = parent.ffz_line;
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
user = msg.user ? {
|
user = msg.user ? {
|
||||||
|
@ -749,8 +753,8 @@ export default class Actions extends Module {
|
||||||
};
|
};
|
||||||
|
|
||||||
} else if ( pds.source === 'line' ) {
|
} else if ( pds.source === 'line' ) {
|
||||||
const fine = this.resolve('site.fine'),
|
const fine = this.resolve('site.fine');
|
||||||
line = fine && fine.searchParent(parent, n => n.props && n.props.message);
|
line = fine && fine.searchParent(parent, n => n.props && n.props.message);
|
||||||
|
|
||||||
if ( line && line.props && line.props.message ) {
|
if ( line && line.props && line.props.message ) {
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
@ -792,7 +796,8 @@ export default class Actions extends Module {
|
||||||
user,
|
user,
|
||||||
room,
|
room,
|
||||||
message,
|
message,
|
||||||
message_id: message ? message.id : null
|
message_id: message ? message.id : null,
|
||||||
|
line
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( definition.defaults )
|
if ( definition.defaults )
|
||||||
|
|
|
@ -36,15 +36,17 @@ export const reply = {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
click(event) {
|
click(event, data) {
|
||||||
const fine = this.resolve('site.fine'),
|
let line = data.line;
|
||||||
|
if ( ! line ) {
|
||||||
|
const fine = this.resolve('site.fine');
|
||||||
line = fine ? fine.searchParent(event.target, n => n.setMessageTray && n.props && n.props.message) : null;
|
line = fine ? fine.searchParent(event.target, n => n.setMessageTray && n.props && n.props.message) : null;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! line )
|
if ( ! line )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
line.ffzOpenReply();
|
line.ffzOpenReply();
|
||||||
//line.setMessageTray(line.props.message, line.props.message.message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1279,6 +1279,10 @@ export default class Chat extends Module {
|
||||||
const emotes = {},
|
const emotes = {},
|
||||||
chars = split_chars(msg.message);
|
chars = split_chars(msg.message);
|
||||||
|
|
||||||
|
let offset = 0;
|
||||||
|
if ( msg.message && msg.messageBody && msg.message !== msg.messageBody )
|
||||||
|
offset = chars.length - split_chars(msg.messageBody).length;
|
||||||
|
|
||||||
for(const key in msg.emotes)
|
for(const key in msg.emotes)
|
||||||
if ( has(msg.emotes, key) ) {
|
if ( has(msg.emotes, key) ) {
|
||||||
const raw_emote = msg.emotes[key];
|
const raw_emote = msg.emotes[key];
|
||||||
|
@ -1286,7 +1290,7 @@ export default class Chat extends Module {
|
||||||
return msg.ffz_emotes = msg.emotes;
|
return msg.ffz_emotes = msg.emotes;
|
||||||
|
|
||||||
const em = emotes[raw_emote.id] = emotes[raw_emote.id] || [];
|
const em = emotes[raw_emote.id] = emotes[raw_emote.id] || [];
|
||||||
let idx = raw_emote.startIndex + 1;
|
let idx = raw_emote.startIndex + 1 + offset;
|
||||||
while(idx < chars.length) {
|
while(idx < chars.length) {
|
||||||
if ( EMOTE_CHARS.test(chars[idx]) )
|
if ( EMOTE_CHARS.test(chars[idx]) )
|
||||||
break;
|
break;
|
||||||
|
@ -1295,7 +1299,7 @@ export default class Chat extends Module {
|
||||||
}
|
}
|
||||||
|
|
||||||
em.push({
|
em.push({
|
||||||
startIndex: raw_emote.startIndex,
|
startIndex: raw_emote.startIndex + offset,
|
||||||
endIndex: idx - 1
|
endIndex: idx - 1
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
// Settings Types
|
// Settings Types
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
const DEFAULT = Symbol('default');
|
||||||
|
|
||||||
export const basic = {
|
export const basic = {
|
||||||
get(key, profiles) {
|
get(key, profiles) {
|
||||||
for(const profile of profiles)
|
for(const profile of profiles)
|
||||||
|
@ -52,41 +54,55 @@ export const array_merge = {
|
||||||
return values;
|
return values;
|
||||||
},
|
},
|
||||||
|
|
||||||
get(key, profiles, definition, log) {
|
get(key, profiles, definition, log, ctx) {
|
||||||
const values = [],
|
const values = [],
|
||||||
sources = [];
|
sources = [];
|
||||||
let trailing = [];
|
let trailing = [];
|
||||||
let had_value = false;
|
let had_value = false;
|
||||||
|
|
||||||
for(const profile of profiles)
|
const profs = [...profiles, DEFAULT];
|
||||||
if ( profile.has(key) ) {
|
|
||||||
const value = profile.get(key),
|
|
||||||
trail = [];
|
|
||||||
|
|
||||||
if ( ! Array.isArray(value) ) {
|
for(const profile of profs) {
|
||||||
|
let value;
|
||||||
|
if ( profile === DEFAULT ) {
|
||||||
|
value = definition.default;
|
||||||
|
if ( typeof value === 'function' )
|
||||||
|
value = value(ctx);
|
||||||
|
|
||||||
|
} else if ( profile.has(key) )
|
||||||
|
value = profile.get(key);
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( ! Array.isArray(value) ) {
|
||||||
|
if ( profile !== DEFAULT )
|
||||||
log.warn(`Profile #${profile.id} has an invalid value for "${key}" of type ${typeof value}. Skipping.`);
|
log.warn(`Profile #${profile.id} has an invalid value for "${key}" of type ${typeof value}. Skipping.`);
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
sources.push(profile.id);
|
|
||||||
let is_trailing = false;
|
|
||||||
for(const val of value) {
|
|
||||||
had_value = true;
|
|
||||||
if ( val.t === 'inherit' )
|
|
||||||
is_trailing = true;
|
|
||||||
else if ( is_trailing )
|
|
||||||
trail.push(val.v);
|
|
||||||
else
|
|
||||||
values.push(val.v);
|
|
||||||
}
|
|
||||||
|
|
||||||
trailing = trail.concat(trailing);
|
|
||||||
|
|
||||||
// If we didn't run into an inherit, don't inherit.
|
|
||||||
if ( ! is_trailing && ! definition.always_inherit )
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const trail = [];
|
||||||
|
|
||||||
|
if ( profile !== DEFAULT )
|
||||||
|
sources.push(profile.id);
|
||||||
|
|
||||||
|
let is_trailing = false;
|
||||||
|
for(const val of value) {
|
||||||
|
had_value = true;
|
||||||
|
if ( val.t === 'inherit' )
|
||||||
|
is_trailing = true;
|
||||||
|
else if ( is_trailing )
|
||||||
|
trail.push(val.v);
|
||||||
|
else
|
||||||
|
values.push(val.v);
|
||||||
|
}
|
||||||
|
|
||||||
|
trailing = trail.concat(trailing);
|
||||||
|
|
||||||
|
// If we didn't run into an inherit, don't inherit.
|
||||||
|
if ( ! is_trailing && ! definition.always_inherit )
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if ( had_value )
|
if ( had_value )
|
||||||
return [
|
return [
|
||||||
values.concat(trailing),
|
values.concat(trailing),
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
.ffz--reply-mention {
|
.ffz--reply-mention {
|
||||||
padding: 0.25rem 0.5rem;
|
padding: 0.25rem 0.5rem;
|
||||||
border-radius: 1rem;
|
border-radius: 1rem;
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
font-size: 0.8em;
|
font-size: 0.8em;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue