-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vue):add newtab, and counter demo
- Loading branch information
Showing
45 changed files
with
762 additions
and
445 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/icons/logo.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Chrome Extension + Vue + JS + Vite</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="./src/devtools/index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/icons/logo.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Chrome Extension + Vue + JS + Vite</title> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="./src/newtab/index.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
console.info('chrome-ext template-vue-js background script') | ||
console.log('background is running') | ||
|
||
export {} | ||
chrome.runtime.onMessage.addListener((request) => { | ||
if (request.type === 'COUNT') { | ||
console.log('background has received a message from popup, and count is ', request?.count) | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.info('contentScript is running') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<script setup lang="js"> | ||
import { ref } from 'vue' | ||
const link = ref('https://github.com/guocaoyi/create-chrome-ext') | ||
</script> | ||
|
||
<template> | ||
<main> | ||
<h3>DevTools Page</h3> | ||
|
||
<a :href="link" target="_blank"> generated by create-chrome-ext </a> | ||
</main> | ||
</template> | ||
|
||
<style> | ||
:root { | ||
font-family: | ||
system-ui, | ||
-apple-system, | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
Roboto, | ||
Oxygen, | ||
Ubuntu, | ||
Cantarell, | ||
'Open Sans', | ||
'Helvetica Neue', | ||
sans-serif; | ||
color-scheme: light dark; | ||
background-color: #242424; | ||
} | ||
@media (prefers-color-scheme: light) { | ||
:root { | ||
background-color: #fafafa; | ||
} | ||
a:hover { | ||
color: #42b983; | ||
} | ||
} | ||
body { | ||
min-width: 20rem; | ||
} | ||
main { | ||
text-align: center; | ||
padding: 1em; | ||
margin: 0 auto; | ||
} | ||
h3 { | ||
color: #42b983; | ||
text-transform: uppercase; | ||
font-size: 1.5rem; | ||
font-weight: 200; | ||
line-height: 1.2rem; | ||
margin: 2rem auto; | ||
} | ||
a { | ||
font-size: 0.5rem; | ||
margin: 0.5rem; | ||
color: #cccccc; | ||
text-decoration: none; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
export {} | ||
import { createApp } from 'vue' | ||
import App from './DevTools.vue' | ||
|
||
chrome.devtools.panels.create('Create Chrome Ext', '', '../../devtools.html', function () { | ||
console.log('devtools panel create') | ||
}) | ||
|
||
createApp(App).mount('#app') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,93 @@ | ||
<script setup> | ||
import { ref } from 'vue' | ||
<script setup lang="js"> | ||
import { ref, onMounted, onUnmounted } from 'vue' | ||
const crx = ref('create-chrome-ext') | ||
</script> | ||
const link = ref('https://github.com/guocaoyi/create-chrome-ext') | ||
<template> | ||
<main> | ||
<h3>Options Page!</h3> | ||
const getTime = () => { | ||
const date = new Date() | ||
const hour = String(date.getHours()).padStart(2, '0') | ||
const minute = String(date.getMinutes()).padStart(2, '0') | ||
return `${hour}:${minute}` | ||
} | ||
<h6>v 0.0.0</h6> | ||
let time = ref(getTime()) | ||
let intervalor = null | ||
onMounted(() => { | ||
intervalor = setInterval(() => { | ||
time.value = getTime() | ||
}, 1000) | ||
}) | ||
onUnmounted(() => { | ||
clearInterval(intervalor) | ||
}) | ||
</script> | ||
|
||
<a href="https://www.npmjs.com/package/create-chrome-ext" target="_blank">Power by {{ crx }}</a> | ||
</main> | ||
<template> | ||
<section> | ||
<span></span> | ||
<h1>{{ time }}</h1> | ||
<a :href="link" target="_blank"> generated by create-chrome-ext </a> | ||
</section> | ||
</template> | ||
|
||
<style> | ||
main { | ||
text-align: center; | ||
padding: 1em; | ||
margin: 0 auto; | ||
:root { | ||
font-family: | ||
system-ui, | ||
-apple-system, | ||
BlinkMacSystemFont, | ||
'Segoe UI', | ||
Roboto, | ||
Oxygen, | ||
Ubuntu, | ||
Cantarell, | ||
'Open Sans', | ||
'Helvetica Neue', | ||
sans-serif; | ||
color-scheme: light dark; | ||
box-sizing: border-box; | ||
} | ||
h3 { | ||
body { | ||
min-width: 20rem; | ||
margin: 0; | ||
} | ||
section::before { | ||
content: ''; | ||
position: fixed; | ||
z-index: -1; | ||
width: 100vw; | ||
height: 100vh; | ||
background-image: url('https://source.unsplash.com/random'); | ||
background-size: cover; | ||
filter: blur(10px); | ||
} | ||
section { | ||
width: 100vw; | ||
height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
align-items: center; | ||
} | ||
h1 { | ||
color: #42b983; | ||
text-transform: uppercase; | ||
font-size: 1.5rem; | ||
font-weight: 200; | ||
line-height: 1.2rem; | ||
font-size: 6rem; | ||
margin: 2rem auto; | ||
} | ||
h6 { | ||
font-size: 0.5rem; | ||
color: #333333; | ||
margin: 0.5rem; | ||
} | ||
a { | ||
font-size: 0.5rem; | ||
margin: 0.5rem; | ||
color: #cccccc; | ||
text-decoration: none; | ||
} | ||
@media (min-width: 480px) { | ||
h3 { | ||
max-width: none; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { createApp } from 'vue' | ||
import './style.css' | ||
import App from './NewTab.vue' | ||
|
||
createApp(App).mount('#app') |
Oops, something went wrong.