Browse Source

use <img> instead of <div> for avatars

This lets you right click steal them more easily
main
Kay Faraday 7 months ago
parent
commit
a34b7d3b5e
  1. 8
      app/javascript/flavours/glitch/components/avatar.js
  2. 6
      app/javascript/flavours/glitch/components/avatar_composite.js
  3. 8
      app/javascript/mastodon/components/avatar.js

8
app/javascript/flavours/glitch/components/avatar.js

@ -57,14 +57,14 @@ export default class Avatar extends React.PureComponent {
backgroundSize: `${size}px ${size}px`,
};
let imageSrc = staticSrc;
if (hovering || animate) {
style.backgroundImage = `url(${src})`;
} else {
style.backgroundImage = `url(${staticSrc})`;
imageSrc = src;
}
return (
<div
<img
src={imageSrc}
className={computedClass}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}

6
app/javascript/flavours/glitch/components/avatar_composite.js

@ -67,6 +67,8 @@ export default class AvatarComposite extends React.PureComponent {
}
}
const imageSrc = account.get(animate ? 'avatar' : 'avatar_static');
const style = {
left: left,
top: top,
@ -74,8 +76,6 @@ export default class AvatarComposite extends React.PureComponent {
bottom: bottom,
width: `${width}%`,
height: `${height}%`,
backgroundSize: 'cover',
backgroundImage: `url(${account.get(animate ? 'avatar' : 'avatar_static')})`,
};
return (
@ -86,7 +86,7 @@ export default class AvatarComposite extends React.PureComponent {
title={`@${account.get('acct')}`}
key={account.get('id')}
>
<div style={style} data-avatar-of={`@${account.get('acct')}`} />
<img src={imageSrc} style={style} data-avatar-of={`@${account.get('acct')}`} />
</a>
);
}

8
app/javascript/mastodon/components/avatar.js

@ -53,14 +53,14 @@ export default class Avatar extends React.PureComponent {
backgroundSize: `${size}px ${size}px`,
};
let imageSrc = staticSrc;
if (hovering || animate) {
style.backgroundImage = `url(${src})`;
} else {
style.backgroundImage = `url(${staticSrc})`;
imageSrc = src;
}
return (
<div
<img
src={imageSrc}
className={className}
onMouseEnter={this.handleMouseEnter}
onMouseLeave={this.handleMouseLeave}

Loading…
Cancel
Save