Skip to content

Commit

Permalink
Add page action, better project layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ZipFile committed Aug 18, 2020
1 parent 1de2f16 commit 336b291
Show file tree
Hide file tree
Showing 24 changed files with 7,937 additions and 115 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
web-ext-artifacts/
dist/
browser-polyfill.js
*.pem
47 changes: 32 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,48 @@
# Upload to Danbooru Web Extension

Add a context menu option for images to upload to Danbooru.
Add a page action and a context menu option (for images) to upload to ![cardboard box](/danbooru.svg) Danbooru. Replacement for [bookmarklets](https://danbooru.donmai.us/static/bookmarklet).

## Usage

![Page action demo](/screenshots/page-action.png)

![Context menu demo](/screenshots/context-menu.png)

## Build

```sh
npm install --global web-ext
npm install webextension-polyfill
cp node_modules/webextension-polyfill/dist/browser-polyfill.js .
web-ext build -n upload_to_danbooru.zip -i README.md
npm i
npm run build
```

### Chrome
Extension package will be located in `web-ext-artifacts/` folder.

## Run Tests

```sh
npm install --global crx3
test -f .key.pem || openssl genrsa -out .key.pem 4096
crx3 -p .key.pem -o web-ext-artifacts/upload_to_danbooru.crx < web-ext-artifacts/upload_to_danbooru.zip
npm test
```

## Install
## Install In Developer Mode

```sh
firefox web-ext-artifacts/upload_to_danbooru.zip
```
Make sure you have built extension.

### Firefox

* Open `about:debugging`
* Click `Load Temporary Add-on`
* Select `dist/manifest.json` file

### Chrome

Open `chrome://extensions`, enable `Developer mode`, then drop
`web-ext-artifacts/upload_to_danbooru.crx` onto the page.
* Open Chrome Settings
* Select Extensions
* Enable developer mode
* Click Load Unpacked
* Select `dist/` folder

### web-ext

```sh
npx web-ext run
```
67 changes: 0 additions & 67 deletions background.js

This file was deleted.

10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

set -e
set -v

rm -fr dist/
mkdir dist
cp -t dist/ node_modules/webextension-polyfill/dist/browser-polyfill.js{,.map}
cp -a src/. dist/
npx web-ext build --overwrite-dest
33 changes: 0 additions & 33 deletions manifest.json

This file was deleted.

Loading

0 comments on commit 336b291

Please sign in to comment.