initial
This commit is contained in:
commit
aa41a8cacc
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*.zip
|
||||||
|
/.idea
|
19
background.js
Normal file
19
background.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
function downloadResource(info, tab) {
|
||||||
|
let url = info['srcUrl']
|
||||||
|
|
||||||
|
let filename = url.substring(url.lastIndexOf('/')+1)
|
||||||
|
if (filename.indexOf('?') !== false)
|
||||||
|
filename = filename.substring(0, filename.indexOf('?'))
|
||||||
|
|
||||||
|
chrome.downloads.download({
|
||||||
|
url,
|
||||||
|
filename,
|
||||||
|
saveAs: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
chrome.contextMenus.create({
|
||||||
|
"title": "Save to Downloads…",
|
||||||
|
"contexts": ["image"],
|
||||||
|
"onclick": downloadResource
|
||||||
|
})
|
9
manifest.json
Normal file
9
manifest.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"manifest_version": 2,
|
||||||
|
"name": "Save images to Downloads",
|
||||||
|
"version": "1.0",
|
||||||
|
"background": {
|
||||||
|
"scripts": ["background.js"]
|
||||||
|
},
|
||||||
|
"permissions": ["downloads", "contextMenus"]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user