diff --git a/open-my-page-button/README.md b/open-my-page-button/README.md new file mode 100644 index 0000000..bfb9033 --- /dev/null +++ b/open-my-page-button/README.md @@ -0,0 +1,14 @@ +# open-my-page + +This extension includes: + +* a background script, "background.js" +* a browser action +* a page "my-page.html" + +All it does is: when the user clicks the button, open "my-page.html" in a new tab. + +It shows: + +* how to listen for browser action clicks in a background script +* how to open a page packaged with your extension diff --git a/open-my-page-button/background.js b/open-my-page-button/background.js new file mode 100644 index 0000000..d2afdff --- /dev/null +++ b/open-my-page-button/background.js @@ -0,0 +1,9 @@ + chrome.browserAction.onClicked.addListener(openMyPage); + + function openMyPage() { + console.log("injecting"); + chrome.tabs.create({ + "url": chrome.extension.getURL("my-page.html") + }); + } + diff --git a/open-my-page-button/button/LICENSE b/open-my-page-button/button/LICENSE new file mode 100644 index 0000000..c3727aa --- /dev/null +++ b/open-my-page-button/button/LICENSE @@ -0,0 +1 @@ +The icon "beasts.png" is taken from the IconBeast Lite iconset, and used under the terms of its license (http://www.iconbeast.com/faq/), with a link back to the website: http://www.iconbeast.com/free/. diff --git a/open-my-page-button/button/beasts.png b/open-my-page-button/button/beasts.png new file mode 100644 index 0000000..bcf6379 Binary files /dev/null and b/open-my-page-button/button/beasts.png differ diff --git a/open-my-page-button/manifest.json b/open-my-page-button/manifest.json new file mode 100644 index 0000000..4fb8269 --- /dev/null +++ b/open-my-page-button/manifest.json @@ -0,0 +1,25 @@ +{ + + "manifest_version": 2, + "name": "open-my-page", + "version": "1.0", + + "applications": { + "gecko": { + "id": "open-my-page-button@mozilla.org" + } + }, + + "permissions": [ + "tabs" + ], + + "background": { + "scripts": ["background.js"] + }, + + "browser_action": { + "default_icon": "button/beasts.png" + } + +} diff --git a/open-my-page-button/my-page.html b/open-my-page-button/my-page.html new file mode 100644 index 0000000..e8c2274 --- /dev/null +++ b/open-my-page-button/my-page.html @@ -0,0 +1,12 @@ + + + +
+ + + + +