activity: pseudo links work on click
This commit is contained in:
+16
-1
@@ -261,6 +261,8 @@ class DOMInvite implements Invite {
|
||||
}
|
||||
}
|
||||
|
||||
focus = () => this._container.scrollIntoView({ behavior: "smooth", block: "center" });
|
||||
|
||||
constructor(invite: Invite) {
|
||||
// first create the invite structure, then use our setter methods to fill in the data.
|
||||
this._container = document.createElement('div') as HTMLDivElement;
|
||||
@@ -423,6 +425,16 @@ export class inviteList implements inviteList {
|
||||
|
||||
invites: { [code: string]: DOMInvite };
|
||||
|
||||
public static readonly _inviteURLEvent = "invite-url";
|
||||
registerURLListener = () => document.addEventListener(inviteList._inviteURLEvent, (event: CustomEvent) => {
|
||||
const inviteCode = event.detail;
|
||||
for (let code of Object.keys(this.invites)) {
|
||||
this.invites[code].expanded = code == inviteCode;
|
||||
}
|
||||
if (inviteCode in this.invites) this.invites[inviteCode].focus();
|
||||
else window.notifications.customError("inviteDoesntExistError", window.lang.notif("errorInviteDoesntExist"));
|
||||
})
|
||||
|
||||
constructor() {
|
||||
this._list = document.getElementById('invites') as HTMLDivElement;
|
||||
this.empty = true;
|
||||
@@ -436,6 +448,8 @@ export class inviteList implements inviteList {
|
||||
this.empty = true;
|
||||
}
|
||||
}, false);
|
||||
|
||||
this.registerURLListener();
|
||||
}
|
||||
|
||||
get empty(): boolean { return this._empty; }
|
||||
@@ -500,7 +514,8 @@ export class inviteList implements inviteList {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export const inviteURLEvent = (id: string) => { return new CustomEvent(inviteList._inviteURLEvent, {"detail": id}) };
|
||||
|
||||
function parseInvite(invite: { [f: string]: string | number | { [name: string]: number } | boolean }): Invite {
|
||||
let parsed: Invite = {};
|
||||
|
||||
Reference in New Issue
Block a user