browser-assistant 2.9.2 → 2.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/extension/content.js +14 -2
- package/extension/journal-automation.js +2 -8
- package/extension/manifest.json +1 -1
- package/extension/popup.html +21 -52
- package/extension/styles.css +473 -554
- package/package.json +1 -1
- package/server/main.py +1 -1
- package/server/practice_quiz.html +79 -6
package/extension/content.js
CHANGED
|
@@ -181,6 +181,16 @@ function mountJournalCountdown(signal) {
|
|
|
181
181
|
}
|
|
182
182
|
initDrag();
|
|
183
183
|
restorePanelPosition();
|
|
184
|
+
const panelResizeObserver = new ResizeObserver(() => {
|
|
185
|
+
if (!root.style.left || !root.offsetWidth || dragState.dragging)
|
|
186
|
+
return;
|
|
187
|
+
const { left, top } = root.getBoundingClientRect();
|
|
188
|
+
const { x, y } = clampPanelPosition(left, top);
|
|
189
|
+
if (left !== x || top !== y)
|
|
190
|
+
setPanelPosition(left, top);
|
|
191
|
+
});
|
|
192
|
+
panelResizeObserver.observe(root);
|
|
193
|
+
lifecycle.signal.addEventListener('abort', () => panelResizeObserver.disconnect(), { once: true });
|
|
184
194
|
let isCollapsed = true;
|
|
185
195
|
// Scan type and visible tab are intentionally separate. Switching away
|
|
186
196
|
// from QA Control must never stop an authorized automation run.
|
|
@@ -2552,7 +2562,7 @@ function mountJournalCountdown(signal) {
|
|
|
2552
2562
|
}
|
|
2553
2563
|
function scanPanelMarkup() {
|
|
2554
2564
|
return `
|
|
2555
|
-
<section class="assistant-scan-panel" id="assistant-scan-panel" role="tabpanel" aria-labelledby="mode-${selectedTab}">
|
|
2565
|
+
<section class="assistant-scan-panel" id="assistant-scan-panel" role="tabpanel" aria-labelledby="mode-${selectedTab === 'aptitude' ? 'apt' : selectedTab}">
|
|
2556
2566
|
<div class="assistant-btn-row">
|
|
2557
2567
|
<button class="assistant-btn" id="assistant-scan-btn">⚡ Scan (Text)</button>
|
|
2558
2568
|
<button class="assistant-btn secondary" id="assistant-vision-btn">⌁ Scan (Vision)</button>
|
|
@@ -2643,6 +2653,7 @@ function mountJournalCountdown(signal) {
|
|
|
2643
2653
|
const safeContent = content.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<');
|
|
2644
2654
|
root.innerHTML = `
|
|
2645
2655
|
<button class="assistant-tab collapsed ${content ? 'has-answer' : ''}" id="assistant-trigger" type="button" aria-label="Open Browser Assistant" data-content="${safeContent}">
|
|
2656
|
+
<span class="assistant-mark" aria-hidden="true">BA</span>
|
|
2646
2657
|
${isMinimalMode ? '<div class="assistant-mode-indicator">MIN</div>' : ''}
|
|
2647
2658
|
</button>
|
|
2648
2659
|
`;
|
|
@@ -2661,8 +2672,9 @@ function mountJournalCountdown(signal) {
|
|
|
2661
2672
|
<div class="assistant-tab" id="assistant-panel">
|
|
2662
2673
|
<div class="assistant-header">
|
|
2663
2674
|
<div class="assistant-title-row">
|
|
2664
|
-
|
|
2675
|
+
<span class="assistant-mark" aria-hidden="true">BA</span>
|
|
2665
2676
|
<h3 class="assistant-title">Browser Assistant</h3>
|
|
2677
|
+
${statusDot}
|
|
2666
2678
|
</div>
|
|
2667
2679
|
<div class="assistant-header-actions">
|
|
2668
2680
|
<button class="assistant-icon-btn" id="assistant-history-btn" type="button" aria-label="Open Scan History" title="Scan History">
|
|
@@ -132,15 +132,10 @@ function browserAssistantJournal(global) {
|
|
|
132
132
|
const panel = document.createElement('section');
|
|
133
133
|
panel.id = 'assistant-journal';
|
|
134
134
|
panel.dataset.build = journalBuild;
|
|
135
|
-
panel.
|
|
136
|
-
panel.innerHTML = '<strong>Reflective Journal</strong><p data-info></p><p data-countdown style="font-weight:600;margin:8px 0"></p><textarea aria-label="Your class experience and feelings" placeholder="Your actual class experience / feelings (optional)" rows="3" style="width:100%;box-sizing:border-box"></textarea><button type="button" style="margin-top:8px;padding:10px">Fill & Submit Journal</button><p role="status" aria-live="polite"></p>';
|
|
135
|
+
panel.innerHTML = '<strong>Reflective Journal</strong><p data-info></p><p data-countdown></p><textarea aria-label="Your class experience and feelings" placeholder="Your actual class experience / feelings (optional)" rows="3"></textarea><button type="button">Fill & Submit Journal</button><p role="status" aria-live="polite"></p>';
|
|
137
136
|
document.body.appendChild(panel);
|
|
138
137
|
const controls = document.createElement('div');
|
|
139
138
|
controls.innerHTML = '<label>Subject <select data-subject aria-label="Journal subject"><option value="">Detect from page</option><option>Backend Development Fundamentals</option><option>Computer Organization and Architecture</option><option>Advanced Data Structures</option><option>Linear Algebra Essentials</option><option>Fundamentals of Artificial Intelligence</option></select></label><label>Module / Journal <select data-number aria-label="Journal number"><option value="">Detect from page</option>' + Array.from({ length: 10 }, (_, i) => `<option value="${i + 1}">${i + 1}</option>`).join('') + '</select></label>';
|
|
140
|
-
for (const label of controls.querySelectorAll('label'))
|
|
141
|
-
label.style.cssText = 'display:block;margin:8px 0';
|
|
142
|
-
for (const select of controls.querySelectorAll('select'))
|
|
143
|
-
select.style.cssText = 'display:block;width:100%;padding:5px;color:#17233d;background:white;border:1px solid #abb3c3';
|
|
144
139
|
panel.insertBefore(controls, panel.querySelector('textarea'));
|
|
145
140
|
const status = panel.querySelector('[role=status]'), button = panel.querySelector('button');
|
|
146
141
|
const countdown = panel.querySelector('[data-countdown]');
|
|
@@ -234,7 +229,6 @@ function browserAssistantJournal(global) {
|
|
|
234
229
|
button.setAttribute('aria-keyshortcuts', 'Alt+Shift+J');
|
|
235
230
|
const shortcutHint = document.createElement('p');
|
|
236
231
|
shortcutHint.textContent = 'Shortcut: Alt + Shift + J';
|
|
237
|
-
shortcutHint.style.cssText = 'font-size:12px;margin:6px 0;color:#516078';
|
|
238
232
|
panel.insertBefore(shortcutHint, status);
|
|
239
233
|
const shortcutListener = event => {
|
|
240
234
|
if (!event.altKey || !event.shiftKey || event.ctrlKey || event.metaKey || event.repeat || event.isComposing)
|
|
@@ -277,7 +271,7 @@ function browserAssistantJournal(global) {
|
|
|
277
271
|
if (slot) {
|
|
278
272
|
if (panel.parentElement !== slot)
|
|
279
273
|
slot.appendChild(panel);
|
|
280
|
-
panel.style.
|
|
274
|
+
panel.style.display = '';
|
|
281
275
|
button.hidden = true;
|
|
282
276
|
}
|
|
283
277
|
else
|
package/extension/manifest.json
CHANGED
package/extension/popup.html
CHANGED
|
@@ -4,59 +4,28 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>Browser Assistant</title>
|
|
7
|
-
<
|
|
8
|
-
body {
|
|
9
|
-
width: 220px;
|
|
10
|
-
padding: 12px 14px;
|
|
11
|
-
font-family: 'Inter', system-ui, sans-serif;
|
|
12
|
-
background: #0f0f0f;
|
|
13
|
-
color: #eee;
|
|
14
|
-
margin: 0;
|
|
15
|
-
}
|
|
16
|
-
.logo {
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
gap: 8px;
|
|
20
|
-
margin-bottom: 10px;
|
|
21
|
-
}
|
|
22
|
-
.logo-dot {
|
|
23
|
-
width: 10px;
|
|
24
|
-
height: 10px;
|
|
25
|
-
border-radius: 50%;
|
|
26
|
-
background: #6e8efb;
|
|
27
|
-
box-shadow: 0 0 6px #6e8efb;
|
|
28
|
-
}
|
|
29
|
-
h3 { margin: 0; font-size: 14px; color: #fff; }
|
|
30
|
-
p { font-size: 11px; color: #888; margin: 0 0 10px; line-height: 1.5; }
|
|
31
|
-
.status { font-size: 11px; color: #555; }
|
|
32
|
-
.status span { color: #10b981; font-weight: 600; }
|
|
33
|
-
.shortcuts { margin-top: 10px; border-top: 1px solid #222; padding-top: 8px; }
|
|
34
|
-
.shortcut-row { display: flex; justify-content: space-between; font-size: 10px; color: #666; margin-bottom: 4px; }
|
|
35
|
-
kbd {
|
|
36
|
-
background: #222; border: 1px solid #444; border-radius: 3px;
|
|
37
|
-
padding: 1px 5px; font-size: 10px; color: #bbb;
|
|
38
|
-
}
|
|
39
|
-
#server-status { color: #f59e0b; }
|
|
40
|
-
#server-status.online { color: #10b981; }
|
|
41
|
-
#server-status.offline { color: #ef4444; }
|
|
42
|
-
</style>
|
|
7
|
+
<link rel="stylesheet" href="styles.css">
|
|
43
8
|
</head>
|
|
44
|
-
<body>
|
|
45
|
-
<
|
|
46
|
-
<
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
9
|
+
<body class="assistant-popup">
|
|
10
|
+
<main class="popup-shell">
|
|
11
|
+
<header class="popup-title">
|
|
12
|
+
<span class="popup-mark" aria-hidden="true">BA</span>
|
|
13
|
+
<h1>Browser Assistant</h1>
|
|
14
|
+
</header>
|
|
15
|
+
<section class="popup-card" aria-label="Server status">
|
|
16
|
+
<div>Server <span id="server-status" role="status">Checking…</span></div>
|
|
17
|
+
<p id="journal-countdown" hidden></p>
|
|
18
|
+
</section>
|
|
19
|
+
<section class="popup-card" aria-labelledby="popup-shortcuts">
|
|
20
|
+
<h2 id="popup-shortcuts">Keyboard shortcuts</h2>
|
|
21
|
+
<div class="shortcut-row"><span>Open panel</span> <kbd>`</kbd></div>
|
|
22
|
+
<div class="shortcut-row"><span>Close panel</span> <kbd>]</kbd></div>
|
|
23
|
+
<div class="shortcut-row"><span>Vision scan</span> <kbd>\</kbd></div>
|
|
24
|
+
<div class="shortcut-row"><span>Minimal mode</span> <kbd>[</kbd></div>
|
|
25
|
+
<div class="shortcut-row"><span>Fill and submit journal</span> <kbd>Alt+Shift+J</kbd></div>
|
|
26
|
+
<div class="shortcut-row"><span>Start, pause or resume</span> <kbd>Alt+A</kbd></div>
|
|
27
|
+
</section>
|
|
28
|
+
</main>
|
|
60
29
|
<script src="popup.js"></script>
|
|
61
30
|
</body>
|
|
62
31
|
</html>
|