Skip to content

Commit 679bc27

Browse files
lint new snapshot pieces
1 parent 8c2a893 commit 679bc27

File tree

4 files changed

+27
-27
lines changed

4 files changed

+27
-27
lines changed

src/components/modebar/buttons.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ modeBarButtons.toImage = {
5858
Lib.notifier('Taking snapshot - this may take a few seconds', 'long');
5959

6060
downloadImage(gd)
61-
.then(function(filename){
61+
.then(function(filename) {
6262
Lib.notifier('Snapshot succeeded - ' + filename);
6363
})
64-
.catch(function(err) {
64+
.catch(function() {
6565
Lib.notifier('Sorry there was a problem downloading your snapshot', 'long');
6666
});
6767
}

src/snapshot/download.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function downloadImage(gd, opts) {
4242
promise.then(function(result) {
4343
gd._snapshotInProgress = false;
4444
return fileSaver(result,filename);
45-
}).then(function(name){
45+
}).then(function(name) {
4646
resolve(name);
4747
}).catch(function(err) {
4848
gd._snapshotInProgress = false;

src/snapshot/filesaver.js

+23-23
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,47 @@ License: https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md
1515

1616

1717
'use strict';
18-
19-
var saveLink = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
20-
var canUseSaveLink = "download" in saveLink;
18+
19+
var saveLink = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
20+
var canUseSaveLink = 'download' in saveLink;
2121
var isSafari = /Version\/[\d\.]+.*Safari/.test(navigator.userAgent);
2222

2323
var fileSaver = function(url, name) {
2424
var promise = new Promise(function(resolve, reject) {
25-
// IE <10 is explicitly unsupported
26-
if (typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) {
27-
reject(new Error("IE < 10 unsupported"));
28-
}
29-
30-
// First try a.download, then web filesystem, then object URLs
31-
if (isSafari) {
25+
// IE <10 is explicitly unsupported
26+
if(typeof navigator !== 'undefined' && /MSIE [1-9]\./.test(navigator.userAgent)) {
27+
reject(new Error('IE < 10 unsupported'));
28+
}
29+
30+
// First try a.download, then web filesystem, then object URLs
31+
if(isSafari) {
3232
// Safari doesn't allow downloading of blob urls
33-
document.location.href = "data:attachment/file" + url.slice(url.search(/[,;]/));
33+
document.location.href = 'data:attachment/file' + url.slice(url.search(/[,;]/));
3434
resolve(name);
3535
}
36-
37-
if (!name) {
38-
name = "download";
39-
}
40-
41-
if (canUseSaveLink) {
36+
37+
if(!name) {
38+
name = 'download';
39+
}
40+
41+
if(canUseSaveLink) {
4242
saveLink.href = url;
4343
saveLink.download = name;
4444
document.body.appendChild(saveLink);
4545
saveLink.click();
4646
document.body.removeChild(saveLink);
4747
resolve(name);
48-
}
49-
50-
// IE 10+ (native saveAs)
51-
if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) {
48+
}
49+
50+
// IE 10+ (native saveAs)
51+
if(typeof navigator !== 'undefined' && navigator.msSaveOrOpenBlob) {
5252
navigator.msSaveOrOpenBlob(url, name);
5353
resolve(name);
5454
}
55-
55+
5656
reject(new Error('download error'));
5757
});
58-
58+
5959
return promise;
6060
};
6161

src/snapshot/svgtoimg.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function svgToImg(opts) {
2424

2525
var ctx = canvas.getContext('2d');
2626
var img = new Image();
27-
27+
2828
// for Safari support, eliminate createObjectURL
2929
// this decision could cause problems if content
3030
// is not restricted to svg

0 commit comments

Comments
 (0)