Skip to content

Commit

Permalink
feat(Root): button to force the gemini code snippet generation if for…
Browse files Browse the repository at this point in the history
… some reason the code snippet has not been successfully generated
  • Loading branch information
itssimmons committed Sep 14, 2024
1 parent 8b89417 commit cfb9175
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ext-chrome/src/contentScripts/googleSearch/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,11 @@
margin-top: 15px;
margin-bottom: 25px;
}

.gem_HoverSpin {
width: 44px !important;
transition: transform 500ms ease-in-out;
}
.gem_HoverSpin:hover {
transform: rotate3d(0, 1, 0, 180deg);
}
24 changes: 24 additions & 0 deletions ext-chrome/src/contentScripts/googleSearch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,27 @@ if (isAllTopicSelected) {
// @ts-ignore
genCodeSnippet({ root });
}

const setupForceButton = () => {
const eraseIcon = document.querySelector<HTMLDivElement>('.BKRPef');
const forceButton = document.createElement('button');

forceButton.setAttribute('title', 'Generate Code Snippet');
forceButton.classList.add('XDyW0e', 'gem_HoverSpin');
forceButton.innerHTML = /*html*/ `<svg width="44" height="44" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M11 6.72168C11.9704 8.53645 13.4635 10.0296 15.2783 11C13.4635 11.9704 11.9704 13.4635 11 15.2783C10.0296 13.4635 8.53643 11.9704 6.72166 11C8.53643 10.0296 10.0296 8.53645 11 6.72168Z"
stroke="#C4C7C5" stroke-width="2.44444" />
</svg>`;

forceButton.onclick = (ev) => {
ev.preventDefault();
ev.stopPropagation();
// @ts-ignore
genCodeSnippet({ root });
};

eraseIcon.insertAdjacentElement('afterend', forceButton);
};

setupForceButton();

0 comments on commit cfb9175

Please sign in to comment.