Skip to content

Commit

Permalink
fix: inject addon action failed in forwarded messages window, fix #35
Browse files Browse the repository at this point in the history
  • Loading branch information
wibus-wee committed Aug 26, 2023
1 parent e4d7a34 commit d49f9be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { Functions } from "./functions";
import { createConsole, createConsoleGroup, getRoomsPanelWidth } from "./utils";

function init() {
if (!getRoomsPanelWidth()) {
// #app > .vac-col-messages 是用于判断是否在「转发聊天页面」页面
if (!getRoomsPanelWidth() && !document.querySelector("#app > .vac-col-messages")) {
setTimeout(init, 1000);
createConsole("ADDON", "rooms-panel not found, try again after 1s");
return;
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ export function getRootStyle(key: any) {
}

export function getRoomsPanelWidth() {
return (document.getElementsByClassName("rooms-panel")[0] as HTMLElement)
.style.width;
return (document.getElementsByClassName("rooms-panel")[0] as HTMLElement || undefined)
?.style.width;
}

export function createConsole(code: string, desc: string) {
Expand Down

0 comments on commit d49f9be

Please sign in to comment.