parent
b0cd19aefd
commit
999be40360
@ -0,0 +1,9 @@ |
|||||||
|
{"extName": { |
||||||
|
"message": "Download Button", |
||||||
|
"description": "Extension name"}, |
||||||
|
"extDesc": { |
||||||
|
"message": "Download Context Menu Button", |
||||||
|
"description": "Extension description"}, |
||||||
|
"openContextMenuTitle": { |
||||||
|
"message": "Download", |
||||||
|
"description": "context menu button text"}} |
@ -0,0 +1,12 @@ |
|||||||
|
chrome.contextMenus.onClicked.addListener(function(info) { |
||||||
|
// retrieve 311175 from https://openclipart.org/image/400px/311175
|
||||||
|
const imageId = info.srcUrl.split('/').pop() |
||||||
|
const svgUrl = "https://openclipart.org/download/" + imageId |
||||||
|
chrome.downloads.download({url: svgUrl, saveAs: true }, downloadId => console.log(downloadId)) |
||||||
|
}); |
||||||
|
|
||||||
|
chrome.contextMenus.create({ |
||||||
|
id: 'open', |
||||||
|
title: chrome.i18n.getMessage('openContextMenuTitle'), |
||||||
|
contexts: ['link'], |
||||||
|
}); |
Loading…
Reference in new issue