diff --git a/latest-download/README.md b/latest-download/README.md new file mode 100644 index 0000000..26443f1 --- /dev/null +++ b/latest-download/README.md @@ -0,0 +1,27 @@ +# beastify + +## What it does ## + +The extension includes: + +* a browser action with a popup including HTML, CSS, and JS +* a content script +* three images, each of a different beast, packaged as web accessible resources + +When the user clicks the browser action button, the popup is shown, enabling +the user to choose one of three beasts. + +When they choose a beast, the extension injects the content script into +the current page, and sends the content script a message containing +the name of the chosen beast. + +When the content script receives this message, it replaces the current page +content with an image of the chosen beast. + +## What it shows ## + +* write a browser action with a popup +* give the popup style and behavior using CSS and JS +* inject a content script programmatically using `tabs.executeScript()` +* send a message from the main extension to a content script +* use web accessible resources to enable web pages to load packaged content diff --git a/latest-download/icons/LICENSE b/latest-download/icons/LICENSE new file mode 100644 index 0000000..20e821d --- /dev/null +++ b/latest-download/icons/LICENSE @@ -0,0 +1,2 @@ + +The "page-32.png" and "page-48.png" icons are taken from the miu iconset created by Linh Pham Thi Dieu, and are used under the terms of its license: http://linhpham.me/miu/. diff --git a/latest-download/icons/page-32.png b/latest-download/icons/page-32.png new file mode 100644 index 0000000..dae663d Binary files /dev/null and b/latest-download/icons/page-32.png differ diff --git a/latest-download/icons/page-48.png b/latest-download/icons/page-48.png new file mode 100644 index 0000000..ba042cd Binary files /dev/null and b/latest-download/icons/page-48.png differ diff --git a/latest-download/manifest.json b/latest-download/manifest.json new file mode 100644 index 0000000..4b92ff3 --- /dev/null +++ b/latest-download/manifest.json @@ -0,0 +1,30 @@ +{ + + "description": "Shows the last downloaded item, and lets you open or delete it", + "manifest_version": 2, + "name": "latest-download", + "version": "1.0", + "homepage_url": "https://github.com/mdn/webextensions-examples/tree/master/latest-download", + "icons": { + "48": "icons/page-48.png" + }, + + "applications": { + "gecko": { + "id": "latest-download@mozilla.org", + "strict_min_version": "48.0" + } + }, + + "permissions": [ + "downloads", + "downloads.open" + ], + + "browser_action": { + "default_icon": "icons/page-32.png", + "default_title": "Latest download", + "default_popup": "popup/latest_download.html" + } + +} diff --git a/latest-download/popup/latest_download.css b/latest-download/popup/latest_download.css new file mode 100644 index 0000000..48393cc --- /dev/null +++ b/latest-download/popup/latest_download.css @@ -0,0 +1,8 @@ +html, body { + font: "Open Sans",Arial,sans-serif; + height: 150px; +} + +#download-entry > * { + padding: 0.5em; +} diff --git a/latest-download/popup/latest_download.html b/latest-download/popup/latest_download.html new file mode 100644 index 0000000..3278ccc --- /dev/null +++ b/latest-download/popup/latest_download.html @@ -0,0 +1,20 @@ + + + +
+ + + + + + +