From c232eb2478f16ed913de6eced7ed18d03ca7a1fb Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Wed, 24 Oct 2018 22:30:41 +1100 Subject: Fix SVG issue for older browsers (fixes #1191) --- src/js/controls.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index 785f100d..efc45e8a 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -111,10 +111,11 @@ const controls = { // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href if ('href' in use) { use.setAttributeNS('http://www.w3.org/1999/xlink', 'href', path); - } else { - use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); } + // Always set the older attribute even though it's "deprecated" (it'll be around for ages) + use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', path); + // Add to icon.appendChild(use); -- cgit v1.2.3 From 03c9b53232aeab78a7c592e1bcf387312f77a569 Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Wed, 24 Oct 2018 22:31:35 +1100 Subject: Allow custom download URL (for streaming, etc) --- src/js/controls.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/js/controls.js') diff --git a/src/js/controls.js b/src/js/controls.js index efc45e8a..4f453e6a 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -1229,11 +1229,15 @@ const controls = { // Set the download link setDownloadLink() { - // Set download link - const { download } = this.elements.buttons; - if (is.element(download)) { - download.setAttribute('href', this.source); + const button = this.elements.buttons.download; + + // Bail if no button + if (!is.element(button)) { + return; } + + // Set download link + button.setAttribute('href', this.download); }, // Build the default HTML @@ -1516,15 +1520,13 @@ const controls = { if (this.config.controls.includes('download')) { const attributes = { element: 'a', - href: this.source, + href: this.download, target: '_blank', }; - if (this.isHTML5) { - extend(attributes, { - download: '', - }); - } else if (this.isEmbed) { + const { download } = this.config.urls; + + if (!is.url(download) && this.isEmbed) { extend(attributes, { icon: `logo-${this.provider}`, label: this.provider, -- cgit v1.2.3