7 Commits

Author SHA1 Message Date
semantic-release-bot
326e585021 chore(release): 1.8.4
## [1.8.4](https://github.com/obsqrbtz/goose-highlighter/compare/v1.8.3...v1.8.4) (2025-10-28)

### Bug Fixes

* do not re-highlight when already processing highlights ([8be53f3](8be53f3240))
2025-10-28 15:32:14 +03:00
8be53f3240 fix: do not re-highlight when already processing highlights 2025-10-28 15:31:46 +03:00
f07617fa55 Merge branch 'main' of https://github.com/obsqrbtz/goose-highlighter 2025-10-09 16:18:53 +03:00
e79874922a added logo 2025-10-09 16:18:36 +03:00
71216cbcd9 ci: update manifest in publish workflow 2025-10-08 17:54:06 +03:00
f292bd7149 nit: added footer with version and github. 2025-10-08 16:32:04 +03:00
584ced252f ci: publish on version tag push 2025-10-08 16:26:32 +03:00
10 changed files with 104 additions and 29 deletions

View File

@@ -2,7 +2,8 @@ name: Publish Chrome Extension
on: on:
push: push:
branches: [ main ] tags:
- 'v*'
jobs: jobs:
publish: publish:
@@ -32,6 +33,9 @@ jobs:
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: Update manifest version
run: node scripts/update-manifest-version.js ${{ steps.version.outputs.VERSION }}
- name: Create zip package - name: Create zip package
run: | run: |
zip -r goose-highlighter.zip . -x '*.git*' 'node_modules/*' 'src/*' 'scripts/*' 'versioning.md' '.releaserc.json' 'package.json' 'package-lock.json' 'README.md' 'tsconfig.json' 'eslint.config.mjs' zip -r goose-highlighter.zip . -x '*.git*' 'node_modules/*' 'src/*' 'scripts/*' 'versioning.md' '.releaserc.json' 'package.json' 'package-lock.json' 'README.md' 'tsconfig.json' 'eslint.config.mjs'

View File

@@ -1,3 +1,10 @@
## [1.8.4](https://github.com/obsqrbtz/goose-highlighter/compare/v1.8.3...v1.8.4) (2025-10-28)
### Bug Fixes
* do not re-highlight when already processing highlights ([8be53f3](https://github.com/obsqrbtz/goose-highlighter/commit/8be53f32402c2f0f228ca003ef3805c5ff0b6e88))
## [1.8.3](https://github.com/obsqrbtz/goose-highlighter/compare/v1.8.2...v1.8.3) (2025-10-08) ## [1.8.3](https://github.com/obsqrbtz/goose-highlighter/compare/v1.8.2...v1.8.3) (2025-10-08)

View File

@@ -1,4 +1,4 @@
# Goose Highlighter # <img src="img/logo.png" alt="Goose Highlighter Logo" width="32" style="vertical-align: middle;"> Goose Highlighter
Goose Highlighter is a browser extension that allows you to highlight words on any webpage. Goose Highlighter is a browser extension that allows you to highlight words on any webpage.

BIN
img/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -2,7 +2,7 @@
"manifest_version": 3, "manifest_version": 3,
"name": "__MSG_extension_name__", "name": "__MSG_extension_name__",
"description": "__MSG_extension_description__", "description": "__MSG_extension_description__",
"version": "1.8.3", "version": "1.8.4",
"default_locale": "en", "default_locale": "en",
"permissions": [ "permissions": [
"scripting", "scripting",

View File

@@ -613,3 +613,39 @@ body::-webkit-scrollbar-corner,
.exception-remove:hover { .exception-remove:hover {
background: #d00030; background: #d00030;
} }
/* Footer Styles */
.footer {
margin-top: 16px;
padding: 12px 16px;
border-top: 1px solid var(--input-border);
background: var(--section-bg);
}
.footer-content {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.8em;
color: var(--text-color);
opacity: 0.7;
}
.version {
font-weight: 500;
}
.github-link {
display: flex;
align-items: center;
gap: 4px;
color: var(--text-color);
text-decoration: none;
opacity: 0.7;
transition: opacity 0.2s ease, color 0.2s ease;
}
.github-link:hover {
opacity: 1;
color: var(--accent);
}

View File

@@ -149,6 +149,16 @@
</div> </div>
</div> </div>
<footer class="footer">
<div class="footer-content">
<span class="version">v<span id="version-number">...</span></span>
<a href="https://github.com/obsqrbtz/goose-highlighter" target="_blank" class="github-link">
<i class="fa-brands fa-github"></i>
<span>GitHub</span>
</a>
</div>
</footer>
<script type="module" src="../dist/popup/popup.js"></script> <script type="module" src="../dist/popup/popup.js"></script>
</body> </body>

View File

@@ -68,7 +68,7 @@ export class ContentScript {
} }
private setupScrollHandler(): void { private setupScrollHandler(): void {
const debouncedProcess = DOMUtils.debounce(() => this.processHighlights(), 300); const debouncedProcess = DOMUtils.debounce(() => this.processHighlights(), CONSTANTS.DEBOUNCE_DELAY);
window.addEventListener('scroll', debouncedProcess); window.addEventListener('scroll', debouncedProcess);
} }

View File

@@ -5,25 +5,31 @@ export class HighlightEngine {
private styleSheet: CSSStyleSheet | null = null; private styleSheet: CSSStyleSheet | null = null;
private wordStyleMap = new Map<string, string>(); private wordStyleMap = new Map<string, string>();
private observer: MutationObserver; private observer: MutationObserver;
private isHighlighting = false;
constructor(private onUpdate: () => void) { constructor(private onUpdate: () => void) {
this.observer = new MutationObserver(DOMUtils.debounce((mutations: MutationRecord[]) => { this.observer = new MutationObserver(DOMUtils.debounce((mutations: MutationRecord[]) => {
const hasRelevantChanges = mutations.some((mutation: MutationRecord) => { if (this.isHighlighting) return;
const hasContentChanges = mutations.some((mutation: MutationRecord) => {
if (mutation.type !== 'childList') return false;
if (mutation.target instanceof Element && mutation.target.hasAttribute('data-gh')) { if (mutation.target instanceof Element && mutation.target.hasAttribute('data-gh')) {
return false; return false;
} }
const addedNodes = Array.from(mutation.addedNodes);
const removedNodes = Array.from(mutation.removedNodes); const allNodes = [...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)];
const isOurChange = [...addedNodes, ...removedNodes].some(node => return allNodes.some(node => {
node instanceof Element && (node.hasAttribute('data-gh') || node.querySelector('[data-gh]')) if (node.nodeType === Node.TEXT_NODE) return true;
); if (node instanceof Element && !node.hasAttribute('data-gh')) return true;
return !isOurChange; return false;
});
}); });
if (hasRelevantChanges) { if (hasContentChanges) {
onUpdate(); this.onUpdate();
} }
}, 300)); }, CONSTANTS.DEBOUNCE_DELAY));
} }
private initializeStyleSheet(): void { private initializeStyleSheet(): void {
@@ -109,6 +115,9 @@ export class HighlightEngine {
} }
highlight(lists: HighlightList[], matchCase: boolean, matchWhole: boolean): void { highlight(lists: HighlightList[], matchCase: boolean, matchWhole: boolean): void {
if (this.isHighlighting) return;
this.isHighlighting = true;
this.observer.disconnect(); this.observer.disconnect();
this.clearHighlightsInternal(); this.clearHighlightsInternal();
@@ -116,6 +125,7 @@ export class HighlightEngine {
const activeWords = this.extractActiveWords(lists); const activeWords = this.extractActiveWords(lists);
if (activeWords.length === 0) { if (activeWords.length === 0) {
this.startObserving(); this.startObserving();
this.isHighlighting = false;
return; return;
} }
@@ -155,6 +165,7 @@ export class HighlightEngine {
} }
this.startObserving(); this.startObserving();
this.isHighlighting = false;
} }
private clearHighlightsInternal(): void { private clearHighlightsInternal(): void {
@@ -182,8 +193,6 @@ export class HighlightEngine {
this.observer.observe(document.body, { this.observer.observe(document.body, {
childList: true, childList: true,
subtree: true, subtree: true,
characterData: true,
// Don't observe attribute changes to avoid triggering on our own style changes
attributes: false attributes: false
}); });
} }

View File

@@ -15,8 +15,17 @@ function localizePage(): void {
}); });
} }
function displayVersion(): void {
const manifest = chrome.runtime.getManifest();
const versionElement = document.getElementById('version-number');
if (versionElement && manifest.version) {
versionElement.textContent = manifest.version;
}
}
document.addEventListener('DOMContentLoaded', async () => { document.addEventListener('DOMContentLoaded', async () => {
localizePage(); localizePage();
displayVersion();
const controller = new PopupController(); const controller = new PopupController();
await controller.initialize(); await controller.initialize();
}); });