diff --git a/background.js b/background.js deleted file mode 100644 index 131cc42..0000000 --- a/background.js +++ /dev/null @@ -1,13 +0,0 @@ -function openPage(url) { - browser.tabs.create({ - url: "https://jeena.net/notes/new?in_reply_to=" + url - }); -} - -async function buttonClicked() { - const [tab] = await browser.tabs.query({currentWindow: true, active:true}); - console.log(tab) - openPage(tab.url); -} - -browser.browserAction.onClicked.addListener(buttonClicked); diff --git a/button.js b/button.js new file mode 100644 index 0000000..ee233a6 --- /dev/null +++ b/button.js @@ -0,0 +1,11 @@ +async function buttonClicked(e) { + const [tab] = await browser.tabs.query({currentWindow: true, active:true}); + + browser.tabs.create({ + url: e.target.parentNode.dataset.href + tab.url + }); + + window.close() +} + +document.addEventListener("click", buttonClicked) diff --git a/icons/icon-16.png b/icons/icon-16.png deleted file mode 100644 index c8d71de..0000000 Binary files a/icons/icon-16.png and /dev/null differ diff --git a/icons/icon-32.png b/icons/icon-32.png deleted file mode 100644 index f72c18e..0000000 Binary files a/icons/icon-32.png and /dev/null differ diff --git a/icons/icon.svg b/icons/icon.svg new file mode 100644 index 0000000..0ff60f4 --- /dev/null +++ b/icons/icon.svg @@ -0,0 +1,60 @@ + + + + \ No newline at end of file diff --git a/icons/like.svg b/icons/like.svg new file mode 100644 index 0000000..dd6ea32 --- /dev/null +++ b/icons/like.svg @@ -0,0 +1,60 @@ + + + + \ No newline at end of file diff --git a/icons/reply.svg b/icons/reply.svg new file mode 100644 index 0000000..32d90e7 --- /dev/null +++ b/icons/reply.svg @@ -0,0 +1,60 @@ + + + + \ No newline at end of file diff --git a/manifest.json b/manifest.json index 6d089c7..1207ed1 100644 --- a/manifest.json +++ b/manifest.json @@ -1,21 +1,17 @@ { - - "description": "Indie Reply Button", + "description": "Button to like and reply", "manifest_version": 2, - "name": "indie-reply-button", - "version": "1.0", - - "background": { - "scripts": ["background.js"] + "name": "Indie Reply Button", + "version": "2.0", + "icons": { + "48": "icons/icon.svg" }, - "browser_action": { - "default_icon": { - "16": "icons/icon-16.png", - "32": "icons/icon-32.png" - } + "default_icon": "icons/icon.svg", + "default_title": "IndieButton", + "default_popup": "popup.html", + "browser_style": false }, - "permissions": [ "tabs" ] diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..5b2d259 --- /dev/null +++ b/popup.html @@ -0,0 +1,20 @@ + + +
+ +