Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "maze-utils"]
path = maze-utils
url = https://github.com/ajayyy/maze-utils
[submodule "title-formatting"]
path = title-formatting
url = https://github.com/ajayyy/DeArrowFormatting.git
7 changes: 2 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ module.exports = {
"transform": {
"^.+\\.ts$": "ts-jest"
},
"reporters": ["default", "github-actions"],
"globals": {
"LOAD_CLD": false
}
};
"reporters": ["default", "github-actions"]
};
137 changes: 0 additions & 137 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"description": "",
"main": "background.js",
"dependencies": {
"cld3-asm": "^3.1.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"seedrandom": "^3.0.5"
Expand Down
7 changes: 4 additions & 3 deletions src/config/channelOverrides.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { VideoID } from "../../maze-utils/src/video";
import { ChannelInfo, getChannelID, getChannelIDSync } from "../thumbnails/thumbnailData";
import Config, { ThumbnailFallbackAutogeneratedOption, ThumbnailFallbackOption, TitleFormatting } from "./config";
import Config, { ThumbnailFallbackAutogeneratedOption, ThumbnailFallbackOption } from "./config";
import { TitleFormatting } from "../../title-formatting/src";

export function shouldReplaceTitles(videoID: VideoID | null): Promise<boolean> {
return checkChannelOverrideOption<boolean>(videoID, "replaceTitles");
Expand Down Expand Up @@ -78,7 +79,7 @@ function checkChannelOverrideOptionBase<T>(option: string, channelInfo?: Channel
]

for (const override of overrideOptions) {
if (override && Config.config!.customConfigurations[override]
if (override && Config.config!.customConfigurations[override]
&& Config.config!.customConfigurations[override][option] !== null
&& Config.config!.customConfigurations[override][option] !== undefined) {
return Config.config!.customConfigurations[override][option];
Expand Down Expand Up @@ -110,4 +111,4 @@ function fastChannelOverrideOption<T>(videoID: VideoID | null, option: string):
}

return mainValue;
}
}
14 changes: 3 additions & 11 deletions src/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Keybind, ProtoConfig } from "../../maze-utils/src/config";
import { VideoID } from "../../maze-utils/src/video";
import { TitleFormatting } from '../../title-formatting/src';
import { ThumbnailSubmission } from "../thumbnails/thumbnailData";
import { logError } from "../utils/logger";
import * as CompileConfig from "../../config.json";
Expand All @@ -22,15 +23,6 @@ export interface UnsubmittedSubmission {
titles: UnsubmittedTitleSubmission[];
}

export enum TitleFormatting {
Disable = -1,
CapitalizeWords,
TitleCase,
SentenceCase,
LowerCase,
FirstLetterUppercase
}

export enum ThumbnailCacheOption {
Disable,
OnAllPagesExceptWatch,
Expand Down Expand Up @@ -149,7 +141,7 @@ class ConfigClass extends ProtoConfig<SBConfig, SBStorage> {

// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
function migrateOldSyncFormats(config: SBConfig) {

}

const syncDefaults = {
Expand Down Expand Up @@ -214,4 +206,4 @@ const localDefaults = {
};

const Config = new ConfigClass(syncDefaults, localDefaults, migrateOldSyncFormats, true);
export default Config;
export default Config;
6 changes: 3 additions & 3 deletions src/license/LicenseComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from "react";
import { getLicenseKey } from "./license";
import { FormattedText } from "../popup/FormattedTextComponent";
import { TitleFormatting } from "../config/config";
import { TitleFormatting } from "../../title-formatting/src";

interface LicenseComponentProps {
titleFormatting?: TitleFormatting;
Expand Down Expand Up @@ -46,7 +46,7 @@ export const LicenseComponent = ({ titleFormatting }: LicenseComponentProps) =>
</div>
</>
}

</div>
);
};
};
20 changes: 10 additions & 10 deletions src/options/ChannelOverridesComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { SelectOptionComponent } from "../popup/SelectOptionComponent";
import Config, { ConfigurationID, CustomConfiguration, ThumbnailFallbackOption } from "../config/config";
import { generateUserID } from "../../maze-utils/src/setup";
import { ToggleOptionComponent } from "../popup/ToggleOptionComponent";
import { toFirstLetterUppercase, toLowerCaseTitle, toSentenceCase } from "../titles/titleFormatter";
import { toFirstLetterUppercase, toLowerCaseTitle, toSentenceCase } from "../../title-formatting/src/formatters";

let forceUpdateConfigurationsTimeout: NodeJS.Timeout | null = null;
let forceUpdateOverridesTimeout: NodeJS.Timeout | null = null;
Expand Down Expand Up @@ -72,7 +72,7 @@ export const ChannelOverridesComponent = () => {
}))}
/>

<div
<div
className="option-button trigger-button"
onClick={() => {
const newID = generateUserID();
Expand Down Expand Up @@ -103,7 +103,7 @@ export const ChannelOverridesComponent = () => {
{
selectedConfigurationID != null &&
<>
<input
<input
type="text"
id="configurationName"
value={configurationName}
Expand All @@ -120,10 +120,10 @@ export const ChannelOverridesComponent = () => {
<div>
{chrome.i18n.getMessage("ChannelListInstructions")}
</div>
<textarea
className="option-text-box"
rows={10}

<textarea
className="option-text-box"
rows={10}
value={channelListText}
onChange={(e) => {
const newText = e.target.value;
Expand Down Expand Up @@ -193,7 +193,7 @@ export const ChannelOverridesComponent = () => {
}}
value={getValueWithDefault(useCrowdsourcedTitles, "useCrowdsourcedTitles")}
label={chrome.i18n.getMessage("useCrowdsourcedTitles")}
className={getClassNames(useCrowdsourcedTitles)
className={getClassNames(useCrowdsourcedTitles)
+ (!getValueWithDefault(replaceTitles, "replaceTitles") ? " hiding" : "")
+ (hideUseCrowdsourcedTitles ? " hidden" : "")}
showResetButton={shouldShowResetButton(useCrowdsourcedTitles)}
Expand Down Expand Up @@ -292,7 +292,7 @@ export const ChannelOverridesComponent = () => {
/>
}

<div
<div
className="option-button trigger-button"
onClick={() => {
if (confirm(chrome.i18n.getMessage("areYouSureDeleteConfig"))) {
Expand Down Expand Up @@ -380,4 +380,4 @@ function updateChannelList(setChannelListText: (value: string) => void, selected
setChannelListText(Object.entries(Config.config!.channelOverrides)
.filter(([, id]) => id === selectedConfigurationID)
.map(([channelID]) => channelID).join("\n"))
}
}
Loading