From a71783a97d89a794f50a054f36cf7ec66c12316c Mon Sep 17 00:00:00 2001 From: wbamberg Date: Fri, 23 Jun 2017 13:54:56 -0700 Subject: [PATCH] Add a search engine example (#235) --- discogs-search/README.md | 17 +++++++++++++++++ discogs-search/manifest-chrome.json | 19 +++++++++++++++++++ discogs-search/manifest-firefox.json | 23 +++++++++++++++++++++++ discogs-search/manifest.json | 23 +++++++++++++++++++++++ 4 files changed, 82 insertions(+) create mode 100644 discogs-search/README.md create mode 100644 discogs-search/manifest-chrome.json create mode 100644 discogs-search/manifest-firefox.json create mode 100644 discogs-search/manifest.json diff --git a/discogs-search/README.md b/discogs-search/README.md new file mode 100644 index 0000000..e458060 --- /dev/null +++ b/discogs-search/README.md @@ -0,0 +1,17 @@ +# discogs-search + +## What it does + +This add-on adds a search engine to the browser, that sends the search term to the [discogs.com](https://discogs.com) website. + +It also adds a keyword "disc", so you can type "disc Model 500" and get the discogs search engine without having to select it. + +## What it shows + +How to use the [`chrome_settings_overrides`](https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/chrome_settings_overrides) manifest key to define a new search engine. + +Note that Chrome mandates the `is_default` property, and `encoding` must also be included unless `prepopulated_id` is set. Since none of these properties are yet supported in Firefox, it's not possible to write a single manifest.json that works in both browsers. So this example includes three manifest*.json files: + +* manifest-chrome.json: works in Chrome. Rename this to manifest.json to use Chrome. +* manifest-firefox.json: works in Firefox. +* manifest.json: the default. The same as manifest-firefox.json diff --git a/discogs-search/manifest-chrome.json b/discogs-search/manifest-chrome.json new file mode 100644 index 0000000..289044f --- /dev/null +++ b/discogs-search/manifest-chrome.json @@ -0,0 +1,19 @@ +{ + + "manifest_version": 2, + "name": "Discogs search engine", + "description": "Adds a search engine that searches discogs.com", + "version": "1.0", + + "chrome_settings_overrides": { + "search_provider": { + "name": "Discogs", + "search_url": "https://www.discogs.com/search/?q={searchTerms}", + "keyword": "disc", + "favicon_url": "https://www.discogs.com/favicon.ico", + "is_default": false, + "encoding": "UTF-8" + } + } + +} diff --git a/discogs-search/manifest-firefox.json b/discogs-search/manifest-firefox.json new file mode 100644 index 0000000..5eb8634 --- /dev/null +++ b/discogs-search/manifest-firefox.json @@ -0,0 +1,23 @@ +{ + + "manifest_version": 2, + "name": "Discogs search engine", + "description": "Adds a search engine that searches discogs.com", + "version": "1.0", + + "applications": { + "gecko": { + "strict_min_version": "55" + } + }, + + "chrome_settings_overrides": { + "search_provider": { + "name": "Discogs", + "search_url": "https://www.discogs.com/search/?q={searchTerms}", + "keyword": "disc", + "favicon_url": "https://www.discogs.com/favicon.ico" + } + } + +} diff --git a/discogs-search/manifest.json b/discogs-search/manifest.json new file mode 100644 index 0000000..5eb8634 --- /dev/null +++ b/discogs-search/manifest.json @@ -0,0 +1,23 @@ +{ + + "manifest_version": 2, + "name": "Discogs search engine", + "description": "Adds a search engine that searches discogs.com", + "version": "1.0", + + "applications": { + "gecko": { + "strict_min_version": "55" + } + }, + + "chrome_settings_overrides": { + "search_provider": { + "name": "Discogs", + "search_url": "https://www.discogs.com/search/?q={searchTerms}", + "keyword": "disc", + "favicon_url": "https://www.discogs.com/favicon.ico" + } + } + +}