mirror of
https://github.com/obsqrbtz/goose-highlighter.git
synced 2026-04-09 04:29:09 +03:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d90f5d5bf | |||
| a68f2ddbe8 | |||
| 2a1034aef4 | |||
| 1ec17cd83e | |||
| b5386c706f | |||
| 5ca83fce0f | |||
|
|
7e4f2b4ecf | ||
| a158a303b0 | |||
| 915add3a4c |
14
.github/workflows/publish-extension.yml
vendored
14
.github/workflows/publish-extension.yml
vendored
@@ -16,13 +16,25 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build extension
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
- name: Set version from tag
|
- name: Set version from tag
|
||||||
id: version
|
id: version
|
||||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Create zip package
|
- name: Create zip package
|
||||||
run: |
|
run: |
|
||||||
zip -r goose-highlighter.zip . -x '*.git*' 'node_modules/*' 'versioning.md' '.releaserc.json' 'package.json' 'package-lock.json' 'README.md'
|
zip -r goose-highlighter.zip . -x '*.git*' 'node_modules/*' 'src/*' 'versioning.md' '.releaserc.json' 'package.json' 'package-lock.json' 'README.md' 'tsconfig.json' 'eslint.config.mjs'
|
||||||
|
|
||||||
- name: Install webstore upload CLI
|
- name: Install webstore upload CLI
|
||||||
run: npm install -g chrome-webstore-upload-cli
|
run: npm install -g chrome-webstore-upload-cli
|
||||||
|
|||||||
103
.github/workflows/release.yml
vendored
Normal file
103
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
name: Create GitHub Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Create Release with Extension Files
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build extension
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Get version from tag
|
||||||
|
id: version
|
||||||
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Update manifest version
|
||||||
|
run: node scripts/update-manifest-version.js ${{ steps.version.outputs.VERSION }}
|
||||||
|
|
||||||
|
- name: Create extension zip
|
||||||
|
run: |
|
||||||
|
zip -r goose-highlighter-${{ steps.version.outputs.VERSION }}.zip . \
|
||||||
|
-x '*.git*' 'node_modules/*' 'src/*' 'versioning.md' '.releaserc.json' \
|
||||||
|
'package.json' 'package-lock.json' 'README.md' 'tsconfig.json' \
|
||||||
|
'eslint.config.mjs' '.github/*' 'CHANGELOG.md' 'PRIVACY.MD'
|
||||||
|
|
||||||
|
- name: Install Chrome extension packaging tool
|
||||||
|
run: npm install -g crx3
|
||||||
|
|
||||||
|
- name: Generate private key for CRX
|
||||||
|
run: |
|
||||||
|
openssl genrsa -out key.pem 2048
|
||||||
|
|
||||||
|
- name: Create CRX file
|
||||||
|
run: |
|
||||||
|
# Create a temporary directory for the extension
|
||||||
|
mkdir temp_extension
|
||||||
|
|
||||||
|
# Copy all files except excluded ones to temp directory
|
||||||
|
rsync -av --exclude='.git*' --exclude='node_modules' --exclude='src' \
|
||||||
|
--exclude='versioning.md' --exclude='.releaserc.json' \
|
||||||
|
--exclude='package.json' --exclude='package-lock.json' \
|
||||||
|
--exclude='README.md' --exclude='tsconfig.json' \
|
||||||
|
--exclude='eslint.config.mjs' --exclude='.github' \
|
||||||
|
--exclude='CHANGELOG.md' --exclude='PRIVACY.MD' \
|
||||||
|
--exclude='key.pem' --exclude='temp_extension' \
|
||||||
|
./ temp_extension/
|
||||||
|
|
||||||
|
# Create CRX file
|
||||||
|
crx3 temp_extension -o goose-highlighter-${{ steps.version.outputs.VERSION }}.crx -p key.pem
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -rf temp_extension key.pem
|
||||||
|
|
||||||
|
- name: Generate release notes
|
||||||
|
id: release_notes
|
||||||
|
run: |
|
||||||
|
if [ -f CHANGELOG.md ]; then
|
||||||
|
# Extract the latest version's changes from CHANGELOG.md
|
||||||
|
awk '/^## \[${{ steps.version.outputs.VERSION }}\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md > release_notes.txt
|
||||||
|
if [ -s release_notes.txt ]; then
|
||||||
|
echo "RELEASE_NOTES<<EOF" >> $GITHUB_OUTPUT
|
||||||
|
cat release_notes.txt >> $GITHUB_OUTPUT
|
||||||
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "RELEASE_NOTES=Release ${{ steps.version.outputs.VERSION }}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "RELEASE_NOTES=Release ${{ steps.version.outputs.VERSION }}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref_name }}
|
||||||
|
name: Release ${{ steps.version.outputs.VERSION }}
|
||||||
|
body: ${{ steps.release_notes.outputs.RELEASE_NOTES }}
|
||||||
|
files: |
|
||||||
|
goose-highlighter-${{ steps.version.outputs.VERSION }}.zip
|
||||||
|
goose-highlighter-${{ steps.version.outputs.VERSION }}.crx
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
|||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
dist
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
# [1.8.0](https://github.com/obsqrbtz/goose-highlighter/compare/v1.7.2...v1.8.0) (2025-10-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add collapsible sections ([a158a30](https://github.com/obsqrbtz/goose-highlighter/commit/a158a303b01416f81e69bb137b71d3369904b044))
|
||||||
|
* add websites to exception list ([915add3](https://github.com/obsqrbtz/goose-highlighter/commit/915add3a4cdbff390a4d0f7d227a4ece5fa31072))
|
||||||
|
|
||||||
## [1.7.2](https://github.com/obsqrbtz/goose-highlighter/compare/v1.7.1...v1.7.2) (2025-10-06)
|
## [1.7.2](https://github.com/obsqrbtz/goose-highlighter/compare/v1.7.1...v1.7.2) (2025-10-06)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ Goose Highlighter is a browser extension that allows you to highlight custom wor
|
|||||||
- **Custom Colors:** Set background and foreground for each list and individual word.
|
- **Custom Colors:** Set background and foreground for each list and individual word.
|
||||||
- **Bulk Add:** Paste multiple words at once.
|
- **Bulk Add:** Paste multiple words at once.
|
||||||
- **Enable/Disable:** Toggle highlighting globally, per list, or per word.
|
- **Enable/Disable:** Toggle highlighting globally, per list, or per word.
|
||||||
- **Import/Export:** Backup or share your highlight lists as JSON files.
|
- **Site Exceptions:** Add websites to an exceptions list to disable highlighting on specific sites.
|
||||||
|
- **Import/Export:** Backup or share your highlight lists and exceptions as JSON files.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
|||||||
@@ -94,5 +94,29 @@
|
|||||||
},
|
},
|
||||||
"options": { "message": "Optionen" },
|
"options": { "message": "Optionen" },
|
||||||
"match_case": { "message": "Groß-/Kleinschreibung beachten" },
|
"match_case": { "message": "Groß-/Kleinschreibung beachten" },
|
||||||
"match_whole": { "message": "Ganzes Wort übereinstimmen" }
|
"match_whole": { "message": "Ganzes Wort übereinstimmen" },
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Website-Ausnahmen"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Zu Ausnahmen hinzufügen"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Aus Ausnahmen entfernen"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Verwalten"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Ausnahme-Websites:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Alle löschen"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Möchten Sie wirklich alle Ausnahmen löschen?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Entfernen"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Match Whole Word"
|
"message": "Match Whole Word"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Site Exceptions"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Add to Exceptions"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Remove from Exceptions"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Manage"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Exception Sites:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Clear All"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Are you sure you want to clear all exceptions?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Remove"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Coincidir palabra completa"
|
"message": "Coincidir palabra completa"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Excepciones de sitios"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Agregar a excepciones"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Quitar de excepciones"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Gestionar"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Sitios de excepción:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Limpiar todo"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "¿Estás seguro de que deseas limpiar todas las excepciones?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Eliminar"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Mot entier seulement"
|
"message": "Mot entier seulement"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Exceptions de sites"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Ajouter aux exceptions"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Retirer des exceptions"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Gérer"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Sites d'exception :"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Tout effacer"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Êtes-vous sûr de vouloir effacer toutes les exceptions ?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Supprimer"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "पूरा शब्द मिलाएं"
|
"message": "पूरा शब्द मिलाएं"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "साइट अपवाद"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "अपवादों में जोड़ें"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "अपवादों से हटाएं"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "प्रबंधित करें"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "अपवाद साइटें:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "सभी साफ करें"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "क्या आप वाकई सभी अपवादों को साफ करना चाहते हैं?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "हटाएं"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Solo parola intera"
|
"message": "Solo parola intera"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Eccezioni siti"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Aggiungi alle eccezioni"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Rimuovi dalle eccezioni"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Gestisci"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Siti di eccezione:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Cancella tutto"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Sei sicuro di voler cancellare tutte le eccezioni?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Rimuovi"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "完全一致"
|
"message": "完全一致"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "サイト例外"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "例外に追加"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "例外から削除"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "管理"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "例外サイト:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "すべてクリア"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "すべての例外をクリアしてもよろしいですか?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "削除"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "전체 단어 일치"
|
"message": "전체 단어 일치"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "사이트 예외"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "예외에 추가"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "예외에서 제거"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "관리"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "예외 사이트:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "모두 지우기"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "모든 예외를 지우시겠습니까?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "제거"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Alleen volledig woord"
|
"message": "Alleen volledig woord"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Site-uitzonderingen"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Toevoegen aan uitzonderingen"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Verwijderen uit uitzonderingen"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Beheren"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Uitzondering sites:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Alles wissen"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Weet je zeker dat je alle uitzonderingen wilt wissen?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Verwijderen"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Tylko całe słowo"
|
"message": "Tylko całe słowo"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Wyjątki stron"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Dodaj do wyjątków"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Usuń z wyjątków"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Zarządzaj"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Strony wyjątków:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Wyczyść wszystko"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Czy na pewno chcesz wyczyścić wszystkie wyjątki?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Usuń"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -94,5 +94,29 @@
|
|||||||
},
|
},
|
||||||
"options": { "message": "Opções" },
|
"options": { "message": "Opções" },
|
||||||
"match_case": { "message": "Diferenciar maiúsculas/minúsculas" },
|
"match_case": { "message": "Diferenciar maiúsculas/minúsculas" },
|
||||||
"match_whole": { "message": "Palavra inteira" }
|
"match_whole": { "message": "Palavra inteira" },
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Exceções de sites"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Adicionar às exceções"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Remover das exceções"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Gerenciar"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Sites de exceção:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Limpar tudo"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Tem certeza de que deseja limpar todas as exceções?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Remover"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Слово целиком"
|
"message": "Слово целиком"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Сайты-исключения"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "Добавить в исключения"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "Удалить из исключений"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Управление"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "Сайты-исключения:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Очистить все"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Вы уверены, что хотите очистить все исключения?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Удалить"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "Tüm kelimeyle eşleş"
|
"message": "Tüm kelimeyle eşleş"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "Site İstisnaları"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "İstisnalara Ekle"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "İstisnalardan Çıkar"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "Yönet"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "İstisna Siteleri:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "Hepsini Temizle"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "Tüm istisnaları temizlemek istediğinizden emin misiniz?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "Kaldır"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -100,5 +100,29 @@
|
|||||||
},
|
},
|
||||||
"match_whole": {
|
"match_whole": {
|
||||||
"message": "全词匹配"
|
"message": "全词匹配"
|
||||||
|
},
|
||||||
|
"site_exceptions": {
|
||||||
|
"message": "网站例外"
|
||||||
|
},
|
||||||
|
"add_exception": {
|
||||||
|
"message": "添加到例外"
|
||||||
|
},
|
||||||
|
"remove_exception": {
|
||||||
|
"message": "从例外中移除"
|
||||||
|
},
|
||||||
|
"manage_exceptions": {
|
||||||
|
"message": "管理"
|
||||||
|
},
|
||||||
|
"exceptions_list": {
|
||||||
|
"message": "例外网站:"
|
||||||
|
},
|
||||||
|
"clear_all": {
|
||||||
|
"message": "清除全部"
|
||||||
|
},
|
||||||
|
"confirm_clear_exceptions": {
|
||||||
|
"message": "您确定要清除所有例外吗?"
|
||||||
|
},
|
||||||
|
"remove": {
|
||||||
|
"message": "移除"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
|
|
||||||
if (changeInfo.status === 'complete' && /^https?:/.test(tab.url)) {
|
|
||||||
chrome.scripting.executeScript({
|
|
||||||
target: { tabId },
|
|
||||||
files: ['main.js']
|
|
||||||
}).catch(err => {
|
|
||||||
console.warn('Injection failed:', err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@@ -28,4 +28,13 @@ export default [...compat.extends('eslint:recommended'), {
|
|||||||
semi: ['error', 'always'],
|
semi: ['error', 'always'],
|
||||||
quotes: ['error', 'single'],
|
quotes: ['error', 'single'],
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
files: ['scripts/**/*.js'],
|
||||||
|
languageOptions: {
|
||||||
|
globals: {
|
||||||
|
...globals.node,
|
||||||
|
},
|
||||||
|
ecmaVersion: 12,
|
||||||
|
sourceType: 'module',
|
||||||
|
},
|
||||||
}];
|
}];
|
||||||
@@ -2,11 +2,12 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "__MSG_extension_name__",
|
"name": "__MSG_extension_name__",
|
||||||
"description": "__MSG_extension_description__",
|
"description": "__MSG_extension_description__",
|
||||||
"version": "1.7.2",
|
"version": "1.8.0",
|
||||||
"default_locale": "en",
|
"default_locale": "en",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"scripting",
|
"scripting",
|
||||||
"storage"
|
"storage",
|
||||||
|
"tabs"
|
||||||
],
|
],
|
||||||
"host_permissions": [
|
"host_permissions": [
|
||||||
"<all_urls>"
|
"<all_urls>"
|
||||||
@@ -16,7 +17,7 @@
|
|||||||
"default_icon": "icons/icon128.png"
|
"default_icon": "icons/icon128.png"
|
||||||
},
|
},
|
||||||
"background": {
|
"background": {
|
||||||
"service_worker": "background.js"
|
"service_worker": "dist/background.js"
|
||||||
},
|
},
|
||||||
"icons": {
|
"icons": {
|
||||||
"48": "icons/icon48.png",
|
"48": "icons/icon48.png",
|
||||||
|
|||||||
53
package-lock.json
generated
53
package-lock.json
generated
@@ -10,9 +10,11 @@
|
|||||||
"@semantic-release/changelog": "^6.0.3",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@semantic-release/exec": "^7.1.0",
|
"@semantic-release/exec": "^7.1.0",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@semantic-release/git": "^10.0.1",
|
||||||
|
"@types/chrome": "^0.0.270",
|
||||||
"eslint": "^9.30.0",
|
"eslint": "^9.30.0",
|
||||||
"globals": "^16.2.0",
|
"globals": "^16.2.0",
|
||||||
"semantic-release": "^24.2.5"
|
"semantic-release": "^24.2.5",
|
||||||
|
"typescript": "^5.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@babel/code-frame": {
|
"node_modules/@babel/code-frame": {
|
||||||
@@ -1213,6 +1215,17 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/chrome": {
|
||||||
|
"version": "0.0.270",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.270.tgz",
|
||||||
|
"integrity": "sha512-ADvkowV7YnJfycZZxL2brluZ6STGW+9oKG37B422UePf2PCXuFA/XdERI0T18wtuWPx0tmFeZqq6MOXVk1IC+Q==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/filesystem": "*",
|
||||||
|
"@types/har-format": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/estree": {
|
"node_modules/@types/estree": {
|
||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz",
|
||||||
@@ -1220,6 +1233,30 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/filesystem": {
|
||||||
|
"version": "0.0.36",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.36.tgz",
|
||||||
|
"integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/filewriter": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/filewriter": {
|
||||||
|
"version": "0.0.33",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.33.tgz",
|
||||||
|
"integrity": "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/har-format": {
|
||||||
|
"version": "1.2.16",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.16.tgz",
|
||||||
|
"integrity": "sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@types/json-schema": {
|
"node_modules/@types/json-schema": {
|
||||||
"version": "7.0.15",
|
"version": "7.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
|
||||||
@@ -7624,6 +7661,20 @@
|
|||||||
"url": "https://github.com/sponsors/sindresorhus"
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.9.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||||
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/uglify-js": {
|
"node_modules/uglify-js": {
|
||||||
"version": "3.19.3",
|
"version": "3.19.3",
|
||||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
|
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.19.3.tgz",
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -5,11 +5,17 @@
|
|||||||
"@semantic-release/changelog": "^6.0.3",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@semantic-release/exec": "^7.1.0",
|
"@semantic-release/exec": "^7.1.0",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@semantic-release/git": "^10.0.1",
|
||||||
|
"@types/chrome": "^0.0.270",
|
||||||
"eslint": "^9.30.0",
|
"eslint": "^9.30.0",
|
||||||
"globals": "^16.2.0",
|
"globals": "^16.2.0",
|
||||||
"semantic-release": "^24.2.5"
|
"semantic-release": "^24.2.5",
|
||||||
|
"typescript": "^5.6.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepare": "node scripts/update-manifest-version.js"
|
"build": "tsc",
|
||||||
|
"watch": "tsc --watch",
|
||||||
|
"clean": "rimraf dist",
|
||||||
|
"rebuild": "npm run clean && npm run build",
|
||||||
|
"prepare": "npm run build && node scripts/update-manifest-version.js"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
107
popup/popup.css
107
popup/popup.css
@@ -80,6 +80,7 @@ h1 {
|
|||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
padding: 14px;
|
padding: 14px;
|
||||||
box-shadow: var(--shadow);
|
box-shadow: var(--shadow);
|
||||||
|
transition: all 0.2s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section-header {
|
.section-header {
|
||||||
@@ -87,6 +88,60 @@ h1 {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding-left: 8px;
|
||||||
|
padding-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header:hover {
|
||||||
|
background: var(--highlight-tag);
|
||||||
|
border-radius: 6px;
|
||||||
|
transition: background 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-toggle {
|
||||||
|
background: none !important;
|
||||||
|
border: none !important;
|
||||||
|
color: var(--text-color) !important;
|
||||||
|
padding: 4px !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-toggle:hover {
|
||||||
|
background: var(--button-hover) !important;
|
||||||
|
color: var(--accent) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.collapse-toggle i {
|
||||||
|
transition: transform 0.2s ease;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.collapsed .collapse-toggle i {
|
||||||
|
transform: rotate(180deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-content {
|
||||||
|
overflow: hidden;
|
||||||
|
max-height: 2000px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.collapsed .section-content {
|
||||||
|
max-height: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section.collapsed .section-header {
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.section h2 {
|
.section h2 {
|
||||||
@@ -96,6 +151,7 @@ h1 {
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="text"],
|
input[type="text"],
|
||||||
@@ -506,3 +562,54 @@ body::-webkit-scrollbar-corner,
|
|||||||
#wordList::-webkit-scrollbar-corner {
|
#wordList::-webkit-scrollbar-corner {
|
||||||
background: var(--scrollbar-bg);
|
background: var(--scrollbar-bg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Exception Panel Styles */
|
||||||
|
.exceptions-panel {
|
||||||
|
margin-top: 10px;
|
||||||
|
padding: 12px;
|
||||||
|
border: 1px solid var(--input-border);
|
||||||
|
border-radius: var(--border-radius);
|
||||||
|
background: var(--input-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.exceptions-list {
|
||||||
|
max-height: 120px;
|
||||||
|
overflow-y: auto;
|
||||||
|
margin: 8px 0;
|
||||||
|
border: 1px solid var(--input-border);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--section-bg);
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-item {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
padding: 8px 12px;
|
||||||
|
border-bottom: 1px solid var(--highlight-tag-border);
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-item:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-domain {
|
||||||
|
flex: 1;
|
||||||
|
word-break: break-all;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-remove {
|
||||||
|
background: var(--danger);
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 4px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.exception-remove:hover {
|
||||||
|
background: #d00030;
|
||||||
|
}
|
||||||
158
popup/popup.html
158
popup/popup.html
@@ -29,74 +29,126 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section" data-section="exceptions">
|
||||||
|
<div class="section-header">
|
||||||
|
<h2><i class="fa-solid fa-ban"></i> <span data-i18n="site_exceptions">Site Exceptions</span></h2>
|
||||||
|
<button class="collapse-toggle" data-target="exceptions">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="section-content" id="exceptions-content">
|
||||||
|
<div class="button-row">
|
||||||
|
<button id="toggleExceptionBtn"><i class="fa-solid fa-ban"></i> <span id="exceptionBtnText" data-i18n="add_exception">Add to Exceptions</span></button>
|
||||||
|
<button id="manageExceptionsBtn"><i class="fa-solid fa-list"></i> <span data-i18n="manage_exceptions">Manage</span></button>
|
||||||
|
</div>
|
||||||
|
<div id="exceptionsPanel" class="exceptions-panel" style="display: none;">
|
||||||
|
<h3 data-i18n="exceptions_list">Exception Sites:</h3>
|
||||||
|
<div id="exceptionsList" class="exceptions-list"></div>
|
||||||
|
<button id="clearExceptionsBtn" class="danger"><i class="fa-solid fa-trash"></i> <span data-i18n="clear_all">Clear All</span></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section" data-section="lists">
|
||||||
<div class="section-header">
|
<div class="section-header">
|
||||||
<h2><i class="fa-solid fa-list"></i> <span data-i18n="highlight_lists">Highlight Lists</span></h2>
|
<h2><i class="fa-solid fa-list"></i> <span data-i18n="highlight_lists">Highlight Lists</span></h2>
|
||||||
|
<button class="collapse-toggle" data-target="lists">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<label for="listSelect" data-i18n="select_list">Select List:</label>
|
<div class="section-content" id="lists-content">
|
||||||
<select id="listSelect"></select>
|
<label for="listSelect" data-i18n="select_list">Select List:</label>
|
||||||
<div class="button-row">
|
<select id="listSelect"></select>
|
||||||
<button id="newListBtn"><i class="fa-solid fa-plus"></i> <span data-i18n="new_list">New</span></button>
|
<div class="button-row">
|
||||||
<button id="deleteListBtn" class="danger"><i class="fa-solid fa-trash"></i> <span
|
<button id="newListBtn"><i class="fa-solid fa-plus"></i> <span data-i18n="new_list">New</span></button>
|
||||||
data-i18n="delete_list">Delete</span></button>
|
<button id="deleteListBtn" class="danger"><i class="fa-solid fa-trash"></i> <span
|
||||||
</div>
|
data-i18n="delete_list">Delete</span></button>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section">
|
|
||||||
<h2><i class="fa-solid fa-gear"></i> <span data-i18n="list_settings">List Settings</span></h2>
|
|
||||||
<label><span data-i18n="list_name">List Name:</span> <input type="text" id="listName" /></label>
|
|
||||||
<div class="color-row">
|
|
||||||
<div class="color-label">
|
|
||||||
<span data-i18n="background">Background:</span>
|
|
||||||
<input type="color" id="listBg" />
|
|
||||||
</div>
|
|
||||||
<div class="color-label">
|
|
||||||
<span data-i18n="foreground">Foreground:</span>
|
|
||||||
<input type="color" id="listFg" />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label>
|
|
||||||
<span data-i18n="enable_highlight">Enable Highlighting</span>
|
|
||||||
<input type="checkbox" class="switch" id="listActive" />
|
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section" data-section="settings">
|
||||||
<h2><i class="fa-solid fa-pen"></i> <span data-i18n="add_words">Add Words</span></h2>
|
<div class="section-header">
|
||||||
<textarea id="bulkPaste" data-i18n="paste_hint" placeholder="Paste words here..."></textarea>
|
<h2><i class="fa-solid fa-gear"></i> <span data-i18n="list_settings">List Settings</span></h2>
|
||||||
<button id="addWordsBtn"><span data-i18n="apply_paste">Add Words</span></button>
|
<button class="collapse-toggle" data-target="settings">
|
||||||
</div>
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
<div class="section">
|
</div>
|
||||||
<h2><i class="fa-solid fa-tags"></i> <span data-i18n="word_list">Word List</span>(<span id="wordCount">0</span>)
|
<div class="section-content" id="settings-content">
|
||||||
</h2>
|
<label><span data-i18n="list_name">List Name:</span> <input type="text" id="listName" /></label>
|
||||||
<div class="button-row wrap">
|
<div class="color-row">
|
||||||
<button id="selectAllBtn"><span data-i18n="select_all">Select All</span></button>
|
<div class="color-label">
|
||||||
<button id="deselectAllBtn"><span data-i18n="deselect_all">Clear</span></button>
|
<span data-i18n="background">Background:</span>
|
||||||
<button id="enableSelectedBtn"><span data-i18n="enable_selected">Enable</span></button>
|
<input type="color" id="listBg" />
|
||||||
<button id="disableSelectedBtn"><span data-i18n="disable_selected">Disable</span></button>
|
</div>
|
||||||
<button id="deleteSelectedBtn" class="danger"><span data-i18n="delete_selected">Delete</span></button>
|
<div class="color-label">
|
||||||
|
<span data-i18n="foreground">Foreground:</span>
|
||||||
|
<input type="color" id="listFg" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<label>
|
||||||
|
<span data-i18n="enable_highlight">Enable Highlighting</span>
|
||||||
|
<input type="checkbox" class="switch" id="listActive" />
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" id="wordSearch" data-i18n="search_placeholder" placeholder="Search..." />
|
|
||||||
<div id="wordList"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="section">
|
<div class="section" data-section="addwords">
|
||||||
<h2><i class="fa-solid fa-sliders"></i> <span data-i18n="options">Options</span></h2>
|
<div class="section-header">
|
||||||
<div class="button-row" style="margin-bottom:8px;">
|
<h2><i class="fa-solid fa-pen"></i> <span data-i18n="add_words">Add Words</span></h2>
|
||||||
<label><input type="checkbox" id="matchCase" /> <span data-i18n="match_case">Match Case</span></label>
|
<button class="collapse-toggle" data-target="addwords">
|
||||||
<label><input type="checkbox" id="matchWhole" /> <span data-i18n="match_whole">Match Whole Word</span></label>
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="button-row">
|
<div class="section-content" id="addwords-content">
|
||||||
<button id="importBtn"><i class="fa-solid fa-upload"></i> <span data-i18n="import_list">Import</span></button>
|
<textarea id="bulkPaste" data-i18n="paste_hint" placeholder="Paste words here..."></textarea>
|
||||||
<input type="file" id="importInput" accept="application/json" hidden />
|
<button id="addWordsBtn"><span data-i18n="apply_paste">Add Words</span></button>
|
||||||
<button id="exportBtn"><i class="fa-solid fa-download"></i> <span data-i18n="export_list">Export</span></button>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section" data-section="wordlist">
|
||||||
|
<div class="section-header">
|
||||||
|
<h2><i class="fa-solid fa-tags"></i> <span data-i18n="word_list">Word List</span>(<span id="wordCount">0</span>)
|
||||||
|
</h2>
|
||||||
|
<button class="collapse-toggle" data-target="wordlist">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="section-content" id="wordlist-content">
|
||||||
|
<div class="button-row wrap">
|
||||||
|
<button id="selectAllBtn"><span data-i18n="select_all">Select All</span></button>
|
||||||
|
<button id="deselectAllBtn"><span data-i18n="deselect_all">Clear</span></button>
|
||||||
|
<button id="enableSelectedBtn"><span data-i18n="enable_selected">Enable</span></button>
|
||||||
|
<button id="disableSelectedBtn"><span data-i18n="disable_selected">Disable</span></button>
|
||||||
|
<button id="deleteSelectedBtn" class="danger"><span data-i18n="delete_selected">Delete</span></button>
|
||||||
|
</div>
|
||||||
|
<input type="text" id="wordSearch" data-i18n="search_placeholder" placeholder="Search..." />
|
||||||
|
<div id="wordList"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="section" data-section="options">
|
||||||
|
<div class="section-header">
|
||||||
|
<h2><i class="fa-solid fa-sliders"></i> <span data-i18n="options">Options</span></h2>
|
||||||
|
<button class="collapse-toggle" data-target="options">
|
||||||
|
<i class="fa-solid fa-chevron-up"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="section-content" id="options-content">
|
||||||
|
<div class="button-row" style="margin-bottom:8px;">
|
||||||
|
<label><input type="checkbox" id="matchCase" /> <span data-i18n="match_case">Match Case</span></label>
|
||||||
|
<label><input type="checkbox" id="matchWhole" /> <span data-i18n="match_whole">Match Whole Word</span></label>
|
||||||
|
</div>
|
||||||
|
<div class="button-row">
|
||||||
|
<button id="importBtn"><i class="fa-solid fa-upload"></i> <span data-i18n="import_list">Import</span></button>
|
||||||
|
<input type="file" id="importInput" accept="application/json" hidden />
|
||||||
|
<button id="exportBtn"><i class="fa-solid fa-download"></i> <span data-i18n="export_list">Export</span></button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="../storage.js"></script>
|
<script src="../dist/popup/popup.js"></script>
|
||||||
<script src="popup.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
const fs = require("fs");
|
const fs = require('fs');
|
||||||
|
|
||||||
const version = process.argv[2];
|
const version = process.argv[2];
|
||||||
if (!version) {
|
if (!version) {
|
||||||
console.error("❌ No version passed");
|
console.log('ℹ️ No version passed, skipping manifest update');
|
||||||
process.exit(1);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
const manifest = JSON.parse(fs.readFileSync("manifest.json", "utf-8"));
|
const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf-8'));
|
||||||
manifest.version = version;
|
manifest.version = version;
|
||||||
fs.writeFileSync("manifest.json", JSON.stringify(manifest, null, 2));
|
fs.writeFileSync('manifest.json', JSON.stringify(manifest, null, 2));
|
||||||
|
|
||||||
console.log(`✅ Updated manifest.json to version ${version}`);
|
console.log(`✅ Updated manifest.json to version ${version}`);
|
||||||
20
src/background.ts
Normal file
20
src/background.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
// Handle tab updates to inject content script
|
||||||
|
chrome.tabs.onUpdated.addListener((tabId: number, changeInfo: chrome.tabs.TabChangeInfo, tab: chrome.tabs.Tab): void => {
|
||||||
|
if (changeInfo.status === 'complete' && tab.url && /^https?:/.test(tab.url)) {
|
||||||
|
chrome.scripting.executeScript({
|
||||||
|
target: { tabId },
|
||||||
|
files: ['dist/main.js']
|
||||||
|
}).catch((err: unknown) => {
|
||||||
|
console.warn('Injection failed:', err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initialize storage on extension install
|
||||||
|
chrome.runtime.onInstalled.addListener((): void => {
|
||||||
|
chrome.storage.local.get(['exceptionsList'], (result: any) => {
|
||||||
|
if (!result.exceptionsList) {
|
||||||
|
chrome.storage.local.set({ exceptionsList: [] });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
|
// @ts-nocheck
|
||||||
let currentLists = [];
|
let currentLists = [];
|
||||||
let isGlobalHighlightEnabled = true;
|
let isGlobalHighlightEnabled = true;
|
||||||
|
let exceptionsList = [];
|
||||||
|
let isCurrentSiteException = false;
|
||||||
let matchCase = false;
|
let matchCase = false;
|
||||||
let matchWhole = false;
|
let matchWhole = false;
|
||||||
let styleSheet = null;
|
let styleSheet = null;
|
||||||
@@ -9,6 +12,11 @@ function escapeRegex(s) {
|
|||||||
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
return s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isCurrentSiteInExceptions() {
|
||||||
|
const currentHostname = window.location.hostname;
|
||||||
|
return exceptionsList.includes(currentHostname);
|
||||||
|
}
|
||||||
|
|
||||||
function initializeStyleSheet() {
|
function initializeStyleSheet() {
|
||||||
if (!styleSheet) {
|
if (!styleSheet) {
|
||||||
const style = document.createElement('style');
|
const style = document.createElement('style');
|
||||||
@@ -59,7 +67,7 @@ function processNodes() {
|
|||||||
observer.disconnect();
|
observer.disconnect();
|
||||||
clearHighlights();
|
clearHighlights();
|
||||||
|
|
||||||
if (!isGlobalHighlightEnabled) {
|
if (!isGlobalHighlightEnabled || isCurrentSiteException) {
|
||||||
observer.observe(document.body, {
|
observer.observe(document.body, {
|
||||||
childList: true,
|
childList: true,
|
||||||
subtree: true,
|
subtree: true,
|
||||||
@@ -152,13 +160,15 @@ function debounce(func, wait) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Initial highlight on load
|
// Initial highlight on load
|
||||||
chrome.storage.local.get(['lists', 'globalHighlightEnabled', 'matchCaseEnabled', 'matchWholeEnabled'], ({ lists, globalHighlightEnabled, matchCaseEnabled, matchWholeEnabled }) => {
|
chrome.storage.local.get(['lists', 'globalHighlightEnabled', 'matchCaseEnabled', 'matchWholeEnabled', 'exceptionsList'], ({ lists, globalHighlightEnabled, matchCaseEnabled, matchWholeEnabled, exceptionsList: exceptions }) => {
|
||||||
if (Array.isArray(lists)) setListsAndUpdate(lists);
|
if (Array.isArray(lists)) setListsAndUpdate(lists);
|
||||||
if (globalHighlightEnabled !== undefined) {
|
if (globalHighlightEnabled !== undefined) {
|
||||||
isGlobalHighlightEnabled = globalHighlightEnabled;
|
isGlobalHighlightEnabled = globalHighlightEnabled;
|
||||||
}
|
}
|
||||||
matchCase = !!matchCaseEnabled;
|
matchCase = !!matchCaseEnabled;
|
||||||
matchWhole = !!matchWholeEnabled;
|
matchWhole = !!matchWholeEnabled;
|
||||||
|
exceptionsList = Array.isArray(exceptions) ? exceptions : [];
|
||||||
|
isCurrentSiteException = isCurrentSiteInExceptions();
|
||||||
processNodes();
|
processNodes();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -175,6 +185,12 @@ chrome.runtime.onMessage.addListener((message) => {
|
|||||||
matchCase = !!message.matchCase;
|
matchCase = !!message.matchCase;
|
||||||
matchWhole = !!message.matchWhole;
|
matchWhole = !!message.matchWhole;
|
||||||
processNodes();
|
processNodes();
|
||||||
|
} else if (message.type === 'EXCEPTIONS_LIST_UPDATED') {
|
||||||
|
chrome.storage.local.get('exceptionsList', ({ exceptionsList: exceptions }) => {
|
||||||
|
exceptionsList = Array.isArray(exceptions) ? exceptions : [];
|
||||||
|
isCurrentSiteException = isCurrentSiteInExceptions();
|
||||||
|
processNodes();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// @ts-nocheck
|
||||||
const listSelect = document.getElementById('listSelect');
|
const listSelect = document.getElementById('listSelect');
|
||||||
const listName = document.getElementById('listName');
|
const listName = document.getElementById('listName');
|
||||||
const listBg = document.getElementById('listBg');
|
const listBg = document.getElementById('listBg');
|
||||||
@@ -15,6 +16,53 @@ let globalHighlightEnabled = true;
|
|||||||
let wordSearchQuery = '';
|
let wordSearchQuery = '';
|
||||||
let matchCaseEnabled = false;
|
let matchCaseEnabled = false;
|
||||||
let matchWholeEnabled = false;
|
let matchWholeEnabled = false;
|
||||||
|
let exceptionsList = [];
|
||||||
|
let currentTabHost = '';
|
||||||
|
let sectionStates = {};
|
||||||
|
|
||||||
|
function loadSectionStates() {
|
||||||
|
const saved = localStorage.getItem('goose-highlighter-section-states');
|
||||||
|
if (saved) {
|
||||||
|
try {
|
||||||
|
sectionStates = JSON.parse(saved);
|
||||||
|
} catch {
|
||||||
|
sectionStates = {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveSectionStates() {
|
||||||
|
localStorage.setItem('goose-highlighter-section-states', JSON.stringify(sectionStates));
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleSection(sectionName) {
|
||||||
|
const section = document.querySelector(`[data-section="${sectionName}"]`);
|
||||||
|
if (!section) return;
|
||||||
|
|
||||||
|
const isCollapsed = section.classList.contains('collapsed');
|
||||||
|
|
||||||
|
if (isCollapsed) {
|
||||||
|
section.classList.remove('collapsed');
|
||||||
|
sectionStates[sectionName] = false;
|
||||||
|
} else {
|
||||||
|
section.classList.add('collapsed');
|
||||||
|
sectionStates[sectionName] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
saveSectionStates();
|
||||||
|
}
|
||||||
|
|
||||||
|
function initializeSectionStates() {
|
||||||
|
loadSectionStates();
|
||||||
|
|
||||||
|
// Apply saved states
|
||||||
|
Object.keys(sectionStates).forEach(sectionName => {
|
||||||
|
const section = document.querySelector(`[data-section="${sectionName}"]`);
|
||||||
|
if (section && sectionStates[sectionName]) {
|
||||||
|
section.classList.add('collapsed');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function escapeHtml(str) {
|
function escapeHtml(str) {
|
||||||
return str.replace(/[&<>"']/g, function (m) {
|
return str.replace(/[&<>"']/g, function (m) {
|
||||||
@@ -33,7 +81,8 @@ async function save() {
|
|||||||
lists: lists,
|
lists: lists,
|
||||||
globalHighlightEnabled: globalHighlightEnabled,
|
globalHighlightEnabled: globalHighlightEnabled,
|
||||||
matchCaseEnabled,
|
matchCaseEnabled,
|
||||||
matchWholeEnabled
|
matchWholeEnabled,
|
||||||
|
exceptionsList
|
||||||
});
|
});
|
||||||
renderLists();
|
renderLists();
|
||||||
renderWords();
|
renderWords();
|
||||||
@@ -51,6 +100,7 @@ async function save() {
|
|||||||
matchCase: matchCaseEnabled,
|
matchCase: matchCaseEnabled,
|
||||||
matchWhole: matchWholeEnabled
|
matchWhole: matchWholeEnabled
|
||||||
});
|
});
|
||||||
|
chrome.tabs.sendMessage(tab.id, { type: 'EXCEPTIONS_LIST_UPDATED' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -75,15 +125,28 @@ async function load() {
|
|||||||
lists: [],
|
lists: [],
|
||||||
globalHighlightEnabled: true,
|
globalHighlightEnabled: true,
|
||||||
matchCaseEnabled: false,
|
matchCaseEnabled: false,
|
||||||
matchWholeEnabled: false
|
matchWholeEnabled: false,
|
||||||
|
exceptionsList: []
|
||||||
});
|
});
|
||||||
lists = res.lists;
|
lists = res.lists;
|
||||||
globalHighlightEnabled = res.globalHighlightEnabled !== false;
|
globalHighlightEnabled = res.globalHighlightEnabled !== false;
|
||||||
matchCaseEnabled = !!res.matchCaseEnabled;
|
matchCaseEnabled = !!res.matchCaseEnabled;
|
||||||
matchWholeEnabled = !!res.matchWholeEnabled;
|
matchWholeEnabled = !!res.matchWholeEnabled;
|
||||||
|
exceptionsList = res.exceptionsList || [];
|
||||||
matchCase.checked = matchCaseEnabled;
|
matchCase.checked = matchCaseEnabled;
|
||||||
matchWhole.checked = matchWholeEnabled;
|
matchWhole.checked = matchWholeEnabled;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const [tab] = await chrome.tabs.query({ active: true, currentWindow: true });
|
||||||
|
if (tab && tab.url) {
|
||||||
|
const url = new URL(tab.url);
|
||||||
|
currentTabHost = url.hostname;
|
||||||
|
updateExceptionButton();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Could not get current tab:', e);
|
||||||
|
}
|
||||||
|
|
||||||
if (!lists.length) {
|
if (!lists.length) {
|
||||||
lists.push({
|
lists.push({
|
||||||
id: Date.now(),
|
id: Date.now(),
|
||||||
@@ -96,6 +159,7 @@ async function load() {
|
|||||||
}
|
}
|
||||||
renderLists();
|
renderLists();
|
||||||
renderWords();
|
renderWords();
|
||||||
|
renderExceptions();
|
||||||
|
|
||||||
document.getElementById('globalHighlightToggle').checked = globalHighlightEnabled;
|
document.getElementById('globalHighlightToggle').checked = globalHighlightEnabled;
|
||||||
}
|
}
|
||||||
@@ -229,8 +293,70 @@ function renderWords() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateExceptionButton() {
|
||||||
|
const toggleBtn = document.getElementById('toggleExceptionBtn');
|
||||||
|
const btnText = document.getElementById('exceptionBtnText');
|
||||||
|
|
||||||
|
if (!toggleBtn || !btnText || !currentTabHost) return;
|
||||||
|
|
||||||
|
const isException = exceptionsList.includes(currentTabHost);
|
||||||
|
|
||||||
|
if (isException) {
|
||||||
|
btnText.textContent = chrome.i18n.getMessage('remove_exception') || 'Remove from Exceptions';
|
||||||
|
toggleBtn.className = 'danger';
|
||||||
|
toggleBtn.querySelector('i').className = 'fa-solid fa-check';
|
||||||
|
} else {
|
||||||
|
btnText.textContent = chrome.i18n.getMessage('add_exception') || 'Add to Exceptions';
|
||||||
|
toggleBtn.className = '';
|
||||||
|
toggleBtn.querySelector('i').className = 'fa-solid fa-ban';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderExceptions() {
|
||||||
|
const container = document.getElementById('exceptionsList');
|
||||||
|
if (!container) return;
|
||||||
|
|
||||||
|
if (exceptionsList.length === 0) {
|
||||||
|
container.innerHTML = '<div class="exception-item">No exceptions</div>';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
container.innerHTML = exceptionsList.map(domain =>
|
||||||
|
`<div class="exception-item">
|
||||||
|
<span class="exception-domain">${escapeHtml(domain)}</span>
|
||||||
|
<button class="exception-remove" data-domain="${escapeHtml(domain)}">${chrome.i18n.getMessage('remove')}</button>
|
||||||
|
</div>`
|
||||||
|
).join('');
|
||||||
|
}
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
initializeSectionStates();
|
||||||
localizePage();
|
localizePage();
|
||||||
|
|
||||||
|
// Add event listeners for collapse toggles
|
||||||
|
document.querySelectorAll('.collapse-toggle').forEach(button => {
|
||||||
|
button.addEventListener('click', (e) => {
|
||||||
|
e.stopPropagation();
|
||||||
|
const targetSection = button.getAttribute('data-target');
|
||||||
|
toggleSection(targetSection);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Also allow clicking section headers to toggle
|
||||||
|
document.querySelectorAll('.section-header').forEach(header => {
|
||||||
|
header.addEventListener('click', (e) => {
|
||||||
|
// Don't toggle if clicking on a button or input within the header
|
||||||
|
if (e.target.tagName === 'BUTTON' || e.target.tagName === 'INPUT' || e.target.closest('button')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const section = header.closest('.section');
|
||||||
|
const sectionName = section.getAttribute('data-section');
|
||||||
|
if (sectionName) {
|
||||||
|
toggleSection(sectionName);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
document.getElementById('selectAllBtn').onclick = () => {
|
document.getElementById('selectAllBtn').onclick = () => {
|
||||||
const list = lists[currentListIndex];
|
const list = lists[currentListIndex];
|
||||||
list.words.forEach((_, index) => {
|
list.words.forEach((_, index) => {
|
||||||
@@ -355,7 +481,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
|
|
||||||
const exportBtn = document.getElementById('exportBtn');
|
const exportBtn = document.getElementById('exportBtn');
|
||||||
exportBtn.onclick = () => {
|
exportBtn.onclick = () => {
|
||||||
const blob = new Blob([JSON.stringify(lists, null, 2)], { type: 'application/json' });
|
const exportData = {
|
||||||
|
lists: lists,
|
||||||
|
exceptionsList: exceptionsList
|
||||||
|
};
|
||||||
|
const blob = new Blob([JSON.stringify(exportData, null, 2)], { type: 'application/json' });
|
||||||
const url = URL.createObjectURL(blob);
|
const url = URL.createObjectURL(blob);
|
||||||
const a = document.createElement('a');
|
const a = document.createElement('a');
|
||||||
a.href = url;
|
a.href = url;
|
||||||
@@ -374,11 +504,24 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
reader.onload = e => {
|
reader.onload = e => {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(e.target.result);
|
const data = JSON.parse(e.target.result);
|
||||||
|
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
|
// Old format - just lists
|
||||||
lists = data;
|
lists = data;
|
||||||
currentListIndex = 0;
|
} else if (data && typeof data === 'object') {
|
||||||
save();
|
// New format - object with lists and exceptions
|
||||||
|
if (Array.isArray(data.lists)) {
|
||||||
|
lists = data.lists;
|
||||||
|
}
|
||||||
|
if (Array.isArray(data.exceptionsList)) {
|
||||||
|
exceptionsList = data.exceptionsList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentListIndex = 0;
|
||||||
|
updateExceptionButton();
|
||||||
|
renderExceptions();
|
||||||
|
save();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
alert(chrome.i18n.getMessage('invalid_json_error:' + err.message));
|
alert(chrome.i18n.getMessage('invalid_json_error:' + err.message));
|
||||||
}
|
}
|
||||||
@@ -447,5 +590,49 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
save();
|
save();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById('toggleExceptionBtn').addEventListener('click', () => {
|
||||||
|
if (!currentTabHost) return;
|
||||||
|
|
||||||
|
const isException = exceptionsList.includes(currentTabHost);
|
||||||
|
|
||||||
|
if (isException) {
|
||||||
|
exceptionsList = exceptionsList.filter(domain => domain !== currentTabHost);
|
||||||
|
} else {
|
||||||
|
exceptionsList.push(currentTabHost);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateExceptionButton();
|
||||||
|
renderExceptions();
|
||||||
|
save();
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('manageExceptionsBtn').addEventListener('click', () => {
|
||||||
|
const panel = document.getElementById('exceptionsPanel');
|
||||||
|
if (panel.style.display === 'none') {
|
||||||
|
panel.style.display = 'block';
|
||||||
|
} else {
|
||||||
|
panel.style.display = 'none';
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('clearExceptionsBtn').addEventListener('click', () => {
|
||||||
|
if (confirm(chrome.i18n.getMessage('confirm_clear_exceptions') || 'Clear all exceptions?')) {
|
||||||
|
exceptionsList = [];
|
||||||
|
updateExceptionButton();
|
||||||
|
renderExceptions();
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
document.getElementById('exceptionsList').addEventListener('click', (e) => {
|
||||||
|
if (e.target.classList.contains('exception-remove')) {
|
||||||
|
const domain = e.target.dataset.domain;
|
||||||
|
exceptionsList = exceptionsList.filter(d => d !== domain);
|
||||||
|
updateExceptionButton();
|
||||||
|
renderExceptions();
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
load();
|
load();
|
||||||
});
|
});
|
||||||
75
src/types.ts
Normal file
75
src/types.ts
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
// Type definitions for the Goose Highlighter extension
|
||||||
|
|
||||||
|
export interface HighlightWord {
|
||||||
|
wordStr: string;
|
||||||
|
background: string;
|
||||||
|
foreground: string;
|
||||||
|
active: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface HighlightList {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
background: string;
|
||||||
|
foreground: string;
|
||||||
|
active: boolean;
|
||||||
|
words: HighlightWord[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StorageData {
|
||||||
|
lists: HighlightList[];
|
||||||
|
globalHighlightEnabled: boolean;
|
||||||
|
matchCaseEnabled: boolean;
|
||||||
|
matchWholeEnabled: boolean;
|
||||||
|
exceptionsList: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ActiveWord {
|
||||||
|
text: string;
|
||||||
|
background: string;
|
||||||
|
foreground: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MessageData {
|
||||||
|
type: 'WORD_LIST_UPDATED' | 'GLOBAL_TOGGLE_UPDATED' | 'MATCH_OPTIONS_UPDATED' | 'EXCEPTIONS_LIST_UPDATED';
|
||||||
|
enabled?: boolean;
|
||||||
|
matchCase?: boolean;
|
||||||
|
matchWhole?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SectionStates {
|
||||||
|
[sectionName: string]: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ExportData {
|
||||||
|
lists: HighlightList[];
|
||||||
|
exceptionsList: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// DOM element selectors used in popup
|
||||||
|
export interface PopupElements {
|
||||||
|
listSelect: HTMLSelectElement;
|
||||||
|
listName: HTMLInputElement;
|
||||||
|
listBg: HTMLInputElement;
|
||||||
|
listFg: HTMLInputElement;
|
||||||
|
listActive: HTMLInputElement;
|
||||||
|
bulkPaste: HTMLTextAreaElement;
|
||||||
|
wordList: HTMLDivElement;
|
||||||
|
importInput: HTMLInputElement;
|
||||||
|
matchCase: HTMLInputElement;
|
||||||
|
matchWhole: HTMLInputElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default storage values
|
||||||
|
export const DEFAULT_STORAGE: Partial<StorageData> = {
|
||||||
|
lists: [],
|
||||||
|
globalHighlightEnabled: true,
|
||||||
|
matchCaseEnabled: false,
|
||||||
|
matchWholeEnabled: false,
|
||||||
|
exceptionsList: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
export const WORD_ITEM_HEIGHT = 32;
|
||||||
|
export const DEBOUNCE_DELAY = 300;
|
||||||
|
export const SCROLL_THROTTLE = 16; // ~60fps
|
||||||
30
tsconfig.json
Normal file
30
tsconfig.json
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "CommonJS",
|
||||||
|
"lib": ["ES2022", "DOM"],
|
||||||
|
"outDir": "./dist",
|
||||||
|
"rootDir": "./src",
|
||||||
|
"strict": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"noEmitOnError": false,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noUnusedLocals": false,
|
||||||
|
"noUnusedParameters": false,
|
||||||
|
"exactOptionalPropertyTypes": false,
|
||||||
|
"types": ["chrome"]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src/**/*"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"dist"
|
||||||
|
]
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user