From 453863d16edf1a66dbeb31af974fb598e44d9090 Mon Sep 17 00:00:00 2001 From: lmm214 Date: Wed, 12 Oct 2022 19:52:06 +0800 Subject: [PATCH] v3 --- README.md | 2 +- _locales/zh_CN/messages.json | 6 +----- js/background.js | 18 ------------------ js/oper.js | 7 ++++--- manifest.json | 25 +++++++++++-------------- html/popup.html => popup.html | 0 6 files changed, 17 insertions(+), 41 deletions(-) delete mode 100644 js/background.js rename html/popup.html => popup.html (100%) diff --git a/README.md b/README.md index 481f973..0e25865 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## 说明 -一个通过浏览器插件发布 [memos](https://usememos.com/) 的插件。 +一个通过浏览器插件发布 [Memos](https://usememos.com/) 的插件。 基于 iSpeak-bber 修改,原作者为 [DreamyTZK](https://www.antmoe.com/)。 \ No newline at end of file diff --git a/_locales/zh_CN/messages.json b/_locales/zh_CN/messages.json index b9f5533..c678d8a 100644 --- a/_locales/zh_CN/messages.json +++ b/_locales/zh_CN/messages.json @@ -9,10 +9,6 @@ }, "extName": { "description": "扩展名称", - "message": "Memos-lmm" - }, - "selectionMenu": { - "description": "菜单(选中)", - "message": "发送选中内容" + "message": "Memos-bber" } } diff --git a/js/background.js b/js/background.js deleted file mode 100644 index aa150a0..0000000 --- a/js/background.js +++ /dev/null @@ -1,18 +0,0 @@ -chrome.contextMenus.create({ - title: "记下 “%s”", - contexts: ['selection'], - onclick: function(info, tab){ - //设定打开页面的一些初始值 - console.log(info); - chrome.storage.sync.set({open_action: "save_text",open_content:info.selectionText}, function() { - chrome.windows.create({ - url: chrome.extension.getURL("html/popup.html"), - left: 50, - top: 50, - width: 550, - height: 300, - type: "popup" - }); - }); - } -}); \ No newline at end of file diff --git a/js/oper.js b/js/oper.js index 3babf39..8737a51 100644 --- a/js/oper.js +++ b/js/oper.js @@ -48,7 +48,7 @@ $('#tags').click(function () { tagDom += '#'+obj+'' }); //console.log(tagDom) - $("#taglist").html(tagDom).slideToggle() + $("#taglist").html(tagDom).slideToggle(500) }); } else { $.message({ @@ -62,15 +62,16 @@ $(document).on("click",".item-container",function () { var tagHtml = $(this).text()+" " add(tagHtml); }) + $('#getlink').click(function () { - chrome.tabs.getSelected(null, function (tab) { + chrome.tabs.query({ active: true, currentWindow: true }, ([tab]) => { var linkHtml = " ["+tab.title+"]("+tab.url+") " if(tab.url){ add(linkHtml); }else{ $.message({message: '获取失败 😂'}) } - }); + }) }) function add(str) { diff --git a/manifest.json b/manifest.json index 320f1b7..9305ee3 100644 --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { - "background": { - "scripts": [ "js/background.js" ] - }, - "browser_action": { + "manifest_version": 3, + "name": "__MSG_extName__", + "version": "2022.10.12", + "action": { + "default_popup": "popup.html", "default_icon": "assets/logo_24x24.png", - "default_popup": "html/popup.html", "default_title": "__MSG_actionTitle__" }, "default_locale": "zh_CN", @@ -15,18 +15,15 @@ "16": "assets/logo.png", "48": "assets/logo.png" }, - "manifest_version": 2, - "name": "__MSG_extName__", - "permissions": [ "storage", "webRequest", "contextMenus", "http://*/*", "https://*/*" ], - // 新增命令 + "permissions": ["tabs","storage","activeTab"], + "host_permissions": ["http://*/*", "https://*/*"], "commands": { "_execute_browser_action": { "suggested_key": { - "default": "Ctrl+Shift+D", - "mac": "MacCtrl+Shift+D" + "default": "Ctrl+Shift+F", + "mac": "MacCtrl+Shift+F" }, "description": "Opens popup.html" } - }, - "version": "2022.10.10" -} + } +} \ No newline at end of file diff --git a/html/popup.html b/popup.html similarity index 100% rename from html/popup.html rename to popup.html