settings: restore color-coding for quality presets, pin them right
The SOFT/MEDIUM/HARD selector lost its color coding when it became a dropdown. Re-apply colors (SOFT red, MEDIUM yellow, HARD white) to the options and to the select's shown value, and right-align the "Готовый профиль" label (margin-left:auto) so it clearly sits on the right. VERSION -> 0.0.122. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ const TR_PRESETS = {
|
||||
MEDIUM: { codec: "h264", profile: "baseline", bitrate: "8000k", keyint: 2, preset: "ultrafast" },
|
||||
HARD: { codec: "h264", profile: "main", bitrate: "16000k", keyint: 1, preset: "superfast" },
|
||||
};
|
||||
const TR_PRESET_COLORS = { SOFT: "#e03131", MEDIUM: "#e9c46a", HARD: "#ffffff" }; // цветомаркировка профилей
|
||||
function matchPreset(pr) { // имя пресета, совпадающего с параметрами
|
||||
return Object.keys(TR_PRESETS).find((k) => {
|
||||
const p = TR_PRESETS[k];
|
||||
@@ -1479,9 +1480,10 @@ const Settings = {
|
||||
`<option value="${v}"${String(pr[f]) === String(v) ? " selected" : ""}>${t}</option>`).join("") + `</select>`;
|
||||
// «Готовый профиль» SOFT/MEDIUM/HARD — выпадающее меню; выставляет все параметры разом
|
||||
const qmatch = matchPreset(pr);
|
||||
const qpresetSel = `<select class="qpreset">` +
|
||||
const qcol = (v) => TR_PRESET_COLORS[v] ? ` style="color:${TR_PRESET_COLORS[v]}"` : "";
|
||||
const qpresetSel = `<select class="qpreset"${qcol(qmatch)}>` +
|
||||
[["", "— свой —"]].concat(Object.keys(TR_PRESETS).map((k) => [k, k])).map(([v, t]) =>
|
||||
`<option value="${v}"${v === qmatch ? " selected" : ""}>${t}</option>`).join("") + `</select>`;
|
||||
`<option value="${v}"${v === qmatch ? " selected" : ""}${qcol(v)}>${t}</option>`).join("") + `</select>`;
|
||||
return (
|
||||
`<label>Кодек${sel("codec", [["h264", "H.264"], ["vp9", "VP9"]])}</label>` +
|
||||
`<label>Профиль H.264${sel("profile", [["baseline", "baseline"], ["main", "main"], ["high", "high"]])}</label>` +
|
||||
@@ -1490,7 +1492,7 @@ const Settings = {
|
||||
`<label>QP (квантизатор)<input type="number" data-f="qp" min="0" max="51" value="${pr.qp}"></label>` +
|
||||
`<label>Интервал ключевых кадров${sel("keyint", [[1, "1 секунда"], [2, "2 секунды"], [5, "5 секунд"]])}</label>` +
|
||||
`<label>Пресет (Preset)${sel("preset", [["ultrafast", "Ultrafast"], ["superfast", "Superfast"], ["veryfast", "Veryfast"], ["faster", "Faster"], ["fast", "Fast"], ["medium", "Medium"]])}</label>` +
|
||||
`<label>Готовый профиль${qpresetSel}</label>`
|
||||
`<label class="qpreset-lbl">Готовый профиль${qpresetSel}</label>`
|
||||
);
|
||||
},
|
||||
|
||||
@@ -1528,8 +1530,10 @@ const Settings = {
|
||||
const syncQuality = () => {
|
||||
qpreset.value = matchPreset({ codec: codec.value, profile: prof.value, bitrate: brSel.value,
|
||||
keyint: row.querySelector('[data-f="keyint"]').value, preset: row.querySelector('[data-f="preset"]').value });
|
||||
qpreset.style.color = TR_PRESET_COLORS[qpreset.value] || "";
|
||||
};
|
||||
qpreset.onchange = () => {
|
||||
qpreset.style.color = TR_PRESET_COLORS[qpreset.value] || "";
|
||||
const p = TR_PRESETS[qpreset.value];
|
||||
if (!p) return;
|
||||
const put = (f, v) => { const s = row.querySelector(`[data-f="${f}"]`); if (s) s.value = String(v); };
|
||||
|
||||
Reference in New Issue
Block a user