Add data- attributes to statuses for userstyle selectors (#117)
* Add data- attributes to statuses for userstyle selectors * use const and template string, replace reblog->boosted and favourite->favourited * more template strings because sorin-sama said so
This commit is contained in:
parent
aa6e24bf44
commit
6c783a25c2
1 changed files with 20 additions and 0 deletions
|
@ -664,6 +664,25 @@ backgrounds for collapsed statuses are enabled.
|
||||||
) background = attachments.getIn([0, 'preview_url']);
|
) background = attachments.getIn([0, 'preview_url']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Here we prepare extra data-* attributes for CSS selectors.
|
||||||
|
Users can use those for theming, hiding avatars etc via UserStyle
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
const selectorAttribs = {
|
||||||
|
'data-status-by': `@${status.getIn(['account', 'acct'])}`,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (prepend && account) {
|
||||||
|
const notifKind = {
|
||||||
|
favourite: 'favourited',
|
||||||
|
reblog: 'boosted',
|
||||||
|
}[prepend];
|
||||||
|
|
||||||
|
selectorAttribs[`data-${notifKind}-by`] = `@${account.get('acct')}`;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
|
@ -694,6 +713,7 @@ collapsed.
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
ref={handleRef}
|
ref={handleRef}
|
||||||
|
{...selectorAttribs}
|
||||||
>
|
>
|
||||||
{prepend && account ? (
|
{prepend && account ? (
|
||||||
<StatusPrepend
|
<StatusPrepend
|
||||||
|
|
Loading…
Reference in a new issue