Add a miscellaneous feature for hiding your own username.
This commit is contained in:
parent
01d882989b
commit
ee768cfd41
|
@ -7,6 +7,7 @@ export * from "./jump-to-new-comment.js";
|
||||||
export * from "./markdown-toolbar.js";
|
export * from "./markdown-toolbar.js";
|
||||||
export * from "./miscellaneous/comment-anchor-fix.js";
|
export * from "./miscellaneous/comment-anchor-fix.js";
|
||||||
export * from "./miscellaneous/group-list-subscribe-button.js";
|
export * from "./miscellaneous/group-list-subscribe-button.js";
|
||||||
|
export * from "./miscellaneous/hide-own-username.js";
|
||||||
export * from "./miscellaneous/topic-info-ignore.js";
|
export * from "./miscellaneous/topic-info-ignore.js";
|
||||||
export * from "./miscellaneous/unignore-all-button.js";
|
export * from "./miscellaneous/unignore-all-button.js";
|
||||||
export * from "./themed-logo.js";
|
export * from "./themed-logo.js";
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import {log, querySelector} from "../../../utilities/exports.js";
|
||||||
|
|
||||||
|
export function runHideOwnUsernameFeature(): void {
|
||||||
|
hideOwnUsername();
|
||||||
|
log("Username has been hidden.");
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideOwnUsername(): void {
|
||||||
|
const loggedInUsername = querySelector<HTMLElement>(
|
||||||
|
".logged-in-user-username",
|
||||||
|
);
|
||||||
|
|
||||||
|
loggedInUsername.dataset.trxHideOwnUsername = loggedInUsername.textContent!;
|
||||||
|
loggedInUsername.textContent = "Username";
|
||||||
|
}
|
|
@ -19,6 +19,7 @@ import {
|
||||||
runAnonymizeUsernamesFeature,
|
runAnonymizeUsernamesFeature,
|
||||||
runCommentAnchorFixFeature,
|
runCommentAnchorFixFeature,
|
||||||
runGroupListSubscribeButtonFeature,
|
runGroupListSubscribeButtonFeature,
|
||||||
|
runHideOwnUsernameFeature,
|
||||||
runHideTopicsFeature,
|
runHideTopicsFeature,
|
||||||
runHideVotesFeature,
|
runHideVotesFeature,
|
||||||
runMarkdownToolbarFeature,
|
runMarkdownToolbarFeature,
|
||||||
|
@ -173,6 +174,13 @@ async function initialize() {
|
||||||
runGroupListSubscribeButtonFeature();
|
runGroupListSubscribeButtonFeature();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
miscEnabled.value.has(MiscellaneousFeature.HideOwnUsername) &&
|
||||||
|
isLoggedIn
|
||||||
|
) {
|
||||||
|
runHideOwnUsernameFeature();
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
miscEnabled.value.has(MiscellaneousFeature.TopicInfoIgnore) &&
|
miscEnabled.value.has(MiscellaneousFeature.TopicInfoIgnore) &&
|
||||||
isLoggedIn
|
isLoggedIn
|
||||||
|
|
|
@ -33,6 +33,12 @@ function FeatureDescription({
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (feature === MiscellaneousFeature.HideOwnUsername) {
|
||||||
|
return (
|
||||||
|
<p class="description">Hide your username for more private browsing.</p>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (feature === MiscellaneousFeature.TopicInfoIgnore) {
|
if (feature === MiscellaneousFeature.TopicInfoIgnore) {
|
||||||
return (
|
return (
|
||||||
<p class="description">
|
<p class="description">
|
||||||
|
|
|
@ -22,6 +22,7 @@ export enum Feature {
|
||||||
export enum MiscellaneousFeature {
|
export enum MiscellaneousFeature {
|
||||||
CommentAnchorFix = "comment-anchor-fix",
|
CommentAnchorFix = "comment-anchor-fix",
|
||||||
GroupListSubscribeButtons = "group-list-subscribe-buttons",
|
GroupListSubscribeButtons = "group-list-subscribe-buttons",
|
||||||
|
HideOwnUsername = "hide-own-username",
|
||||||
TopicInfoIgnore = "topic-info-ignore",
|
TopicInfoIgnore = "topic-info-ignore",
|
||||||
UnignoreAllButton = "unignore-all-button",
|
UnignoreAllButton = "unignore-all-button",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue