~phw/discourse-listenbrainz

dbd13e848d0c4e5a0d486ca52106a3236f723629 — Philipp Wolfer 1 year, 13 days ago 526e208
Do not load covers if data saving is enabled in browser
M CHANGES.md => CHANGES.md +4 -0
@@ 1,5 1,9 @@
# Discourse ListenBrainz Changelog

## 0.12 - unreleased
- Do not load covers if data saving is enabled in browser


## 0.11 - 2023-03-17
- Link top recording title and artist in user profile card
- Fixed fallback background cover repeating if card height grew

M assets/javascripts/discourse/components/listenbrainz-generic-cover.js => assets/javascripts/discourse/components/listenbrainz-generic-cover.js +4 -0
@@ 13,6 13,10 @@ export default class GenericCoverComponent extends Component {
        this.title = args.title
    }

    get showCover() {
        return !!this.src && navigator?.connection?.saveData !== true
    }

    @action
    onLoad() {
        this.style = Ember.String.htmlSafe('opacity: 1;')

M assets/javascripts/discourse/templates/components/listenbrainz-cover-collage.hbs => assets/javascripts/discourse/templates/components/listenbrainz-cover-collage.hbs +5 -1
@@ 1,5 1,9 @@
<object data="{{this.src}}"
{{#if this.showCover}}
<object data="{{this.showCover}}"
    type="image/svg+xml"
    title="{{this.title}}"
    {{on "load" this.onLoad}}
    style="{{this.style}}"></object>
{{else}}
<span/>
{{/if}}

M assets/javascripts/discourse/templates/components/listenbrainz-cover.hbs => assets/javascripts/discourse/templates/components/listenbrainz-cover.hbs +1 -1
@@ 1,4 1,4 @@
{{#if this.src}}
{{#if this.showCover}}
<img src="{{this.src}}"
    title="{{this.title}}"
    {{on "load" this.onLoad}}