Skip to content

Commit f6e2b49

Browse files
committed
Cross-browser templates
1 parent fecf8fe commit f6e2b49

File tree

276 files changed

+1323
-1562
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+1323
-1562
lines changed

examples/action-chatgpt/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json.schemastore.org/chrome-manifest.json",
33
"manifest_version": 3,
44
"version": "0.0.1",
5-
"name": "Action ChatGPT Template",
5+
"name": "Action Chatgpt",
66
"description": "An Extension.js example.",
77
"icons": {
88
"16": "images/extension_16.png",
File renamed without changes.

examples/locales/_locales/pt_BR/messages.json renamed to examples/action-locales/_locales/pt_BR/messages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "The title of the extension page"
55
},
66
"learnMore": {
7-
"message": "Saiba mais sobre a criação de extensões multiplataforma em ",
7+
"message": "Saiba mais sobre como criar extensões multiplataforma em ",
88
"description": "The learn more text"
99
}
1010
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
if (
2+
process.env.EXTENSION_PUBLIC_BROWSER === 'firefox' ||
3+
process.env.EXTENSION_PUBLIC_BROWSER === 'firefox-based'
4+
) {
5+
document.getElementById('title').textContent = chrome.i18n.getMessage('title')
6+
document.getElementById('learnMore').textContent =
7+
chrome.i18n.getMessage('learnMore')
8+
} else {
9+
document.getElementById('title').textContent = chrome.i18n.getMessage('title')
10+
document.getElementById('learnMore').textContent =
11+
chrome.i18n.getMessage('learnMore')
12+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
html {
2+
font-size: 62.5%;
3+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
4+
'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
5+
}
6+
7+
body {
8+
width: 300px;
9+
height: 100%;
10+
padding: 1rem;
11+
font-size: 1.35rem;
12+
line-height: 1.618;
13+
color: #c9c9c9;
14+
background-color: #0A0C10;
15+
}
16+
17+
h1 {
18+
line-height: 1.1;
19+
font-weight: 700;
20+
font-size: 2.7em;
21+
margin-bottom: 1.5rem;
22+
}
23+
24+
a {
25+
text-decoration: none;
26+
border-bottom: 2px solid #c9c9c9;
27+
color: #e5e7eb;
28+
}
29+
30+
img {
31+
height: auto;
32+
max-width: 100%;
33+
margin-top: 1rem;
34+
margin-bottom: 1.5rem;
35+
}

examples/locales/manifest.json renamed to examples/action-locales/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"$schema": "https://json.schemastore.org/chrome-manifest.json",
33
"manifest_version": 3,
44
"version": "0.0.1",
5-
"name": "Locales Template",
5+
"name": "Action Locales",
66
"author": "Cezar Augusto",
77
"default_locale": "en",
88
"description": "An Extension.js example.",

examples/locales/package.json renamed to examples/action-locales/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"name": "locales",
3+
"name": "action-locales",
44
"description": "An Extension.js example.",
55
"version": "0.0.1",
66
"author": {

examples/action/action/scripts.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1 @@
1-
function getManifest() {
2-
return chrome.runtime.getManifest()
3-
}
4-
5-
const manifestData = getManifest()
6-
7-
console.table({
8-
name: manifestData.name,
9-
version: manifestData.version,
10-
description: manifestData.description
11-
})
1+
console.log('Hello from the browser action page!')

examples/action/action/styles.css

Lines changed: 7 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -5,52 +5,20 @@ html {
55
}
66

77
body {
8-
display: flex;
9-
justify-content: center;
10-
align-items: center;
11-
height: calc(100vh - 4rem);
12-
min-width: 300px;
13-
padding: 2rem;
14-
font-size: 1.8rem;
8+
width: 300px;
9+
height: 100%;
10+
padding: 1rem;
11+
font-size: 1.35rem;
1512
line-height: 1.618;
16-
max-width: 38em;
17-
margin: auto;
1813
color: #c9c9c9;
1914
background-color: #0A0C10;
2015
}
2116

22-
@media (max-width: 684px) {
23-
body {
24-
font-size: 1.53rem;
25-
}
26-
}
27-
28-
@media (max-width: 382px) {
29-
body {
30-
font-size: 1.35rem;
31-
}
32-
}
33-
3417
h1 {
3518
line-height: 1.1;
3619
font-weight: 700;
20+
font-size: 2.7em;
3721
margin-bottom: 1.5rem;
38-
overflow-wrap: break-word;
39-
word-wrap: break-word;
40-
-ms-word-break: break-all;
41-
word-break: break-word;
42-
font-size: 4.7em;
43-
}
44-
45-
@media (max-width: 684px) {
46-
h1 {
47-
font-size: 2.7em;
48-
}
49-
}
50-
51-
p {
52-
margin-top: 0px;
53-
margin-bottom: 2.5rem;
5422
}
5523

5624
a {
@@ -59,29 +27,9 @@ a {
5927
color: #e5e7eb;
6028
}
6129

62-
6330
img {
6431
height: auto;
6532
max-width: 100%;
66-
margin-top: 0px;
67-
margin-bottom: 2.5rem;
68-
}
69-
70-
@media (max-width: 684px) {
71-
img {
72-
margin-top: 2rem;
73-
margin-bottom: 1rem;
74-
}
75-
}
76-
77-
body {
78-
display: flex;
79-
justify-content: center;
80-
align-items: center;
81-
height: calc(100vh - 4rem);
33+
margin-top: 1rem;
34+
margin-bottom: 1.5rem;
8235
}
83-
84-
header > div {
85-
display: flex;
86-
align-items: center;
87-
}

examples/action/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
"$schema": "https://json.schemastore.org/chrome-manifest.json",
33
"manifest_version": 3,
44
"version": "0.0.1",
5-
"name": "Action Template",
5+
"name": "Action",
66
"description": "An Extension.js example.",
77
"icons": {
88
"16": "images/extension_16.png",
99
"48": "images/extension_48.png"
1010
},
11+
"permissions": ["storage", "tabs", "activeTab", "scripting"],
1112
"action": {
1213
"default_popup": "./action/index.html",
1314
"default_title": "Action",

examples/config-babel/newtab/scripts.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/config-stylelint/newtab/scripts.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/content-css-module/background.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

examples/content-css-module/content/Logo.module.css

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/content-css-module/content/scripts.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

examples/content-css-module/content/styles.css

Lines changed: 0 additions & 40 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('Hello from the background script!')
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.content_logo {
2+
width: 72px;
3+
background: #c9c9c9;
4+
border-radius: 6px;
5+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import './styles.css'
2+
import styles from './Logo.module.css'
3+
import logo from '../images/logo.png'
4+
5+
console.log('hello from content_scripts')
6+
7+
document.body.innerHTML += `
8+
<div class="content_script">
9+
<img class=${styles.content_logo} src="${logo}" />
10+
<h1 class="content_title">
11+
Welcome to your CSS Modules Extension
12+
</h1>
13+
<p class="content_description">
14+
Learn more about creating cross-browser extensions at <a
15+
className="underline hover:no-underline"
16+
href="https://extension.js.org"
17+
target="_blank"
18+
>
19+
https://extension.js.org
20+
</a>
21+
</p>
22+
</div>
23+
`
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.content_script {
2+
color: #c9c9c9;
3+
background-color: #0a0c10;
4+
position: fixed;
5+
right: 0;
6+
bottom: 0;
7+
z-index: 9;
8+
width: 315px;
9+
margin: 1rem;
10+
padding: 2rem 1rem;
11+
display: flex;
12+
flex-direction: column;
13+
gap: 1em;
14+
border-radius: 6px;
15+
}
16+
17+
.content_title {
18+
font-size: 1.85em;
19+
line-height: 1.1;
20+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
21+
'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
22+
font-weight: 700;
23+
}
24+
25+
.content_description {
26+
font-size: small;
27+
}
28+
29+
.content_description a {
30+
text-decoration: none;
31+
border-bottom: 2px solid #c9c9c9;
32+
color: #e5e7eb;
33+
}
28.8 KB
Loading

0 commit comments

Comments
 (0)