This commit is contained in:
cupcakearmy 2020-09-17 14:27:08 +02:00
parent ba497e2b7a
commit 2d0de4373c
No known key found for this signature in database
GPG Key ID: 81C683415BBD86B0
7 changed files with 7803 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.cache
dist
node_modules
yarn-error.log

2
borderify.js Normal file
View File

@ -0,0 +1,2 @@
document.body.style.border = '5px solid blue'
console.log('test')

BIN
icons/timer.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

21
manifest.json Normal file
View File

@ -0,0 +1,21 @@
{
"manifest_version": 2,
"name": "Borderify",
"version": "1.0",
"description": "Adds a red border to all webpages matching mozilla.org.",
"icons": {
"512": "icons/timer.png"
},
"permissions": ["<all_urls>", "tabs", "unlimitedStorage", "storage"],
"background": {
"scripts": ["./src/background/index.js"]
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["borderify.js"]
}
]
}

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"browserslist": [
"last 2 chrome versions",
"last 2 firefox versions"
],
"dependencies": {
"dexie": "^3.0.2",
"nedb": "^1.8.0",
"nedb-promises": "^4.0.4",
"webextension-polyfill": "^0.6.0"
},
"devDependencies": {
"@types/firefox-webext-browser": "^78.0.1",
"parcel-bundler": "^1.12.4",
"parcel-plugin-web-extension": "^1.6.1",
"web-ext": "^5.0.0"
}
}

40
src/background/index.js Normal file
View File

@ -0,0 +1,40 @@
import browser from 'webextension-polyfill'
// import Dexie from 'dexie'
// const db = new Dexie('myDb')
// db.version(1).stores({
// friends: `name, age`,
// })
// import NeDB from 'nedb'
// const db = new NeDB({filename: 'data.db'})
// db.insert({planet: 'Earth'})
import NeDB from 'nedb-promises'
const db = NeDB.create({
filename: 'data.db',
autoload: true,
})
async function main() {
await db.insert({ planet: 'Earth' })
console.log('Docs', await db.find())
}
// main()
async function getAllTabs() {
console.log('Getting all tabs')
const all = await browser.tabs.query({})
for (const tab of all) {
console.log(tab.title, tab.id, tab.active, tab.highlighted)
}
}
setInterval(() => {
getAllTabs()
}, 10000)
// document.addEventListener('DOMContentLoaded', () => {
// console.log('Hello from BG')
// })

7718
yarn.lock Normal file

File diff suppressed because it is too large Load Diff