Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: toolbar not appearing when generation AI is enabled. #900

Merged
merged 1 commit into from
Sep 16, 2023
Merged
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
35 changes: 15 additions & 20 deletions apps/content_script/appbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ function showBlockedByBannedWords(): void {
rows: 10,
});

const topStuff = document.getElementById("topstuff") as HTMLDivElement;
topStuff.appendChild(textarea);
$.insertBefore(textarea, topStuff);
const bannedWordsDiv = document.getElementById(
"banned-words-div",
) as HTMLDivElement;
bannedWordsDiv.appendChild(textarea);
}

async function appendTemporarilyUnblockAllAnchor(
Expand Down Expand Up @@ -72,25 +73,19 @@ async function appendShowBlockedByWordInfoAnchor(
}

async function createAppbarLinks(): Promise<void> {
const resultStats = document.getElementById("result-stats");
if (resultStats !== null) {
const resultStatsIsHidden =
getComputedStyle(resultStats.parentElement!).opacity === "0";
if (!resultStatsIsHidden) {
await appendTemporarilyUnblockAllAnchor(resultStats);
await appendShowBlockedByWordInfoAnchor(resultStats);
const topStuff = document.getElementById("topstuff");
if (topStuff !== null) {
const gsbToolbar = $.div();
gsbToolbar.setAttribute("id", "gsb-toolbar");

return;
}
}
await appendTemporarilyUnblockAllAnchor(topStuff);
await appendShowBlockedByWordInfoAnchor(topStuff);
const bannedWordsDiv = $.div();
bannedWordsDiv.setAttribute("id", "banned-words-div");
gsbToolbar.appendChild(bannedWordsDiv);

const menu = document.getElementById("hdtbMenus");
if (menu !== null && menu.style.display !== "none") {
const toolDiv = menu.querySelector("#tn_1");
if (toolDiv !== null) {
await appendTemporarilyUnblockAllAnchor(toolDiv);
await appendShowBlockedByWordInfoAnchor(toolDiv);
}
// insert gsbToolbar after topStuff
topStuff.parentElement!.insertBefore(gsbToolbar, topStuff.nextSibling);
}
}

Expand Down
1 change: 1 addition & 0 deletions public/css/google.css
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ div[role="listitem"] {

.gsb-anchor {
cursor: pointer;
font-size: 14px;
}

.gsb-compact-menu-block-anchor {
Expand Down