mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-26 13:19:49 +07:00
Update api sample for action (#838)
* add sample for catifier that replaces every jpg image on web by another cat image * add readme for catifier * add section for set/get badge text color * add usage of isEnabled,getBadgeTextColor and setBadgeTextColor * capitalize button text * use single quote and update badge text to test * use <all_urls> host_permission
This commit is contained in:
8
functional-samples/sample.catifier/README.md
Normal file
8
functional-samples/sample.catifier/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# Catifier
|
||||
|
||||
When the extension is enabled, it replaces every image of extension jpg or jpeg, with [this](https://i.chzbgr.com/completestore/12/8/23/S__rxG9hIUK4sNuMdTIY9w2.jpg) image.
|
||||
|
||||
## Testing the extension
|
||||
|
||||
1. Follow the instructions to load an [unpacked extension](https://developer.chrome.com/docs/extensions/mv3/getstarted/development-basics/#load-unpacked).
|
||||
2. Navigate to any website, you should see every jpg or jpeg image being replaced by an image of a cat.
|
||||
16
functional-samples/sample.catifier/manifest.json
Normal file
16
functional-samples/sample.catifier/manifest.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "Catifier",
|
||||
"version": "1.0",
|
||||
"description": "Replace every image by a cat's image in a website you visit",
|
||||
"permissions": ["declarativeNetRequest"],
|
||||
"host_permissions": ["<all_urls>"],
|
||||
"declarative_net_request": {
|
||||
"rule_resources": [{
|
||||
"id": "ruleset_1",
|
||||
"enabled": true,
|
||||
"path": "rules.json"
|
||||
}]
|
||||
},
|
||||
|
||||
"manifest_version": 3
|
||||
}
|
||||
14
functional-samples/sample.catifier/rules.json
Normal file
14
functional-samples/sample.catifier/rules.json
Normal file
@@ -0,0 +1,14 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"priority": 100,
|
||||
"action": { "type": "redirect", "redirect": { "url": "https://i.chzbgr.com/completestore/12/8/23/S__rxG9hIUK4sNuMdTIY9w2.jpg" } },
|
||||
"condition": {"urlFilter": "*.jpeg", "resourceType": ["image"]}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"priority": 100,
|
||||
"action": { "type": "redirect", "redirect": { "url": "https://i.chzbgr.com/completestore/12/8/23/S__rxG9hIUK4sNuMdTIY9w2.jpg" } },
|
||||
"condition": {"urlFilter": "*.jpg", "resourceType": ["image"]}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user