Skip to content

Commit a2cb353

Browse files
committed
fix(cep): job-active inert lock, showAlert explicit type, numeric duration for estimates
- Add inert attribute to mainContent during active jobs so keyboard/AT can't reach locked buttons (was pointer-events-only) - Add explicit tone parameter to showAlert() so callers can bypass the English-only regex inference for non-English locales - Store clip duration as a numeric variable from backend response instead of regexing the rendered DOM text for time estimates (locale-safe)
1 parent b1beb5f commit a2cb353

1 file changed

Lines changed: 10 additions & 14 deletions

File tree

  • extension/com.opencut.panel/client

extension/com.opencut.panel/client/main.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
var capabilities = {};
2121
var selectedPath = "";
2222
var selectedName = "";
23+
var _clipDurationSeconds = 0;
2324
var currentJob = null;
2425
var pollTimer = null;
2526
var healthTimer = null;
@@ -2523,6 +2524,7 @@
25232524

25242525
function applyClipPreviewMeta(path, data) {
25252526
if (!data || path !== selectedPath) return;
2527+
_clipDurationSeconds = parseFloat(data.duration) || 0;
25262528
if (el.clipMetaDur) el.clipMetaDur.textContent = data.duration ? fmtDur(data.duration) : "";
25272529
if (el.clipMetaRes) {
25282530
el.clipMetaRes.textContent = data.video
@@ -3914,8 +3916,10 @@
39143916
el.progressLabel.textContent = preparingMessage;
39153917
el.cancelBtn.classList.remove("hidden");
39163918

3917-
// Lock the entire UI
3919+
// Lock the entire UI (pointer-events + keyboard/AT via inert)
39183920
document.body.classList.add("job-active");
3921+
var mc = document.getElementById("mainContent");
3922+
if (mc) mc.inert = true;
39193923

39203924
// Track for retry
39213925
lastJobEndpoint = endpoint;
@@ -4351,6 +4355,8 @@
43514355
setButtonText(el.processingCancel, rememberButtonText(el.processingCancel));
43524356
el.processingCancel.disabled = false;
43534357
document.body.classList.remove("job-active");
4358+
var mc = document.getElementById("mainContent");
4359+
if (mc) mc.inert = false;
43544360
if (elapsedTimer) { clearInterval(elapsedTimer); elapsedTimer = null; }
43554361
}
43564362

@@ -8270,9 +8276,9 @@
82708276
}
82718277
}
82728278

8273-
function showAlert(msg, errorData) {
8279+
function showAlert(msg, errorData, explicitTone) {
82748280
var display = enhanceError(msg, errorData);
8275-
var tone = inferNotificationTone(display, errorData);
8281+
var tone = inferNotificationTone(display, errorData, explicitTone);
82768282
var heading = getNotificationHeading(tone, display);
82778283
applyNotificationTone(el.alertBanner, tone);
82788284
if (el.alertIcon) {
@@ -12226,17 +12232,7 @@
1222612232
// ================================================================
1222712233
function fetchTimeEstimate(jobType) {
1222812234
if (!el.processingEstimate) return;
12229-
// Get file duration from file info (fmtDur outputs M:SS or H:MM:SS)
12230-
var fileDuration = 0;
12231-
var metaEl = document.getElementById("fileMetaDisplay");
12232-
if (metaEl) {
12233-
var txt = metaEl.textContent || "";
12234-
// Match M:SS or H:MM:SS format from fmtDur()
12235-
var hmatch = txt.match(/(\d+):(\d+):(\d+)/);
12236-
var mmatch = !hmatch && txt.match(/(\d+):(\d+)/);
12237-
if (hmatch) fileDuration = parseInt(hmatch[1]) * 3600 + parseInt(hmatch[2]) * 60 + parseInt(hmatch[3]);
12238-
else if (mmatch) fileDuration = parseInt(mmatch[1]) * 60 + parseInt(mmatch[2]);
12239-
}
12235+
var fileDuration = _clipDurationSeconds || 0;
1224012236
api("POST", "/system/estimate-time", { type: jobType, file_duration: fileDuration }, function (err, data) {
1224112237
if (err || !data || !data.estimate_seconds) {
1224212238
el.processingEstimate.textContent = "";

0 commit comments

Comments
 (0)