From 753b8df80c48136923c78100391ab4bdae9b2c0c Mon Sep 17 00:00:00 2001 From: Will Bamberg Date: Thu, 17 Sep 2015 10:30:35 -0700 Subject: [PATCH] added open-my-page example --- open-my-page-button/README.md | 14 ++++++++++++++ open-my-page-button/background.js | 9 +++++++++ open-my-page-button/button/LICENSE | 1 + open-my-page-button/button/beasts.png | Bin 0 -> 550 bytes open-my-page-button/manifest.json | 25 +++++++++++++++++++++++++ open-my-page-button/my-page.html | 12 ++++++++++++ 6 files changed, 61 insertions(+) create mode 100644 open-my-page-button/README.md create mode 100644 open-my-page-button/background.js create mode 100644 open-my-page-button/button/LICENSE create mode 100644 open-my-page-button/button/beasts.png create mode 100644 open-my-page-button/manifest.json create mode 100644 open-my-page-button/my-page.html 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 0000000000000000000000000000000000000000..bcf6379ad54fc410735e2f614cf4bf5d84826931 GIT binary patch literal 550 zcmV+>0@?kEP)P4s*bg&T+X2D^S3bs_x^9B4U##hRp#aW(;_tiPs;*009zgrA{pX5MYBEVT*|Q zNb>WEDW$Mg=fvc0Y`_tzoFUn4CM-E)J=CxOw5paAfLuNAhnnd?OhX7c7h!8>^rMwB z*fP$2EaK})sc9U@@Ua7-%!mx`6QR%nhr0V%97s|*v>!>)d8CR;fXMRcJ(?cmN`617 z!Dc{Wx%Quu;!FXWXx@`yDYEbT@ikwFjcZEqePSCSw7?Dc3Xl&pEP6i>6Tj%ss_i(@^GG%=r)c&0f30H`Hs+R + + + + + + + +

It's my page!

+ + +