Skip to content

Commit

Permalink
Merge pull request #112 from ator-dev/storage-replace
Browse files Browse the repository at this point in the history
Replace storage model, extend built pages, add theming
  • Loading branch information
ator-dev authored May 21, 2024
2 parents 726228f + 7585c76 commit 2455208
Show file tree
Hide file tree
Showing 17 changed files with 2,466 additions and 788 deletions.
2 changes: 1 addition & 1 deletion manifest/chromium.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
],

"options_ui": {
"page": "/pages/options.html",
"page": "/pages/options.html?frame",
"browser_style": false
},

Expand Down
2 changes: 1 addition & 1 deletion manifest/firefox.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
],

"options_ui": {
"page": "/pages/options.html",
"page": "/pages/options.html?frame",
"browser_style": false
},

Expand Down
2 changes: 0 additions & 2 deletions pages/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
</head>
<body>
<script src="/dist/include/utility.js"></script>
<script src="/dist/include/pattern-stem.js"></script>
<script src="/dist/include/pattern-diacritic.js"></script>
<script src="/dist/include/util-privileged.js"></script>
<script src="/dist/include/storage.js"></script>
<script src="/dist/pages/options.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion pages/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<script src="/dist/include/storage.js"></script>
<script src="/lib/email.min.js"></script>
<script src="/dist/include/page-build.js"></script>
<script src="/dist/pages/popup-build.js"></script>
<script src="/dist/pages/popup.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion pages/sendoff.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<script src="/dist/include/storage.js"></script>
<script src="/lib/email.min.js"></script>
<script src="/dist/include/page-build.js"></script>
<script src="/dist/pages/sendoff-build.js"></script>
<script src="/dist/pages/sendoff.js"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion pages/startpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<script src="/dist/include/storage.js"></script>
<script src="/lib/email.min.js"></script>
<script src="/dist/include/page-build.js"></script>
<script src="/dist/pages/startpage-build.js"></script>
<script src="/dist/pages/startpage.js"></script>
<script src="/dist/content.js"></script>
</body>
</html>
225 changes: 105 additions & 120 deletions src/background.ts

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ interface ControlsInfo {
highlightsShown: boolean
barCollapsed: boolean
termsOnHold: MatchTerms
[StorageSync.BAR_CONTROLS_SHOWN]: StorageSyncValues[StorageSync.BAR_CONTROLS_SHOWN]
[StorageSync.BAR_LOOK]: StorageSyncValues[StorageSync.BAR_LOOK]
barControlsShown: ConfigBarControlsShown
barLook: ConfigBarLook
matchMode: MatchMode
}

Expand Down Expand Up @@ -209,7 +209,7 @@ const fillStylesheetContent = (terms: MatchTerms, hues: TermHues, controlsInfo:
&.${EleClass.MATCH_REGEX} .${EleClass.CONTROL_CONTENT} {
font-weight: bold;
}
&.${EleClass.MATCH_DIACRITICS} .${EleClass.CONTROL_CONTENT} {
&:not(.${EleClass.MATCH_DIACRITICS}) .${EleClass.CONTROL_CONTENT} {
font-style: italic;
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@ const fillStylesheetContent = (terms: MatchTerms, hues: TermHues, controlsInfo:
&:not(.${EleClass.MATCH_STEM}) .${EleClass.CONTROL_CONTENT} {
border-bottom: 3px solid hsl(0 0% 38%);
}
&.${EleClass.MATCH_DIACRITICS} .${EleClass.CONTROL_CONTENT} {
&:not(.${EleClass.MATCH_DIACRITICS}) .${EleClass.CONTROL_CONTENT} {
border-left: 3px dashed black;
}
}
Expand Down Expand Up @@ -549,7 +549,7 @@ Methods for inserting, updating, or removing parts of the toolbar, as well as dr

// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Toolbar {
export type ControlButtonName = keyof StorageSyncValues[StorageSync.BAR_CONTROLS_SHOWN]
export type ControlButtonName = keyof ConfigValues["barControlsShown"]
type ControlButtonInfo = {
controlClasses?: Array<EleClass>
buttonClasses?: Array<EleClass>
Expand Down Expand Up @@ -990,7 +990,7 @@ namespace Toolbar {
{ matchType: "case", title: "Case Sensitive" },
{ matchType: "whole", title: "Whole Word" },
{ matchType: "stem", title: "Stem Word" },
{ matchType: "diacritics", title: "Diacritics" },
{ matchType: "diacritics", title: "Diacritics Sensitive" },
{ matchType: "regex", title: "Regex Mode" },
];
return options.map(({ matchType, title }) => {
Expand Down Expand Up @@ -3972,13 +3972,13 @@ const getTermsFromSelection = () => {
if (message.getDetails) {
sendResponse(getDetails(message.getDetails));
}
if (message.setHighlighter !== undefined) {
if (message.highlighter !== undefined) {
highlighter.current.endHighlighting();
if (message.setHighlighter.engine === Engine.HIGHLIGHT && compatibility.highlight.highlightEngine) {
if (message.highlighter.engine === Engine.HIGHLIGHT && compatibility.highlight.highlightEngine) {
highlighter.current = new DummyEngine();
} else if (message.setHighlighter.engine === Engine.PAINT) {
} else if (message.highlighter.engine === Engine.PAINT) {
highlighter.current = new PaintEngine(terms, highlightTags, termCountCheck,
message.setHighlighter.paintEngineMethod ?? PaintEngineMethod.PAINT);
message.highlighter.paintEngine.method ?? PaintEngineMethod.PAINT);
} else {
highlighter.current = new ElementEngine(terms, highlightTags, termCountCheck);
}
Expand All @@ -4000,9 +4000,9 @@ const getTermsFromSelection = () => {
Object.entries(message.barLook ?? {}).forEach(([ key, value ]) => {
controlsInfo.barLook[key] = value;
});
if (message.highlightMethod) {
if (message.highlightLook) {
hues.splice(0);
message.highlightMethod.hues.forEach(hue => hues.push(hue));
message.highlightLook.hues.forEach(hue => hues.push(hue));
}
if (message.matchMode) {
Object.assign(controlsInfo.matchMode, message.matchMode);
Expand Down
Loading

0 comments on commit 2455208

Please sign in to comment.