Skip to content

Commit

Permalink
dependency bump
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeDrangon committed Feb 10, 2021
1 parent 2795be6 commit 71c70a3
Show file tree
Hide file tree
Showing 3 changed files with 228 additions and 425 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,29 @@
},
"devDependencies": {
"@types/electron-settings": "^3.1.1",
"@types/node": "14.14.22",
"@types/node": "14.14.25",
"@types/webpack": "^4.41.26",
"@types/webpack-merge": "^4.1.5",
"@types/webpack-node-externals": "^2.5.0",
"@typescript-eslint/eslint-plugin": "^4.14.0",
"@typescript-eslint/parser": "^4.14.0",
"@typescript-eslint/eslint-plugin": "^4.15.0",
"@typescript-eslint/parser": "^4.15.0",
"cross-env": "^7.0.2",
"css-loader": "^5.0.0",
"electron": "11.1.0",
"electron-builder": "22.9.1",
"eslint": "^7.18.0",
"eslint": "^7.19.0",
"eslint-config-prettier": "^7.2.0",
"eslint-plugin-prettier": "^3.3.1",
"html-webpack-plugin": "^4.5.1",
"html-webpack-plugin": "^5.0.0",
"png2icons": "^2.0.1",
"prettier": "^2.1.2",
"source-map-support": "^0.5.19",
"style-loader": "^2.0.0",
"ts-loader": "^8.0.14",
"ts-loader": "^8.0.16",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"webpack": "^5.17.0",
"webpack-cli": "^4.4.0",
"typescript": "^4.1.4",
"webpack": "^5.21.2",
"webpack-cli": "^4.5.0",
"webpack-merge": "^5.7.3",
"webpack-node-externals": "^2.5.2"
}
Expand Down
43 changes: 23 additions & 20 deletions src/menu/contextMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,34 +71,37 @@ export const popupContextMenu = async (
{
label: `Save ${mediaType} As...`,
click: () => {
const link = document.createElement('a'),
d = new Date(),
download = (url:string) =>
{
link.href = url;
link.download = "IMG_" + d.getFullYear() + pad(d.getMonth()+1) + pad(d.getDate()) + "_" + pad(d.getHours()) + pad(d.getMinutes()) + pad(d.getSeconds());
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
pad = (t:number) => ("0" + t).substr(-2);
const link = document.createElement("a"),
d = new Date(),
download = (url: string) => {
link.href = url;
link.download =
"IMG_" +
d.getFullYear() +
pad(d.getMonth() + 1) +
pad(d.getDate()) +
"_" +
pad(d.getHours()) +
pad(d.getMinutes()) +
pad(d.getSeconds());
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
pad = (t: number) => ("0" + t).substr(-2);

if (params.srcURL.match(/^blob:/i))
{
if (params.srcURL.match(/^blob:/i)) {
download(params.srcURL);
}
else
{
} else {
//using AJAX to prevent non-blob images from being opened instead of downloaded (i.e preview of web links)
const xhr = new XMLHttpRequest();
xhr.open("GET", params.srcURL, true);
xhr.responseType = "blob";
xhr.onload = function()
{
const url = window.URL.createObjectURL(this.response);
xhr.onload = function () {
const url = window.URL.createObjectURL(this.response);
download(url);
window.URL.revokeObjectURL(url);
}
};
xhr.send();
}
},
Expand Down
Loading

0 comments on commit 71c70a3

Please sign in to comment.