From ed233364ec5e84c5d0fbda4137a01445f3c31102 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 20 Oct 2017 19:03:29 +0300 Subject: [PATCH] Fix media player card (#471) --- src/cards/ha-media_player-card.html | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cards/ha-media_player-card.html b/src/cards/ha-media_player-card.html index 31f3da3d7a..50d1c90df7 100644 --- a/src/cards/ha-media_player-card.html +++ b/src/cards/ha-media_player-card.html @@ -238,23 +238,23 @@ class HaMediaPlayerCard extends window.hassMixins.EventsMixin(Polymer.Element) { var dummy; if (picture) { dummy = document.createElement('IMG'); - dummy.onload = function () { + dummy.onload = () => { this.$.cover.style.backgroundImage = 'url(' + picture + ')'; dummy.onerror = dummy.onload = null; dummy.src = ''; dummy = null; - }.bind(this); - dummy.onerror = function () { + }; + dummy.onerror = () => { this.$.cover.style.backgroundImage = ''; - this.toggleClass('no-cover', true, this.$.cover.parentElement); + this.$.cover.parentElement.classList.add('no-cover'); dummy.onerror = dummy.onload = null; dummy.src = ''; dummy = null; - }.bind(this); + }; if (this._timeout_id) { clearTimeout(this._timeout_id); } - this._timeout_id = setTimeout(function () { + this._timeout_id = setTimeout(() => { if (dummy) { // Background load still inflight. Clear real image. this.$.cover.style.backgroundImage = '';