* added json for prettier, npm run prettier in lint-staged
This commit is contained in:
Benjamin Lörincz 2023-05-01 17:29:59 +02:00 коммит произвёл GitHub
Родитель e09fc71c9e
Коммит dc5d34f0f7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
14 изменённых файлов: 101 добавлений и 92 удалений

Просмотреть файл

@ -46,6 +46,7 @@ cd chrome-extensions-samples
# install dependencies
npm install
```
### Writing a README
All new code samples or samples updated from Manifest V2 should include a README file. Please copy the [provided template](./README-template.md) into your sample's folder and follow the instructions therein.

Просмотреть файл

@ -4,7 +4,6 @@ _To create a README for your sample_
1. _Enter the requested information below._
1. _Delete all intructions._
_For API samples use the name of the API. For example, a sample about the `chrome.declarativeNetRequest` would simply be called "chrome.declarativeNetRequest". (Do not use special formatting in headings.) For functional samples, the title should be what the sample demonstrates_
# Title

Просмотреть файл

@ -4,7 +4,7 @@
"version": "0.7",
"permissions": ["contextMenus"],
"background": {
"service_worker": "sample.js"
"service_worker": "sample.js"
},
"manifest_version": 3
}

Просмотреть файл

@ -3,21 +3,18 @@
"description": "Removes 'Cookie' headers.",
"version": "1.0",
"manifest_version": 3,
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback"
],
"host_permissions": [
"<all_urls>"
],
"permissions": ["declarativeNetRequest", "declarativeNetRequestFeedback"],
"host_permissions": ["<all_urls>"],
"background": {
"service_worker": "service-worker.js"
},
"declarative_net_request" : {
"rule_resources" : [{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}]
"declarative_net_request": {
"rule_resources": [
{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}
]
}
}

Просмотреть файл

@ -4,9 +4,7 @@
"priority": 1,
"action": {
"type": "modifyHeaders",
"requestHeaders": [
{ "header": "cookie", "operation": "remove" }
]
"requestHeaders": [{ "header": "cookie", "operation": "remove" }]
},
"condition": {
"urlFilter": "|*?no-cookies=1",

Просмотреть файл

@ -6,15 +6,14 @@
"background": {
"service_worker": "service_worker.js"
},
"declarative_net_request" : {
"rule_resources" : [{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}]
"declarative_net_request": {
"rule_resources": [
{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}
]
},
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback"
]
"permissions": ["declarativeNetRequest", "declarativeNetRequestFeedback"]
}

Просмотреть файл

@ -1,11 +1,11 @@
[
{
"id" : 1,
"id": 1,
"priority": 1,
"action" : { "type" : "block" },
"condition" : {
"urlFilter" : "||example.com",
"resourceTypes" : ["main_frame"]
"action": { "type": "block" },
"condition": {
"urlFilter": "||example.com",
"resourceTypes": ["main_frame"]
}
}
]

Просмотреть файл

@ -6,19 +6,19 @@
"background": {
"service_worker": "service_worker.js"
},
"declarative_net_request" : {
"rule_resources" : [{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}]
"declarative_net_request": {
"rule_resources": [
{
"id": "ruleset_1",
"enabled": true,
"path": "rules_1.json"
}
]
},
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback",
"declarativeNetRequestWithHostAccess"
],
"host_permissions": [
"https://developer.chrome.com/"
]
"host_permissions": ["https://developer.chrome.com/"]
}

Просмотреть файл

@ -1,10 +1,12 @@
[
{
"id" : 1,
"id": 1,
"priority": 1,
"action": {
"type": "redirect",
"redirect": { "url": "https://developer.chrome.com/docs/extensions/mv3/intro/" }
"redirect": {
"url": "https://developer.chrome.com/docs/extensions/mv3/intro/"
}
},
"condition": {
"urlFilter": "https://developer.chrome.com/docs/extensions/mv2/",
@ -12,11 +14,13 @@
}
},
{
"id" : 2,
"id": 2,
"priority": 1,
"action": {
"type": "redirect",
"redirect": { "url": "https://developer.chrome.com/docs/extensions/reference/action/" }
"redirect": {
"url": "https://developer.chrome.com/docs/extensions/reference/action/"
}
},
"condition": {
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/browserAction/",
@ -24,11 +28,13 @@
}
},
{
"id" : 3,
"id": 3,
"priority": 1,
"action": {
"type": "redirect",
"redirect": { "url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/" }
"redirect": {
"url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/"
}
},
"condition": {
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/declarativeWebRequest/",
@ -36,11 +42,13 @@
}
},
{
"id" : 4,
"id": 4,
"priority": 1,
"action": {
"type": "redirect",
"redirect": { "url": "https://developer.chrome.com/docs/extensions/reference/action/" }
"redirect": {
"url": "https://developer.chrome.com/docs/extensions/reference/action/"
}
},
"condition": {
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/pageAction/",
@ -48,11 +56,13 @@
}
},
{
"id" : 5,
"id": 5,
"priority": 1,
"action": {
"type": "redirect",
"redirect": { "url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/" }
"redirect": {
"url": "https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/"
}
},
"condition": {
"urlFilter": "https://developer.chrome.com/docs/extensions/reference/webRequest/",

Просмотреть файл

@ -1,13 +1,13 @@
# chrome.printing
This sample demonstrates all four methods of the `chrome.printing` namespace.
This sample demonstrates all four methods of the `chrome.printing` namespace.
## Overview
The `chrome.printing` namespace only works on ChromeOS. The sample demonstrates how to get a list of available printers and display it to a user. A 'Print' button sends a sample PDF to the selected printer and makes a 'Cancel Printing' visible. This button is visible while the print job's status is `"PENDING"` or `"IN_PROGRESS"`. Note that on some systems, the print job is passed to the printer so quickly that you may never see the 'Cancel Printing' button.
Calling `submitJob()` triggers a dialog box asking the user to confirm printing. Use the [`PrintingAPIExtensionsAllowlist`](https://chromeenterprise.google/policies/#PrintingAPIExtensionsAllowlist") policy to bypass confirmation.
Calling `submitJob()` triggers a dialog box asking the user to confirm printing. Use the [`PrintingAPIExtensionsAllowlist`](https://chromeenterprise.google/policies/#PrintingAPIExtensionsAllowlist") policy to bypass confirmation.
## Implementation Notes
Note that the `submitJob()` function throws an error when returning a promise ([crbug: 1422837](https://bugs.chromium.org/p/chromium/issues/detail?id=1422837)).
Note that the `submitJob()` function throws an error when returning a promise ([crbug: 1422837](https://bugs.chromium.org/p/chromium/issues/detail?id=1422837)).

Просмотреть файл

@ -5,13 +5,7 @@
"background": {
"service_worker": "sw.js"
},
"permissions": [
"scripting",
"webNavigation",
"storage"
],
"host_permissions": [
"https://example.com/*"
],
"permissions": ["scripting", "webNavigation", "storage"],
"host_permissions": ["https://example.com/*"],
"action": {}
}

Просмотреть файл

@ -1,16 +1,17 @@
{
"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
}
"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
}

Просмотреть файл

@ -1,14 +1,24 @@
[
{
"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": 1,
"priority": 100,
"action": {
"type": "redirect",
"redirect": {
"url": "https://i.chzbgr.com/completestore/12/8/23/S__rxG9hIUK4sNuMdTIY9w2.jpg"
}
},
{
"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"]}
}
]
"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"] }
}
]

Просмотреть файл

@ -4,7 +4,7 @@
"private": true,
"description": "Official samples for Chrome Extensions and the Chrome Apps platform.",
"scripts": {
"prettier": "npx prettier **/*.{md,html} -w",
"prettier": "npx prettier **/*.{md,html,json} -w",
"lint": "eslint **/*.js",
"lint:fix": "npm run lint -- --fix",
"prepare": "husky install"
@ -33,7 +33,7 @@
"**/*.js": [
"npx eslint --fix"
],
"**/*.{md,html}": [
"**/*.{md,html,json}": [
"npx prettier --write"
]
}