(
+ 'button[name="topic-actions-ignore"][data-ic-delete-from]',
+ );
+ this.setState({
+ isRunning: true,
+ remaining: unignoreButtons.length,
+ total: unignoreButtons.length,
+ });
+ void this.unignoreAll(unignoreButtons);
+ };
+
+ unignoreAll = async (buttons: HTMLButtonElement[]) => {
+ let remaining = buttons.length;
+ for (const ignoreButton of buttons) {
+ // Stop the loop if the user canceled it.
+ if (!this.state.isRunning && this.state.wasCanceled) {
+ return;
+ }
+
+ ignoreButton.click();
+ remaining--;
+ this.setState({remaining});
+ await sleep(250);
+ }
+
+ this.setState({isRunning: false});
+ };
+
+ render() {
+ const {isRunning, remaining, total, wasCanceled} = this.state;
+ let text = "Unignore All";
+
+ if (isRunning) {
+ // When we're running show how many topics are remaining.
+ text = `Unignoring topics, ${remaining} out of ${total} remaining`;
+ } else if (wasCanceled) {
+ // If the user canceled, say that.
+ text = "Canceled unignoring all topics";
+ }
+
+ return (
+
+ );
+ }
+}
diff --git a/source/content-scripts/setup.tsx b/source/content-scripts/setup.tsx
index 164b3be..51a1370 100644
--- a/source/content-scripts/setup.tsx
+++ b/source/content-scripts/setup.tsx
@@ -24,6 +24,7 @@ import {
runMarkdownToolbarFeature,
runThemedLogoFeature,
runTopicInfoIgnore,
+ runUnignoreAllButtonFeature,
runUsernameColorsFeature,
} from "./features/exports.js";
@@ -176,6 +177,13 @@ async function initialize() {
runTopicInfoIgnore();
}
+ if (
+ miscEnabled.value.has(MiscellaneousFeature.UnignoreAllButton) &&
+ isLoggedIn
+ ) {
+ runUnignoreAllButtonFeature();
+ }
+
// Insert a placeholder at the end of the body first, then render the rest
// and use that as the replacement element. Otherwise render() would put it
// at the beginning of the body which causes a bunch of different issues.
diff --git a/source/options/components/miscellaneous.tsx b/source/options/components/miscellaneous.tsx
index 22bbd89..71dbd7c 100644
--- a/source/options/components/miscellaneous.tsx
+++ b/source/options/components/miscellaneous.tsx
@@ -42,6 +42,14 @@ function FeatureDescription({
);
}
+ if (feature === MiscellaneousFeature.UnignoreAllButton) {
+ return (
+
+ Add an "Unignore All" button to your list of ignored topics.
+
+ );
+ }
+
return <>>;
}
diff --git a/source/storage/enums.ts b/source/storage/enums.ts
index 1f541fc..aaf6e77 100644
--- a/source/storage/enums.ts
+++ b/source/storage/enums.ts
@@ -23,6 +23,7 @@ export enum MiscellaneousFeature {
CommentAnchorFix = "comment-anchor-fix",
GroupListSubscribeButtons = "group-list-subscribe-buttons",
TopicInfoIgnore = "topic-info-ignore",
+ UnignoreAllButton = "unignore-all-button",
}
/**