Skip to content
Closed
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
2 changes: 1 addition & 1 deletion latest_release.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"state": "uploaded",
"size": 79222,
"digest": "sha256:e0cad96e20e539d62a4777f1c5baedb1c8bd02cd26a8e38f7c1b9c804325f068",
"download_count": 6,
"download_count": 8,
"created_at": "2026-01-19T05:09:41Z",
"updated_at": "2026-01-19T05:09:41Z",
"browser_download_url": "https://github.com/SentienceAPI/Sentience-Geometry-Chrome-Extension/releases/download/v2.7.0/extension-files.tar.gz"
Expand Down
8 changes: 4 additions & 4 deletions sentience/extension/background.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import init, { analyze_page_with_options, analyze_page, prune_for_api } from "./pkg/sentience_core.js";
import init, { analyze_page_with_options, analyze_page, prune_for_api } from "../pkg/sentience_core.js";

let wasmReady = !1, wasmInitPromise = null;

Expand Down Expand Up @@ -28,14 +28,14 @@ async function handleSnapshotProcessing(rawData, options = {}) {
const startTime = performance.now();
try {
if (!Array.isArray(rawData)) throw new Error("rawData must be an array");
if (rawData.length > 1e4 && (rawData = rawData.slice(0, 1e4)), await initWASM(),
if (rawData.length > 1e4 && (rawData = rawData.slice(0, 1e4)), await initWASM(),
!wasmReady) throw new Error("WASM module not initialized");
let analyzedElements, prunedRawData;
try {
const wasmPromise = new Promise((resolve, reject) => {
try {
let result;
result = options.limit || options.filter ? analyze_page_with_options(rawData, options) : analyze_page(rawData),
result = options.limit || options.filter ? analyze_page_with_options(rawData, options) : analyze_page(rawData),
resolve(result);
} catch (e) {
reject(e);
Expand Down Expand Up @@ -101,4 +101,4 @@ initWASM().catch(err => {}), chrome.runtime.onMessage.addListener((request, send
event.preventDefault();
}), self.addEventListener("unhandledrejection", event => {
event.preventDefault();
});
});
18 changes: 9 additions & 9 deletions sentience/extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
if (!elements || !Array.isArray(elements)) return;
removeOverlay();
const host = document.createElement("div");
host.id = OVERLAY_HOST_ID, host.style.cssText = "\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n pointer-events: none !important;\n z-index: 2147483647 !important;\n margin: 0 !important;\n padding: 0 !important;\n ",
host.id = OVERLAY_HOST_ID, host.style.cssText = "\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n pointer-events: none !important;\n z-index: 2147483647 !important;\n margin: 0 !important;\n padding: 0 !important;\n ",
document.body.appendChild(host);
const shadow = host.attachShadow({
mode: "closed"
Expand All @@ -94,15 +94,15 @@
let color;
color = isTarget ? "#FF0000" : isPrimary ? "#0066FF" : "#00FF00";
const importanceRatio = maxImportance > 0 ? importance / maxImportance : .5, borderOpacity = isTarget ? 1 : isPrimary ? .9 : Math.max(.4, .5 + .5 * importanceRatio), fillOpacity = .2 * borderOpacity, borderWidth = isTarget ? 2 : isPrimary ? 1.5 : Math.max(.5, Math.round(2 * importanceRatio)), hexOpacity = Math.round(255 * fillOpacity).toString(16).padStart(2, "0"), box = document.createElement("div");
if (box.style.cssText = `\n position: absolute;\n left: ${bbox.x}px;\n top: ${bbox.y}px;\n width: ${bbox.width}px;\n height: ${bbox.height}px;\n border: ${borderWidth}px solid ${color};\n background-color: ${color}${hexOpacity};\n box-sizing: border-box;\n opacity: ${borderOpacity};\n pointer-events: none;\n `,
if (box.style.cssText = `\n position: absolute;\n left: ${bbox.x}px;\n top: ${bbox.y}px;\n width: ${bbox.width}px;\n height: ${bbox.height}px;\n border: ${borderWidth}px solid ${color};\n background-color: ${color}${hexOpacity};\n box-sizing: border-box;\n opacity: ${borderOpacity};\n pointer-events: none;\n `,
importance > 0 || isPrimary) {
const badge = document.createElement("span");
badge.textContent = isPrimary ? `⭐${importance}` : `${importance}`, badge.style.cssText = `\n position: absolute;\n top: -18px;\n left: 0;\n background: ${color};\n color: white;\n font-size: 11px;\n font-weight: bold;\n padding: 2px 6px;\n font-family: Arial, sans-serif;\n border-radius: 3px;\n opacity: 0.95;\n white-space: nowrap;\n pointer-events: none;\n `,
badge.textContent = isPrimary ? `⭐${importance}` : `${importance}`, badge.style.cssText = `\n position: absolute;\n top: -18px;\n left: 0;\n background: ${color};\n color: white;\n font-size: 11px;\n font-weight: bold;\n padding: 2px 6px;\n font-family: Arial, sans-serif;\n border-radius: 3px;\n opacity: 0.95;\n white-space: nowrap;\n pointer-events: none;\n `,
box.appendChild(badge);
}
if (isTarget) {
const targetIndicator = document.createElement("span");
targetIndicator.textContent = "🎯", targetIndicator.style.cssText = "\n position: absolute;\n top: -18px;\n right: 0;\n font-size: 16px;\n pointer-events: none;\n ",
targetIndicator.textContent = "🎯", targetIndicator.style.cssText = "\n position: absolute;\n top: -18px;\n right: 0;\n font-size: 16px;\n pointer-events: none;\n ",
box.appendChild(targetIndicator);
}
shadow.appendChild(box);
Expand All @@ -122,7 +122,7 @@
if (!grids || !Array.isArray(grids)) return;
removeOverlay();
const host = document.createElement("div");
host.id = OVERLAY_HOST_ID, host.style.cssText = "\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n pointer-events: none !important;\n z-index: 2147483647 !important;\n margin: 0 !important;\n padding: 0 !important;\n ",
host.id = OVERLAY_HOST_ID, host.style.cssText = "\n position: fixed !important;\n top: 0 !important;\n left: 0 !important;\n width: 100vw !important;\n height: 100vh !important;\n pointer-events: none !important;\n z-index: 2147483647 !important;\n margin: 0 !important;\n padding: 0 !important;\n ",
document.body.appendChild(host);
const shadow = host.attachShadow({
mode: "closed"
Expand All @@ -138,10 +138,10 @@
let labelText = grid.label ? `Grid ${grid.grid_id}: ${grid.label}` : `Grid ${grid.grid_id}`;
grid.is_dominant && (labelText = `⭐ ${labelText} (dominant)`);
const badge = document.createElement("span");
if (badge.textContent = labelText, badge.style.cssText = `\n position: absolute;\n top: -18px;\n left: 0;\n background: ${color};\n color: white;\n font-size: 11px;\n font-weight: bold;\n padding: 2px 6px;\n font-family: Arial, sans-serif;\n border-radius: 3px;\n opacity: 0.95;\n white-space: nowrap;\n pointer-events: none;\n `,
if (badge.textContent = labelText, badge.style.cssText = `\n position: absolute;\n top: -18px;\n left: 0;\n background: ${color};\n color: white;\n font-size: 11px;\n font-weight: bold;\n padding: 2px 6px;\n font-family: Arial, sans-serif;\n border-radius: 3px;\n opacity: 0.95;\n white-space: nowrap;\n pointer-events: none;\n `,
box.appendChild(badge), isTarget) {
const targetIndicator = document.createElement("span");
targetIndicator.textContent = "🎯", targetIndicator.style.cssText = "\n position: absolute;\n top: -18px;\n right: 0;\n font-size: 16px;\n pointer-events: none;\n ",
targetIndicator.textContent = "🎯", targetIndicator.style.cssText = "\n position: absolute;\n top: -18px;\n right: 0;\n font-size: 16px;\n pointer-events: none;\n ",
box.appendChild(targetIndicator);
}
shadow.appendChild(box);
Expand All @@ -155,7 +155,7 @@
let overlayTimeout = null;
function removeOverlay() {
const existing = document.getElementById(OVERLAY_HOST_ID);
existing && existing.remove(), overlayTimeout && (clearTimeout(overlayTimeout),
existing && existing.remove(), overlayTimeout && (clearTimeout(overlayTimeout),
overlayTimeout = null);
}
}();
}();
242 changes: 0 additions & 242 deletions sentience/extension/dist/background.js

This file was deleted.

Loading
Loading