Skip to content

Commit

Permalink
Improve input fill logic
Browse files Browse the repository at this point in the history
  • Loading branch information
perry-mitchell committed Apr 7, 2024
1 parent fc5c18d commit fc8334a
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 18 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@blueprintjs/popover2": "^1.14.11",
"@blueprintjs/select": "^4.9.24",
"@buttercup/channel-queue": "^1.4.0",
"@buttercup/locust": "^2.2.1",
"@buttercup/locust": "^2.3.1",
"@buttercup/ui": "^6.2.2",
"@types/chrome": "^0.0.251",
"@types/ms": "^0.7.34",
Expand Down
2 changes: 1 addition & 1 deletion source/shared/library/version.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Do not edit this file - it is generated automatically at build time

export const BUILD_DATE = "2024-04-02";
export const BUILD_DATE = "2024-04-06";
export const VERSION = "3.1.0";
11 changes: 9 additions & 2 deletions source/tab/services/formDetection.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LoginTarget, getLoginTargets } from "@buttercup/locust";
import { LoginTarget, LoginTargetFeature, getLoginTargets } from "@buttercup/locust";
import { attachLaunchButton } from "../ui/launch.js";
import { watchCredentialsOnTarget } from "./logins/watcher.js";
import { processTargetAutoLogin } from "./autoLogin.js";
Expand All @@ -7,10 +7,17 @@ import { getConfig } from "./config.js";

const TARGET_SEARCH_INTERVAL = 1000;

function filterLoginTarget(_: LoginTargetFeature, element: HTMLElement): boolean {
if (element.dataset.bcup === "attached") {
return false;
}
return true;
}

function onIdentifiedTarget(callback: (target: LoginTarget) => void) {
const locatedForms = [];
const findTargets = () => {
getLoginTargets()
getLoginTargets(document, filterLoginTarget)
.filter((target) => locatedForms.includes(target.form) === false)
.forEach((target) => {
locatedForms.push(target.form);
Expand Down
9 changes: 2 additions & 7 deletions source/tab/ui/launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,13 @@ export function attachLaunchButton(
if (buttonType === InputButtonType.LargeButton) {
renderButtonStyle(input, () => onClick(input), tryToAttach, bounds);
} else if (buttonType === InputButtonType.InnerIcon) {
renderInternalStyle(input, () => onClick(input), tryToAttach, bounds);
renderInternalStyle(input, () => onClick(input), bounds);
}
};
tryToAttach();
}

function renderInternalStyle(
input: HTMLInputElement,
onClick: () => void,
reattachCB: () => void,
inputBounds: DOMRect
) {
function renderInternalStyle(input: HTMLInputElement, onClick: () => void, inputBounds: DOMRect) {
const bounds = inputBounds || input.getBoundingClientRect();
const { height } = bounds;
const imageSize = height * 0.6;
Expand Down

0 comments on commit fc8334a

Please sign in to comment.