Skip to content

Commit

Permalink
Merge pull request #47 from horihiro/bump-0.2.0
Browse files Browse the repository at this point in the history
Bump 0.2.0
  • Loading branch information
horihiro authored Apr 18, 2024
2 parents 1704c6f + 5e62561 commit 2292139
Show file tree
Hide file tree
Showing 11 changed files with 724 additions and 382 deletions.
37 changes: 37 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Third-Party Notices

## jsdiff
** Source **: [https://github.com/kpdecker/jsdiff](https://github.com/kpdecker/jsdiff)
kpdecker/jsdiff 5.2.0 BSD 3-Clause License

### License

```
Copyright (c) 2009-2015, Kevin Decker <[email protected]>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
```
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,23 @@ https://github.com/horihiro/TextBlurrer-ChromeExtension/assets/4566555/6f3753dd-
## Blur value in `input` tag (experimental, v0.1.3 or later)
https://github.com/horihiro/TextBlurrer-ChromeExtension/assets/4566555/27f2c3b1-ecf0-4a1f-88df-2f6e2b948f06

## Exclusion URL list (v0.2.0 or later)
If you want NOT to blur keywords in specific sites/frames, you can specify URLs of the site in the `Exclusion URL patterns` tab.

![image](https://github.com/horihiro/TextBlurrer-ChromeExtension/assets/4566555/7b38cd45-66dd-4021-96a8-e67180e8cc4f)

You can add URLs on the current tab to the list by clicking `+ Add URLs in the current tab` on the popup.

## Context menu for adding keyword (v0.2.0 or later)

Simple way to add the blurry keyword.

![image](https://github.com/horihiro/TextBlurrer-ChromeExtension/assets/4566555/a1182e7f-5462-493b-b561-618863d29fc9)

## Shortcut keys on popup (v0.2.0 or later)

- <kbd>Ctrl</kbd> / <kbd>⌘</kbd> + <kbd>s</kbd>: applying keywords/url patterns change (i.e. pressing `Apply` button)
- <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>f</kbd>: removing empty lines in active textarea

## Mask value in title (experimental, v0.1.9 or later)
https://github.com/horihiro/TextBlurrer-ChromeExtension/assets/4566555/25c24d50-b478-4e63-9388-20b391046fc6
Expand All @@ -40,8 +57,27 @@ If you can try a development version, the following steps are needed.
![image](https://github.com/horihiro/TextBlurrer-ChromeExtension/assets/4566555/44e7f896-9e82-4af1-ae1b-f864097b44c7)
1. select the directory created by cloning at step 1.

# Dependencies
- **[jsdiff](https://github.com/kpdecker/jsdiff)**: A JavaScript text differencing implementation (BSD 3-Clause License).

# Change logs

## [0.2.0](https://github.com/horihiro/TextBlurrer-ChromeExtension/releases/tag/0.2.0)

Refactoring blurring logic to improve performance and maintainability.
From this version, this extension includes [jsdiff](https://github.com/kpdecker/jsdiff)

- New features
- Disable blurring on listed sites on [Exclusion URL pattern list](#exclusion-url-list-v020-or-later)
- Add [Context Menu for adding the blurry keywords](#context-menu-for-adding-keyword-v020-or-later)
- Add shortcut keys on popup :
- <kbd>Ctrl</kbd> / <kbd>⌘</kbd> + <kbd>s</kbd>: applying keywords/url patterns change
- <kbd>Shift</kbd> + <kbd>Alt</kbd> + <kbd>f</kbd>: removing empty lines in active textarea
- Bug fixes
- Improve title masking ([#38](https://github.com/horihiro/TextBlurrer-ChromeExtension/issues/38), [#39](https://github.com/horihiro/TextBlurrer-ChromeExtension/issues/39))
- Improve unblurring on updating text node by javascript ([#40](https://github.com/horihiro/TextBlurrer-ChromeExtension/issues/40))
- Improve inputting keywords using RegExp assersions ([#41](https://github.com/horihiro/TextBlurrer-ChromeExtension/issues/31))

## [0.1.9](https://github.com/horihiro/TextBlurrer-ChromeExtension/releases/tag/0.1.9)

- New features
Expand Down Expand Up @@ -123,3 +159,4 @@ First release on [Chrome Web Store](https://chrome.google.com/webstore/detail/te
## [0.0.1-alpha](https://github.com/horihiro/TextBlurrer-ChromeExtension/releases/tag/0.0.1)

First release on GitHub

51 changes: 18 additions & 33 deletions background/service-worker.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
// console.log('Start service-worker.js');
import { escapeRegExp } from '../util/common.js';

// chrome.runtime.onConnect.addListener((port) => {
// if (port.name !== 'updateKeywords') return;
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
id: 'add_keyword',
title: 'Add this as blurry keyword',
contexts: ['selection']
});
});

// chrome.storage.onChanged.addListener(async (changes, area) => {
// if (area !== 'local' || !changes.keywords && !changes.status) return;

// try {
// port.postMessage({
// keywords: changes.keywords?.newValue || undefined,
// status: changes.status?.newValue || undefined
// });
// } catch (e) {
// console.error(e);
// }
// });
// });

// chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
// if (!sender.tab || request.request !== "getKeywordsToBeBlurred") return;

// chrome.storage.local.get(["keywords"], (k) => {
// chrome.storage.local.get(["status"], (s) => {
// sendResponse({ keywords: k.keywords, status: s.status });
// });
// });
// return true;
// });

// // Workaround for keeping service worker active
// // `Bug exploit` in https://stackoverflow.com/questions/66618136/persistent-service-worker-in-chrome-extension#answer-66618269
// const keepAlive = () => setInterval(chrome.runtime.getPlatformInfo, 20e3);
// chrome.runtime.onStartup.addListener(keepAlive);
// keepAlive();
chrome.contextMenus.onClicked.addListener(async(info, tab) => {
if (info.menuItemId === 'add_keyword') {
const keywords = (await chrome.storage.local.get(['keywords'])).keywords?.split(/\n/) || [];
(keywords.length === 1 && keywords[0] === '') && keywords.pop();
const addingKeyword = (await chrome.storage.local.get(['mode']))?.mode === 'regexp' ? escapeRegExp(info.selectionText) : info.selectionText;
!keywords.includes(addingKeyword) && keywords.push(addingKeyword);
await chrome.storage.local.set({ 'keywords': keywords.join('\n') });
chrome.runtime.sendMessage({ method: 'reload' });
}
});
1 change: 1 addition & 0 deletions content/js/diff.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 2292139

Please sign in to comment.