forked from ansh/jiffyreader.com
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: ability to enable and disable elements on a page like buttons, …
…links, ... etc
- Loading branch information
1 parent
d288153
commit 3109944
Showing
11 changed files
with
146 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import defaultPrefs from '~services/preferences'; | ||
import usePrefs from '~services/usePrefs'; | ||
import { useGetTabOriginCb } from './useGetTabOriginCb'; | ||
|
||
export function HtmlNodeToggles() { | ||
const [prefs, , updateConfig] = usePrefs(useGetTabOriginCb(), false); | ||
const _label = chrome.i18n.getMessage('symanticElementsLabel'); | ||
|
||
if (!prefs) return <></>; | ||
|
||
return ( | ||
<div className=" flex flex-column || gap-2 || w-100 p-2"> | ||
<label className="block text-capitalize mb-sm" id="symanticElementsLabel"> | ||
{_label?.length ? _label : 'Enabled Items'} | ||
</label> | ||
|
||
<div className="|| || w-100 gap-1" style={{ display: 'grid', gridTemplateColumns: 'repeat(3,1fr)' }}> | ||
{Object.entries({ ...defaultPrefs.symanticTags, ...prefs.symanticTags }).map(([key, value]) => ( | ||
<div key={key} className="input-container flex"> | ||
<input | ||
type="checkbox" | ||
id={`symanticTags-${key}`} | ||
checked={value} | ||
onChange={(event) => updateConfig(`symanticTags`, { ...prefs.symanticTags, [key]: event.target.checked })} | ||
/> | ||
<label htmlFor={`symanticTags-${key}`}>{key ?? chrome.i18n.getMessage(`symanticTags_${key}`)}</label> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { useCallback } from 'react'; | ||
import TabHelper from '~services/TabHelper'; | ||
|
||
export const useGetTabOriginCb = () => useCallback(async () => await TabHelper.getTabOrigin(await TabHelper.getActiveTab(true)), [TabHelper]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters