extension-create 2.0.0-alpha.4 → 2.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action/README.md +37 -0
- package/dist/action/action/index.html +40 -0
- package/dist/action/action/scripts.js +11 -0
- package/dist/action/action/styles.css +23 -0
- package/dist/action/images/extension_128.png +0 -0
- package/dist/action/images/extension_16.png +0 -0
- package/dist/action/images/extension_48.png +0 -0
- package/dist/action/manifest.json +21 -0
- package/dist/action/package.json +21 -0
- package/dist/action-chatgpt/.env.example +1 -0
- package/dist/action-chatgpt/README.md +37 -0
- package/dist/action-chatgpt/action/ActionApp.tsx +118 -0
- package/dist/action-chatgpt/action/index.html +13 -0
- package/dist/action-chatgpt/action/scripts.tsx +12 -0
- package/dist/action-chatgpt/action/styles.css +8 -0
- package/dist/action-chatgpt/extension-env.d.ts +9 -0
- package/dist/action-chatgpt/images/chatgpt.png +0 -0
- package/dist/action-chatgpt/images/extension.png +0 -0
- package/dist/action-chatgpt/images/extension_128.png +0 -0
- package/dist/action-chatgpt/images/extension_16.png +0 -0
- package/dist/action-chatgpt/images/extension_48.png +0 -0
- package/dist/action-chatgpt/manifest.json +21 -0
- package/dist/action-chatgpt/package.json +30 -0
- package/dist/action-chatgpt/postcss.config.js +6 -0
- package/dist/action-chatgpt/tailwind.config.js +8 -0
- package/dist/action-chatgpt/tsconfig.json +21 -0
- package/dist/config-stylelint/README.md +37 -0
- package/dist/config-stylelint/images/extension_128.png +0 -0
- package/dist/config-stylelint/images/extension_16.png +0 -0
- package/dist/config-stylelint/images/extension_48.png +0 -0
- package/dist/config-stylelint/images/stylelint.svg +1 -0
- package/dist/config-stylelint/manifest.json +15 -0
- package/dist/config-stylelint/newtab/index.html +40 -0
- package/dist/config-stylelint/newtab/scripts.js +11 -0
- package/dist/config-stylelint/newtab/styles.css +20 -0
- package/dist/config-stylelint/package.json +23 -0
- package/dist/config-stylelint/stylelint.config.json +1 -0
- package/dist/content/README.md +37 -0
- package/dist/content/background.js +21 -0
- package/dist/content/content/scripts.js +32 -0
- package/dist/content/content/styles.css +54 -0
- package/dist/content/images/extension_128.png +0 -0
- package/dist/content/images/extension_16.png +0 -0
- package/dist/content/images/extension_48.png +0 -0
- package/dist/content/manifest.json +35 -0
- package/dist/content/package.json +20 -0
- package/dist/content-css-module/README.md +37 -0
- package/dist/content-css-module/background.js +21 -0
- package/dist/content-css-module/content/Logo.module.css +11 -0
- package/dist/content-css-module/content/scripts.js +33 -0
- package/dist/content-css-module/content/styles.css +40 -0
- package/dist/content-css-module/images/extension_128.png +0 -0
- package/dist/content-css-module/images/extension_16.png +0 -0
- package/dist/content-css-module/images/extension_48.png +0 -0
- package/dist/content-css-module/manifest.json +35 -0
- package/dist/content-css-module/package.json +20 -0
- package/dist/content-less/README.md +37 -0
- package/dist/content-less/background.js +21 -0
- package/dist/content-less/content/scripts.js +32 -0
- package/dist/content-less/content/styles.less +51 -0
- package/dist/content-less/images/extension_128.png +0 -0
- package/dist/content-less/images/extension_16.png +0 -0
- package/dist/content-less/images/extension_48.png +0 -0
- package/dist/content-less/manifest.json +35 -0
- package/dist/content-less/package.json +21 -0
- package/dist/content-main-world/README.md +37 -0
- package/dist/content-main-world/background.js +19 -0
- package/dist/content-main-world/content/scripts.js +32 -0
- package/dist/content-main-world/content/styles.css +51 -0
- package/dist/content-main-world/images/extension_128.png +0 -0
- package/dist/content-main-world/images/extension_16.png +0 -0
- package/dist/content-main-world/images/extension_48.png +0 -0
- package/dist/content-main-world/manifest.json +37 -0
- package/dist/content-main-world/package.json +20 -0
- package/dist/content-preact/README.md +37 -0
- package/dist/content-preact/background.ts +1 -0
- package/dist/content-preact/content/ContentApp.tsx +92 -0
- package/dist/content-preact/content/scripts.tsx +14 -0
- package/dist/content-preact/content/styles.css +10 -0
- package/dist/content-preact/extension-env.d.ts +9 -0
- package/dist/content-preact/images/chromeWindow.png +0 -0
- package/dist/content-preact/images/extension_128.png +0 -0
- package/dist/content-preact/images/extension_16.png +0 -0
- package/dist/content-preact/images/extension_48.png +0 -0
- package/dist/content-preact/images/preact.png +0 -0
- package/dist/content-preact/images/tailwind.png +0 -0
- package/dist/content-preact/images/tailwind_bg.png +0 -0
- package/dist/content-preact/images/typescript.png +0 -0
- package/dist/content-preact/manifest.json +31 -0
- package/dist/content-preact/package.json +27 -0
- package/dist/content-preact/postcss.config.js +6 -0
- package/dist/content-preact/tailwind.config.js +8 -0
- package/dist/content-preact/tsconfig.json +26 -0
- package/dist/content-react/README.md +37 -0
- package/dist/content-react/background.ts +1 -0
- package/dist/content-react/content/ContentApp.tsx +86 -0
- package/dist/content-react/content/scripts.tsx +17 -0
- package/dist/content-react/content/styles.css +10 -0
- package/dist/content-react/extension-env.d.ts +9 -0
- package/dist/content-react/images/chromeWindow.png +0 -0
- package/dist/content-react/images/extension_128.png +0 -0
- package/dist/content-react/images/extension_16.png +0 -0
- package/dist/content-react/images/extension_48.png +0 -0
- package/dist/content-react/images/react.png +0 -0
- package/dist/content-react/images/tailwind.png +0 -0
- package/dist/content-react/images/tailwind_bg.png +0 -0
- package/dist/content-react/images/typescript.png +0 -0
- package/dist/content-react/manifest.json +28 -0
- package/dist/content-react/package.json +28 -0
- package/dist/content-react/postcss.config.js +6 -0
- package/dist/content-react/tailwind.config.js +8 -0
- package/dist/content-react/tsconfig.json +21 -0
- package/dist/content-sass/README.md +37 -0
- package/dist/content-sass/background.js +21 -0
- package/dist/content-sass/content/scripts.js +32 -0
- package/dist/content-sass/content/styles.scss +51 -0
- package/dist/content-sass/images/extension_128.png +0 -0
- package/dist/content-sass/images/extension_16.png +0 -0
- package/dist/content-sass/images/extension_48.png +0 -0
- package/dist/content-sass/manifest.json +35 -0
- package/dist/content-sass/package.json +21 -0
- package/dist/content-sass-module/README.md +37 -0
- package/dist/content-sass-module/background.js +21 -0
- package/dist/content-sass-module/content/Logo.module.scss +18 -0
- package/dist/content-sass-module/content/scripts.js +33 -0
- package/dist/content-sass-module/content/styles.scss +40 -0
- package/dist/content-sass-module/images/extension_128.png +0 -0
- package/dist/content-sass-module/images/extension_16.png +0 -0
- package/dist/content-sass-module/images/extension_48.png +0 -0
- package/dist/content-sass-module/manifest.json +35 -0
- package/dist/content-sass-module/package.json +21 -0
- package/dist/content-tailwind/README.md +37 -0
- package/dist/content-tailwind/background.js +21 -0
- package/dist/content-tailwind/content/content.js +45 -0
- package/dist/content-tailwind/content/scripts.js +6 -0
- package/dist/content-tailwind/content/styles.css +10 -0
- package/dist/content-tailwind/images/chromeWindow.png +0 -0
- package/dist/content-tailwind/images/extension_128.png +0 -0
- package/dist/content-tailwind/images/extension_16.png +0 -0
- package/dist/content-tailwind/images/extension_48.png +0 -0
- package/dist/content-tailwind/images/react.png +0 -0
- package/dist/content-tailwind/images/tailwind.png +0 -0
- package/dist/content-tailwind/images/tailwind_bg.png +0 -0
- package/dist/content-tailwind/manifest.json +35 -0
- package/dist/content-tailwind/package.json +23 -0
- package/dist/content-tailwind/postcss.config.js +6 -0
- package/dist/content-tailwind/tailwind.config.js +8 -0
- package/dist/content-typescript/README.md +37 -0
- package/dist/content-typescript/background.ts +26 -0
- package/dist/content-typescript/content/scripts.ts +33 -0
- package/dist/content-typescript/content/styles.css +51 -0
- package/dist/content-typescript/extension-env.d.ts +9 -0
- package/dist/content-typescript/images/extension_128.png +0 -0
- package/dist/content-typescript/images/extension_16.png +0 -0
- package/dist/content-typescript/images/extension_48.png +0 -0
- package/dist/content-typescript/images/typescript.png +0 -0
- package/dist/content-typescript/manifest.json +35 -0
- package/dist/content-typescript/package.json +21 -0
- package/dist/content-typescript/tsconfig.json +21 -0
- package/dist/content-vue/README.md +37 -0
- package/dist/content-vue/background.ts +1 -0
- package/dist/content-vue/content/ContentApp.vue +90 -0
- package/dist/content-vue/content/scripts.ts +13 -0
- package/dist/content-vue/content/shims-vue.d.ts +6 -0
- package/dist/content-vue/content/styles.css +10 -0
- package/dist/content-vue/extension-env.d.ts +9 -0
- package/dist/content-vue/images/chromeWindow.png +0 -0
- package/dist/content-vue/images/extension_128.png +0 -0
- package/dist/content-vue/images/extension_16.png +0 -0
- package/dist/content-vue/images/extension_48.png +0 -0
- package/dist/content-vue/images/tailwind.png +0 -0
- package/dist/content-vue/images/tailwind_bg.png +0 -0
- package/dist/content-vue/images/typescript.png +0 -0
- package/dist/content-vue/images/vue.svg +8 -0
- package/dist/content-vue/manifest.json +31 -0
- package/dist/content-vue/package.json +25 -0
- package/dist/content-vue/postcss.config.js +6 -0
- package/dist/content-vue/tailwind.config.js +8 -0
- package/dist/content-vue/tsconfig.json +21 -0
- package/dist/declarative_net_request/README.md +37 -0
- package/dist/declarative_net_request/images/extension_128.png +0 -0
- package/dist/declarative_net_request/images/extension_16.png +0 -0
- package/dist/declarative_net_request/images/extension_48.png +0 -0
- package/dist/declarative_net_request/manifest.json +34 -0
- package/dist/declarative_net_request/package.json +21 -0
- package/dist/declarative_net_request/public/public_ruleset.json +72 -0
- package/dist/declarative_net_request/rules_1.json +72 -0
- package/dist/init/README.md +37 -0
- package/dist/init/manifest.json +7 -0
- package/dist/init/package.json +32 -0
- package/dist/locales/README.md +37 -0
- package/dist/locales/_locales/en/messages.json +10 -0
- package/dist/locales/_locales/pt_BR/messages.json +10 -0
- package/dist/locales/action/index.html +40 -0
- package/dist/locales/action/scripts.js +3 -0
- package/dist/locales/action/styles.css +23 -0
- package/dist/locales/images/extension_128.png +0 -0
- package/dist/locales/images/extension_16.png +0 -0
- package/dist/locales/images/extension_48.png +0 -0
- package/dist/locales/manifest.json +19 -0
- package/dist/locales/package.json +21 -0
- package/dist/module.js +11 -11
- package/dist/new-less/README.md +37 -0
- package/dist/new-less/images/extension_128.png +0 -0
- package/dist/new-less/images/extension_16.png +0 -0
- package/dist/new-less/images/extension_48.png +0 -0
- package/dist/new-less/manifest.json +15 -0
- package/dist/new-less/newtab/index.html +40 -0
- package/dist/new-less/newtab/scripts.js +11 -0
- package/dist/new-less/newtab/styles.less +19 -0
- package/dist/new-less/package.json +21 -0
- package/dist/new-preact/README.md +37 -0
- package/dist/new-preact/extension-env.d.ts +9 -0
- package/dist/new-preact/images/extension_128.png +0 -0
- package/dist/new-preact/images/extension_16.png +0 -0
- package/dist/new-preact/images/extension_48.png +0 -0
- package/dist/new-preact/images/preact.png +0 -0
- package/dist/new-preact/manifest.json +15 -0
- package/dist/new-preact/newtab/NewTabApp.tsx +27 -0
- package/dist/new-preact/newtab/index.html +13 -0
- package/dist/new-preact/newtab/scripts.tsx +5 -0
- package/dist/new-preact/newtab/styles.css +32 -0
- package/dist/new-preact/package.json +27 -0
- package/dist/new-preact/tsconfig.json +21 -0
- package/dist/new-react/README.md +37 -0
- package/dist/new-react/extension-env.d.ts +9 -0
- package/dist/new-react/images/extension_128.png +0 -0
- package/dist/new-react/images/extension_16.png +0 -0
- package/dist/new-react/images/extension_48.png +0 -0
- package/dist/new-react/images/react.png +0 -0
- package/dist/new-react/manifest.json +15 -0
- package/dist/new-react/newtab/NewTabApp.tsx +27 -0
- package/dist/new-react/newtab/index.html +13 -0
- package/dist/new-react/newtab/scripts.tsx +12 -0
- package/dist/new-react/newtab/styles.css +23 -0
- package/dist/new-react/package.json +28 -0
- package/dist/new-react/tsconfig.json +21 -0
- package/dist/new-sass/README.md +37 -0
- package/dist/new-sass/images/extension_128.png +0 -0
- package/dist/new-sass/images/extension_16.png +0 -0
- package/dist/new-sass/images/extension_48.png +0 -0
- package/dist/new-sass/manifest.json +15 -0
- package/dist/new-sass/newtab/index.html +40 -0
- package/dist/new-sass/newtab/scripts.js +11 -0
- package/dist/new-sass/newtab/styles.scss +19 -0
- package/dist/new-sass/package.json +22 -0
- package/dist/new-tailwind/README.md +37 -0
- package/dist/new-tailwind/extension-env.d.ts +9 -0
- package/dist/new-tailwind/images/chromeWindow.png +0 -0
- package/dist/new-tailwind/images/extension_128.png +0 -0
- package/dist/new-tailwind/images/extension_16.png +0 -0
- package/dist/new-tailwind/images/extension_48.png +0 -0
- package/dist/new-tailwind/images/react.png +0 -0
- package/dist/new-tailwind/images/tailwind.png +0 -0
- package/dist/new-tailwind/images/tailwind_bg.png +0 -0
- package/dist/new-tailwind/manifest.json +15 -0
- package/dist/new-tailwind/newtab/NewTabApp.tsx +67 -0
- package/dist/new-tailwind/newtab/index.html +13 -0
- package/dist/new-tailwind/newtab/scripts.tsx +12 -0
- package/dist/new-tailwind/newtab/styles.css +3 -0
- package/dist/new-tailwind/package.json +28 -0
- package/dist/new-tailwind/postcss.config.js +6 -0
- package/dist/new-tailwind/tailwind.config.js +8 -0
- package/dist/new-tailwind/tsconfig.json +21 -0
- package/dist/new-typescript/README.md +37 -0
- package/dist/new-typescript/extension-env.d.ts +9 -0
- package/dist/new-typescript/images/extension_128.png +0 -0
- package/dist/new-typescript/images/extension_16.png +0 -0
- package/dist/new-typescript/images/extension_48.png +0 -0
- package/dist/new-typescript/images/typescript.png +0 -0
- package/dist/new-typescript/manifest.json +15 -0
- package/dist/new-typescript/newtab/index.html +25 -0
- package/dist/new-typescript/newtab/scripts.ts +10 -0
- package/dist/new-typescript/newtab/styles.css +18 -0
- package/dist/new-typescript/package.json +22 -0
- package/dist/new-typescript/tsconfig.json +21 -0
- package/dist/new-vue/README.md +37 -0
- package/dist/new-vue/extension-env.d.ts +9 -0
- package/dist/new-vue/images/extension_128.png +0 -0
- package/dist/new-vue/images/extension_16.png +0 -0
- package/dist/new-vue/images/extension_48.png +0 -0
- package/dist/new-vue/images/vue.svg +8 -0
- package/dist/new-vue/manifest.json +15 -0
- package/dist/new-vue/newtab/NewTabApp.vue +30 -0
- package/dist/new-vue/newtab/index.html +13 -0
- package/dist/new-vue/newtab/scripts.ts +7 -0
- package/dist/new-vue/newtab/styles.css +36 -0
- package/dist/new-vue/package.json +25 -0
- package/dist/new-vue/tsconfig.json +21 -0
- package/dist/sidebar/README.md +37 -0
- package/dist/sidebar/images/extension_128.png +0 -0
- package/dist/sidebar/images/extension_16.png +0 -0
- package/dist/sidebar/images/extension_48.png +0 -0
- package/dist/sidebar/manifest.json +25 -0
- package/dist/sidebar/package.json +21 -0
- package/dist/sidebar/puzzle.png +0 -0
- package/dist/sidebar/sidebar/index.html +39 -0
- package/dist/sidebar/sidebar/scripts.js +11 -0
- package/dist/sidebar/sidebar/styles.css +27 -0
- package/dist/sidebar/test_16.png +0 -0
- package/dist/sidebar/test_32.png +0 -0
- package/dist/sidebar/test_48.png +0 -0
- package/dist/sidebar/test_64.png +0 -0
- package/dist/special-folders-pages/README.md +37 -0
- package/dist/special-folders-pages/background.js +5 -0
- package/dist/special-folders-pages/images/extension_128.png +0 -0
- package/dist/special-folders-pages/images/extension_16.png +0 -0
- package/dist/special-folders-pages/images/extension_48.png +0 -0
- package/dist/special-folders-pages/images/notpublic-file.png +0 -0
- package/dist/special-folders-pages/manifest.json +26 -0
- package/dist/special-folders-pages/package.json +21 -0
- package/dist/special-folders-pages/pages/custom.html +8 -0
- package/dist/special-folders-pages/pages/main.css +18 -0
- package/dist/special-folders-pages/pages/main.html +16 -0
- package/dist/special-folders-pages/pages/main.js +1 -0
- package/dist/special-folders-pages/public/css/file.css +3 -0
- package/dist/special-folders-pages/public/html/file.html +8 -0
- package/dist/special-folders-pages/public/img/icon.png +0 -0
- package/dist/special-folders-pages/public/js/file.js +0 -0
- package/dist/special-folders-pages/sandbox/index.html +24 -0
- package/dist/special-folders-pages/sandbox/scripts.js +0 -0
- package/dist/special-folders-pages/sandbox/styles.css +1 -0
- package/dist/special-folders-scripts/README.md +37 -0
- package/dist/special-folders-scripts/background.js +24 -0
- package/dist/special-folders-scripts/images/extension_128.png +0 -0
- package/dist/special-folders-scripts/images/extension_16.png +0 -0
- package/dist/special-folders-scripts/images/extension_48.png +0 -0
- package/dist/special-folders-scripts/manifest.json +27 -0
- package/dist/special-folders-scripts/package.json +21 -0
- package/dist/special-folders-scripts/pages/index.css +5 -0
- package/dist/special-folders-scripts/pages/index.html +3 -0
- package/dist/special-folders-scripts/pages/index.js +1 -0
- package/dist/special-folders-scripts/public/extension.png +0 -0
- package/dist/special-folders-scripts/scripts/content-script.js +3 -0
- package/dist/storage/README.md +37 -0
- package/dist/storage/images/extension_128.png +0 -0
- package/dist/storage/images/extension_16.png +0 -0
- package/dist/storage/images/extension_48.png +0 -0
- package/dist/storage/manifest.json +15 -0
- package/dist/storage/package.json +21 -0
- package/dist/storage/schema.json +44 -0
- package/package.json +2 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
chrome.runtime.onMessage.addListener((request, sender) => {
|
|
2
|
+
if (request.action === 'changeBackgroundColor') {
|
|
3
|
+
changeBackgroundColor(request.color, sender.tab.id)
|
|
4
|
+
}
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
function changeBackgroundColor(color, tabId) {
|
|
8
|
+
chrome.scripting
|
|
9
|
+
.executeScript({
|
|
10
|
+
target: {tabId},
|
|
11
|
+
function: setPageBackgroundColor,
|
|
12
|
+
args: [color]
|
|
13
|
+
})
|
|
14
|
+
.catch(console.error)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function setPageBackgroundColor(color) {
|
|
18
|
+
document.body.style.backgroundColor = color
|
|
19
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import extensionJsLogo from '../images/extension_128.png'
|
|
2
|
+
import './styles.css'
|
|
3
|
+
|
|
4
|
+
console.log('hello from content_scripts')
|
|
5
|
+
|
|
6
|
+
document.body.innerHTML += `
|
|
7
|
+
<div class="content_script-box">
|
|
8
|
+
<img class="content_script-logo" src=${extensionJsLogo} />
|
|
9
|
+
<h1 class="content_script-title">
|
|
10
|
+
Change the background-color ⬇
|
|
11
|
+
</h1>
|
|
12
|
+
<input type="color" class="content_script-colorPicker" id="colorPicker">
|
|
13
|
+
<p class="content_script-description">
|
|
14
|
+
Learn more about creating 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
|
+
`
|
|
24
|
+
|
|
25
|
+
document.getElementById('colorPicker').addEventListener('input', (event) => {
|
|
26
|
+
chrome.runtime
|
|
27
|
+
.sendMessage({
|
|
28
|
+
action: 'changeBackgroundColor',
|
|
29
|
+
color: event.target.value
|
|
30
|
+
})
|
|
31
|
+
.catch(console.error)
|
|
32
|
+
})
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
.content_script-box {
|
|
2
|
+
background: white;
|
|
3
|
+
position: fixed;
|
|
4
|
+
right: 0;
|
|
5
|
+
bottom: 0;
|
|
6
|
+
z-index: 9;
|
|
7
|
+
width: 315px;
|
|
8
|
+
height: 345px;
|
|
9
|
+
margin: 1em;
|
|
10
|
+
padding: 1em;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
justify-content: center;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 1em;
|
|
16
|
+
box-shadow: 0px 0px 4px 1px #ccc;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.content_script-logo {
|
|
20
|
+
width: 90px;
|
|
21
|
+
align-self: flex-start;
|
|
22
|
+
filter: grayscale(1);
|
|
23
|
+
transition: filter 2s;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.content_script-logo:hover {
|
|
27
|
+
filter: grayscale(0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.content_script-title {
|
|
31
|
+
font-size: 1.85em;
|
|
32
|
+
color: #333;
|
|
33
|
+
line-height: 1.1;
|
|
34
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
35
|
+
'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
|
|
36
|
+
font-weight: 700;
|
|
37
|
+
overflow-wrap: break-word;
|
|
38
|
+
word-wrap: break-word;
|
|
39
|
+
-ms-word-break: break-all;
|
|
40
|
+
word-break: break-word;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.content_script-description {
|
|
44
|
+
color: #999;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.content_script-colorPicker {
|
|
48
|
+
display: block;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 50px;
|
|
51
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"name": "content-main-world",
|
|
5
|
+
"id": "phfmcihmgbbaemimookenmjjkoicadnb",
|
|
6
|
+
"description": "An Extension.js example.",
|
|
7
|
+
"icons": {
|
|
8
|
+
"16": "images/extension_16.png",
|
|
9
|
+
"48": "images/extension_48.png",
|
|
10
|
+
"128": "images/extension_128.png"
|
|
11
|
+
},
|
|
12
|
+
"permissions": [
|
|
13
|
+
"activeTab",
|
|
14
|
+
"scripting"
|
|
15
|
+
],
|
|
16
|
+
"host_permissions": [
|
|
17
|
+
"<all_urls>"
|
|
18
|
+
],
|
|
19
|
+
"background": {
|
|
20
|
+
"chromium:service_worker": "background.js",
|
|
21
|
+
"firefox:scripts": [
|
|
22
|
+
"background.js"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"content_scripts": [
|
|
26
|
+
{
|
|
27
|
+
"world": "MAIN",
|
|
28
|
+
"matches": [
|
|
29
|
+
"<all_urls>"
|
|
30
|
+
],
|
|
31
|
+
"js": [
|
|
32
|
+
"content/scripts.js"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"author": "Your Name"
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"name": "content-main-world",
|
|
4
|
+
"description": "An Extension.js example.",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Your Name",
|
|
8
|
+
"email": "your@email.com",
|
|
9
|
+
"url": "https://yourwebsite.com"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"dev": "extension dev",
|
|
13
|
+
"start": "extension start",
|
|
14
|
+
"build": "extension build"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"extension": "latest"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# content-preact
|
|
2
|
+
|
|
3
|
+
> An Extension.js example.
|
|
4
|
+
|
|
5
|
+
## Scripts Available
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### yarn dev
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
// Runs the app in the development mode.
|
|
13
|
+
// Will open a new browser instance with your extension loaded.
|
|
14
|
+
// The page will reload when you make changes.
|
|
15
|
+
yarn dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### yarn start
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
// Runs the app in the production mode.
|
|
22
|
+
// Will open a new browser instance with your extension loaded.
|
|
23
|
+
// This is how your browser extension will work once published.
|
|
24
|
+
yarn start
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### yarn build
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
// Builds the app for production.
|
|
31
|
+
// Bundles your browser extension in production mode for the target browser.
|
|
32
|
+
yarn build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Learn More
|
|
36
|
+
|
|
37
|
+
Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Hello from the background script!')
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {useSignal} from '@preact/signals'
|
|
2
|
+
|
|
3
|
+
import preactLogo from '../images/preact.png'
|
|
4
|
+
import tailwindBg from '../images/tailwind_bg.png'
|
|
5
|
+
import typescriptLogo from '../images/typescript.png'
|
|
6
|
+
import tailwindLogo from '../images/tailwind.png'
|
|
7
|
+
import chromeWindowBg from '../images/chromeWindow.png'
|
|
8
|
+
|
|
9
|
+
export default function ContentApp() {
|
|
10
|
+
const isdialogOpen = useSignal(true)
|
|
11
|
+
|
|
12
|
+
const setIsDialogOpen = (bool: boolean) => {
|
|
13
|
+
isdialogOpen.value = bool
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (!isdialogOpen.value) {
|
|
17
|
+
return (
|
|
18
|
+
<div className="mx-auto p-6">
|
|
19
|
+
<button
|
|
20
|
+
onClick={() => setIsDialogOpen(true)}
|
|
21
|
+
className="bg-white rounded-md p-3 text-sm font-semibold text-gray-900 shadow-sm hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
|
|
22
|
+
>
|
|
23
|
+
🧩 Open content script hint <span aria-hidden="true">+</span>
|
|
24
|
+
</button>
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<div className="mx-auto max-w-7xl md:px-0 lg:p-6">
|
|
31
|
+
<div className="relative isolate overflow-hidden bg-gray-900 px-6 pt-16 shadow-2xl lg:rounded-3xl md:pt-24 md:h-full sm:h-[100vh] lg:flex lg:gap-x-20 lg:px-24 lg:pt-0">
|
|
32
|
+
<div className="absolute z-20 top-0 inset-x-0 flex justify-center overflow-hidden pointer-events-none">
|
|
33
|
+
<div className="w-[108rem] flex-none flex justify-end">
|
|
34
|
+
<picture>
|
|
35
|
+
<img
|
|
36
|
+
src={tailwindBg}
|
|
37
|
+
alt=""
|
|
38
|
+
className="w-[90rem] flex-none max-w-none hidden dark:block"
|
|
39
|
+
decoding="async"
|
|
40
|
+
/>
|
|
41
|
+
</picture>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
<div className="mx-auto max-w-md text-center lg:py-12 lg:mx-0 lg:flex-auto lg:text-left">
|
|
45
|
+
<div className="flex items-center justify-center space-x-4 my-4 mx-auto">
|
|
46
|
+
<img
|
|
47
|
+
alt="Preact logo"
|
|
48
|
+
src={preactLogo}
|
|
49
|
+
className="relative inline-block w-12"
|
|
50
|
+
/>
|
|
51
|
+
<div className="text-3xl text-white">+</div>
|
|
52
|
+
<img
|
|
53
|
+
alt="TypeScript logo"
|
|
54
|
+
src={typescriptLogo}
|
|
55
|
+
className="relative inline-block w-12"
|
|
56
|
+
/>
|
|
57
|
+
<div className="text-3xl text-white">+</div>
|
|
58
|
+
<img
|
|
59
|
+
alt="Tailwind logo"
|
|
60
|
+
src={tailwindLogo}
|
|
61
|
+
className="relative inline-block w-12"
|
|
62
|
+
/>
|
|
63
|
+
</div>
|
|
64
|
+
<h2 className="text-3xl font-bold tracking-tight text-white sm:text-4xl">
|
|
65
|
+
This is a content script running Preact, TypeScript, and
|
|
66
|
+
Tailwind.css.
|
|
67
|
+
</h2>
|
|
68
|
+
<p className="mt-6 text-lg leading-8 text-gray-300">
|
|
69
|
+
Learn more about creating cross-browser extensions by{' '}
|
|
70
|
+
<button
|
|
71
|
+
onClick={() => setIsDialogOpen(false)}
|
|
72
|
+
className="underline hover:no-underline
|
|
73
|
+
"
|
|
74
|
+
>
|
|
75
|
+
closing this hint
|
|
76
|
+
</button>
|
|
77
|
+
.
|
|
78
|
+
</p>
|
|
79
|
+
</div>
|
|
80
|
+
<div className="relative mt-16 h-80 lg:mt-8">
|
|
81
|
+
<img
|
|
82
|
+
className="absolute left-0 top-0 w-[57rem] max-w-none rounded-md bg-white/5 ring-1 ring-white/10"
|
|
83
|
+
src={chromeWindowBg}
|
|
84
|
+
alt="Chrome window screenshot"
|
|
85
|
+
width="1824"
|
|
86
|
+
height="1080"
|
|
87
|
+
/>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {render} from 'preact'
|
|
2
|
+
import ContentApp from './ContentApp'
|
|
3
|
+
import './styles.css'
|
|
4
|
+
|
|
5
|
+
setTimeout(initial, 1000)
|
|
6
|
+
|
|
7
|
+
function initial() {
|
|
8
|
+
// Create a new div element and append it to the document's body
|
|
9
|
+
const rootDiv = document.createElement('div')
|
|
10
|
+
rootDiv.id = 'extension-root'
|
|
11
|
+
document.body.appendChild(rootDiv)
|
|
12
|
+
|
|
13
|
+
render(<ContentApp />, rootDiv)
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Required Extension.js types for TypeScript projects.
|
|
2
|
+
// This file is auto-generated and should not be excluded.
|
|
3
|
+
// If you need extra types, consider creating a new *.d.ts and
|
|
4
|
+
// referencing it in the "include" array of your tsconfig.json file.
|
|
5
|
+
// See https://www.typescriptlang.org/tsconfig#include for info.
|
|
6
|
+
/// <reference types="../../programs/develop/types/index.d.ts" />
|
|
7
|
+
|
|
8
|
+
// Polyfill types for browser.* APIs.
|
|
9
|
+
/// <reference types="../../programs/develop/types/polyfill.d.ts" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 3,
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"name": "content-preact",
|
|
5
|
+
"description": "An Extension.js example.",
|
|
6
|
+
"icons": {
|
|
7
|
+
"16": "images/extension_16.png",
|
|
8
|
+
"48": "images/extension_48.png",
|
|
9
|
+
"128": "images/extension_128.png"
|
|
10
|
+
},
|
|
11
|
+
"background": {
|
|
12
|
+
"chromium:service_worker": "background.ts",
|
|
13
|
+
"firefox:scripts": [
|
|
14
|
+
"background.ts"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
"content_scripts": [
|
|
18
|
+
{
|
|
19
|
+
"matches": [
|
|
20
|
+
"https://extension.js.org/*"
|
|
21
|
+
],
|
|
22
|
+
"js": [
|
|
23
|
+
"./content/scripts.tsx"
|
|
24
|
+
],
|
|
25
|
+
"css": [
|
|
26
|
+
"./content/styles.css"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"author": "Your Name"
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"private": true,
|
|
3
|
+
"name": "content-preact",
|
|
4
|
+
"description": "An Extension.js example.",
|
|
5
|
+
"version": "0.0.1",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Your Name",
|
|
8
|
+
"email": "your@email.com",
|
|
9
|
+
"url": "https://yourwebsite.com"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@preact/signals": "^1.2.3",
|
|
14
|
+
"preact": "^10.22.0",
|
|
15
|
+
"tailwindcss": "^3.4.1"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@babel/plugin-transform-react-jsx": "^7.25.2",
|
|
19
|
+
"typescript": "5.3.3",
|
|
20
|
+
"extension": "latest"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "extension dev",
|
|
24
|
+
"start": "extension start",
|
|
25
|
+
"build": "extension build"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"allowJs": true,
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"esModuleInterop": true,
|
|
6
|
+
"forceConsistentCasingInFileNames": true,
|
|
7
|
+
"isolatedModules": false,
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"module": "esnext",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"target": "esnext",
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"baseUrl": "./",
|
|
17
|
+
"paths": {
|
|
18
|
+
"react": ["./node_modules/preact/compat/"],
|
|
19
|
+
"react/jsx-runtime": ["./node_modules/preact/jsx-runtime"],
|
|
20
|
+
"react-dom": ["./node_modules/preact/compat/"],
|
|
21
|
+
"react-dom/*": ["./node_modules/preact/compat/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["./"],
|
|
25
|
+
"exclude": ["node_modules", "dist"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# content-react
|
|
2
|
+
|
|
3
|
+
> An Extension.js example.
|
|
4
|
+
|
|
5
|
+
## Scripts Available
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
### yarn dev
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
// Runs the app in the development mode.
|
|
13
|
+
// Will open a new browser instance with your extension loaded.
|
|
14
|
+
// The page will reload when you make changes.
|
|
15
|
+
yarn dev
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### yarn start
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
// Runs the app in the production mode.
|
|
22
|
+
// Will open a new browser instance with your extension loaded.
|
|
23
|
+
// This is how your browser extension will work once published.
|
|
24
|
+
yarn start
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### yarn build
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
// Builds the app for production.
|
|
31
|
+
// Bundles your browser extension in production mode for the target browser.
|
|
32
|
+
yarn build
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Learn More
|
|
36
|
+
|
|
37
|
+
Learn more about creating cross-browser extensions in the [Extension.js](https://extension.js.org) documentation.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
console.log('Hello from the background script!')
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import reactLogo from '../images/react.png'
|
|
3
|
+
import tailwindBg from '../images/tailwind_bg.png'
|
|
4
|
+
import typescriptLogo from '../images/typescript.png'
|
|
5
|
+
import tailwindLogo from '../images/tailwind.png'
|
|
6
|
+
import chromeWindowBg from '../images/chromeWindow.png'
|
|
7
|
+
|
|
8
|
+
export default function ContentApp() {
|
|
9
|
+
const [isdialogOpen, setIsDialogOpen] = React.useState(true)
|
|
10
|
+
|
|
11
|
+
if (!isdialogOpen) {
|
|
12
|
+
return (
|
|
13
|
+
<div className="mx-auto p-6">
|
|
14
|
+
<button
|
|
15
|
+
onClick={() => setIsDialogOpen(true)}
|
|
16
|
+
className="bg-white rounded-md p-3 text-sm font-semibold text-gray-900 shadow-sm hover:bg-gray-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-white"
|
|
17
|
+
>
|
|
18
|
+
🧩 Open content script hint <span aria-hidden="true">+</span>
|
|
19
|
+
</button>
|
|
20
|
+
</div>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<div className="mx-auto max-w-7xl md:px-0 lg:p-6">
|
|
26
|
+
<div className="relative isolate overflow-hidden bg-gray-900 px-6 pt-16 shadow-2xl lg:rounded-3xl md:pt-24 md:h-full sm:h-[100vh] lg:flex lg:gap-x-20 lg:px-24 lg:pt-0">
|
|
27
|
+
<div className="absolute z-20 top-0 inset-x-0 flex justify-center overflow-hidden pointer-events-none">
|
|
28
|
+
<div className="w-[108rem] flex-none flex justify-end">
|
|
29
|
+
<picture>
|
|
30
|
+
<img
|
|
31
|
+
src={tailwindBg}
|
|
32
|
+
alt=""
|
|
33
|
+
className="w-[90rem] flex-none max-w-none hidden dark:block"
|
|
34
|
+
decoding="async"
|
|
35
|
+
/>
|
|
36
|
+
</picture>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
<div className="mx-auto max-w-md text-center lg:py-12 lg:mx-0 lg:flex-auto lg:text-left">
|
|
40
|
+
<div className="flex items-center justify-center space-x-4 my-4 mx-auto">
|
|
41
|
+
<img
|
|
42
|
+
alt="React logo"
|
|
43
|
+
src={reactLogo}
|
|
44
|
+
className="relative inline-block w-12"
|
|
45
|
+
/>
|
|
46
|
+
<div className="text-3xl text-white">+</div>
|
|
47
|
+
<img
|
|
48
|
+
alt="TypeScript logo"
|
|
49
|
+
src={typescriptLogo}
|
|
50
|
+
className="relative inline-block w-12"
|
|
51
|
+
/>
|
|
52
|
+
<div className="text-3xl text-white">+</div>
|
|
53
|
+
<img
|
|
54
|
+
alt="Tailwind logo"
|
|
55
|
+
src={tailwindLogo}
|
|
56
|
+
className="relative inline-block w-12"
|
|
57
|
+
/>
|
|
58
|
+
</div>
|
|
59
|
+
<h2 className="text-3xl font-bold tracking-tight text-white sm:text-4xl">
|
|
60
|
+
This is a content script running React, TypeScript, and Tailwind.css
|
|
61
|
+
</h2>
|
|
62
|
+
<p className="mt-6 text-lg leading-8 text-gray-300">
|
|
63
|
+
Learn more about creating cross-browser extensions by{' '}
|
|
64
|
+
<button
|
|
65
|
+
onClick={() => setIsDialogOpen(false)}
|
|
66
|
+
className="underline hover:no-underline
|
|
67
|
+
"
|
|
68
|
+
>
|
|
69
|
+
closing this hint
|
|
70
|
+
</button>
|
|
71
|
+
.
|
|
72
|
+
</p>
|
|
73
|
+
</div>
|
|
74
|
+
<div className="relative mt-16 h-80 lg:mt-8">
|
|
75
|
+
<img
|
|
76
|
+
className="absolute left-0 top-0 w-[57rem] max-w-none rounded-md bg-white/5 ring-1 ring-white/10"
|
|
77
|
+
src={chromeWindowBg}
|
|
78
|
+
alt="Chrome window screenshot"
|
|
79
|
+
width="1824"
|
|
80
|
+
height="1080"
|
|
81
|
+
/>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
</div>
|
|
85
|
+
)
|
|
86
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import ReactDOM from 'react-dom/client'
|
|
2
|
+
import ContentApp from './ContentApp'
|
|
3
|
+
import './styles.css'
|
|
4
|
+
|
|
5
|
+
setTimeout(initial, 1000)
|
|
6
|
+
|
|
7
|
+
function initial() {
|
|
8
|
+
// Create a new div element and append it to the document's body
|
|
9
|
+
const rootDiv = document.createElement('div')
|
|
10
|
+
rootDiv.id = 'extension-root'
|
|
11
|
+
document.body.appendChild(rootDiv)
|
|
12
|
+
|
|
13
|
+
// Use `createRoot` to create a root, then render the <App /> component
|
|
14
|
+
// Note that `createRoot` takes the container DOM node, not the React element
|
|
15
|
+
const root = ReactDOM.createRoot(rootDiv)
|
|
16
|
+
root.render(<ContentApp />)
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Required Extension.js types for TypeScript projects.
|
|
2
|
+
// This file is auto-generated and should not be excluded.
|
|
3
|
+
// If you need extra types, consider creating a new *.d.ts and
|
|
4
|
+
// referencing it in the "include" array of your tsconfig.json file.
|
|
5
|
+
// See https://www.typescriptlang.org/tsconfig#include for info.
|
|
6
|
+
/// <reference types="../../programs/develop/dist/types/index.d.ts" />
|
|
7
|
+
|
|
8
|
+
// Polyfill types for browser.* APIs.
|
|
9
|
+
/// <reference types="../../programs/develop/dist/types/polyfill.d.ts" />
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|