Skip to content

Commit

Permalink
Add support for displaying more sub info
Browse files Browse the repository at this point in the history
  • Loading branch information
MBR-0001 committed Jul 23, 2023
1 parent eecd7d1 commit 8d84a67
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 6 deletions.
40 changes: 35 additions & 5 deletions src/components/subtitleeditor/subtitleeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ function renderSearchResults(context, results) {

html += '<span class="listItemIcon material-icons closed_caption" aria-hidden="true"></span>';

const bodyClass = result.Comment || result.IsHashMatch ? 'three-line' : 'two-line';
const hasAnyFlags = result.IsHashMatch || result.AiTranslated || result.MachineTranslated || result.Forced || result.HearingImpaired;
const bodyClass = result.Comment || hasAnyFlags ? 'three-line' : 'two-line';

html += '<div class="listItemBody ' + bodyClass + '">';

Expand All @@ -206,16 +207,45 @@ function renderSearchResults(context, results) {
}

if (result.DownloadCount != null) {
html += '<span>' + globalize.translate('DownloadsValue', result.DownloadCount) + '</span>';
html += '<span style="margin-right:1em;">' + globalize.translate('DownloadsValue', result.DownloadCount) + '</span>';
}

if (result.FrameRate) {
html += '<span>' + globalize.translate('Framerate') + ': ' + result.FrameRate + '</span>';
}

html += '</div>';

if (result.Comment) {
html += '<div class="secondary listItemBodyText">' + escapeHtml(result.Comment) + '</div>';
html += '<div class="secondary listItemBodyText" style="white-space:pre-line;">' + escapeHtml(result.Comment) + '</div>';
}

if (result.IsHashMatch) {
html += '<div class="secondary listItemBodyText"><div class="inline-flex align-items-center justify-content-center" style="background:#3388cc;color:#fff;padding: .3em 1em;border-radius:1000em;">' + globalize.translate('PerfectMatch') + '</div></div>';
if (hasAnyFlags) {
html += '<div class="secondary listItemBodyText">';

const spanOpen = '<span class="inline-flex align-items-center justify-content-center" style="background:#3388cc;color:#fff;padding: .3em 1em;border-radius:1000em;margin-right:0.25em;">';

if (result.IsHashMatch) {
html += spanOpen + globalize.translate('PerfectMatch') + '</span>';
}

if (result.AiTranslated) {
html += spanOpen + globalize.translate('AiTranslated') + '</span>';
}

if (result.MachineTranslated) {
html += spanOpen + globalize.translate('MachineTranslated') + '</span>';
}

if (result.Forced) {
html += spanOpen + globalize.translate('ForeignPartsOnly') + '</span>';
}

if (result.HearingImpaired) {
html += spanOpen.replace('margin-right:0.25em;', '') + globalize.translate('HearingImpairedShort') + '</span>';
}

html += '</div>';
}

html += '</div>';
Expand Down
6 changes: 5 additions & 1 deletion src/strings/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -1713,5 +1713,9 @@
"Unreleased": "Not yet released",
"LabelTonemappingMode": "Tone mapping mode",
"TonemappingModeHelp": "Select the tone mapping mode. If you experience blown out highlights try switching to the RGB mode.",
"Unknown": "Unknown"
"Unknown": "Unknown",
"AiTranslated": "AI Translated",
"MachineTranslated": "Machine Translated",
"ForeignPartsOnly": "Forced/Foreign parts only",
"HearingImpairedShort": "HI/SDH"
}

0 comments on commit 8d84a67

Please sign in to comment.