diff --git a/js/background.js b/js/background.js index 54226cf..8119772 100644 --- a/js/background.js +++ b/js/background.js @@ -18,10 +18,12 @@ chrome.contextMenus.onClicked.addListener((clickData, tab) => { } else { let title = '' let url = '' + let isImg = false if (clickData.mediaType === 'image') { // alt text title = typeof(result) == 'undefined' ? '' : result url = clickData.srcUrl + isImg = true } else if (typeof(clickData.linkUrl) !== 'undefined') { title = typeof(clickData.selectionText) == 'undefined' ? '未选中文字' : clickData.selectionText url = clickData.linkUrl @@ -34,10 +36,14 @@ chrome.contextMenus.onClicked.addListener((clickData, tab) => { let urlMode = parseInt(localStorage.getItem("urlMode")) let md = '' + if (isImg) { + md += '!' + } + if (urlMode === 1) { - md = `[${title}](${formatUrl(url)})` + md += `[${title}](${formatUrl(url)})` } else { - md = `[${title}](${url})` + md += `[${title}](${url})` } copy(md) diff --git a/manifest.json b/manifest.json index 54ec939..91e5581 100644 --- a/manifest.json +++ b/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, "name": "url2md", - "version": "1.0.0", - "description": "方便markdwon写作的小工具,复制url转成markdown格式", + "version": "1.1.0", + "description": "Copy & Convert Url to Markdown format - 方便markdwon写作的小工具,复制url转成markdown格式", "icons": { "16": "img/icon.png", @@ -31,8 +31,6 @@ [ "contextMenus", "tabs", - "webRequest", - "webRequestBlocking", "storage", "http://*/*", "https://*/*"