diff --git a/manifest.json b/manifest.json index b5d414c..0fae2c4 100644 --- a/manifest.json +++ b/manifest.json @@ -9,18 +9,15 @@ "strict_min_version": "45.0" } }, - "content_scripts": [ - { - "matches": [ - "*://*.mozilla.org/*" - ], - "js": [ - "postify.js" - ] - } + "permissions": [ + "activeTab", + "tabs" ], + "background": { + "scripts": ["postify.js"] + }, "browser_action": { "default_icon": "icons/postify-32.png", - "default_title": "Beastify" + "default_title": "Postify" } } \ No newline at end of file diff --git a/postify.js b/postify.js index 59627ae..040b240 100644 --- a/postify.js +++ b/postify.js @@ -1 +1,17 @@ -console.log('Yeah!') \ No newline at end of file +console.log('Load!'); + +function onGot(tabInfo) { + var tab = tabInfo[0]; + var url = tab.url; + console.log(url); +} + +function onError(error) { + console.log(`Error: ${error}`); +} + +function sendCurrentUrl() { + browser.tabs.query({currentWindow: true, active: true}).then(onGot, onError); +} + +browser.browserAction.onClicked.addListener(sendCurrentUrl);