Cleaned up the formatting of timers in OSD.

10.3.x-maintenance
mikeller 2017-08-29 21:24:01 +12:00
parent f7567ffcbf
commit 4a2b041f13
1 changed files with 26 additions and 16 deletions

View File

@ -1159,14 +1159,18 @@ TABS.osd.initialize = function (callback) {
var $timers = $('#timer-fields').empty(); var $timers = $('#timer-fields').empty();
for (let tim of OSD.data.timers) { for (let tim of OSD.data.timers) {
var $timerConfig = $('<div class="switchable-field field-' + tim.index + '"/>'); var $timerConfig = $('<div class="switchable-field field-' + tim.index + '"/>');
var timerTable = $('<table />');
$timerConfig.append(timerTable);
var timerTableRow = $('<tr />');
timerTable.append(timerTableRow);
// Timer number // Timer number
$timerConfig.append('<span>' + (tim.index + 1) + '</span>'); timerTableRow.append('<td>' + (tim.index + 1) + '</td>');
// Source // Source
var sourceSpan = $('<span class="osd_tip"></span>'); var sourceTimerTableData = $('<td class="osd_tip"></td>');
sourceSpan.attr('title', chrome.i18n.getMessage('osdTimerSourceTooltip')); sourceTimerTableData.attr('title', chrome.i18n.getMessage('osdTimerSourceTooltip'));
sourceSpan.append('<label for="timerSource_' + tim.index + '" class="char-label">' + chrome.i18n.getMessage('osdTimerSource') + '</label>'); sourceTimerTableData.append('<label for="timerSource_' + tim.index + '" class="char-label">' + chrome.i18n.getMessage('osdTimerSource') + '</label>');
var src = $('<select class="timer-option" id="timerSource_' + tim.index + '"></select>'); var src = $('<select class="timer-option" id="timerSource_' + tim.index + '"></select>');
OSD.constants.TIMER_TYPES.forEach(function(e, i) { OSD.constants.TIMER_TYPES.forEach(function(e, i) {
src.append('<option value="' + i + '">' + e + '</option>'); src.append('<option value="' + i + '">' + e + '</option>');
@ -1180,13 +1184,15 @@ TABS.osd.initialize = function (callback) {
updateOsdView(); updateOsdView();
}); });
}); });
sourceSpan.append(src); sourceTimerTableData.append(src);
$timerConfig.append(sourceSpan); timerTableRow.append(sourceTimerTableData);
// Precision // Precision
var precisionSpan = $('<span class="osd_tip"></span>'); timerTableRow = $('<tr />');
precisionSpan.attr('title', chrome.i18n.getMessage('osdTimerPrecisionTooltip')); timerTable.append(timerTableRow);
precisionSpan.append('<label for="timerPrec_' + tim.index + '" class="char-label">' + chrome.i18n.getMessage('osdTimerPrecision') + '</label>'); var precisionTimerTableData = $('<td class="osd_tip"></td>');
precisionTimerTableData.attr('title', chrome.i18n.getMessage('osdTimerPrecisionTooltip'));
precisionTimerTableData.append('<label for="timerPrec_' + tim.index + '" class="char-label">' + chrome.i18n.getMessage('osdTimerPrecision') + '</label>');
var precision = $('<select class="timer-option osd_tip" id="timerPrec_' + tim.index + '"></select>'); var precision = $('<select class="timer-option osd_tip" id="timerPrec_' + tim.index + '"></select>');
OSD.constants.TIMER_PRECISION.forEach(function(e, i) { OSD.constants.TIMER_PRECISION.forEach(function(e, i) {
precision.append('<option value="' + i + '">' + e + '</option>'); precision.append('<option value="' + i + '">' + e + '</option>');
@ -1200,13 +1206,16 @@ TABS.osd.initialize = function (callback) {
updateOsdView(); updateOsdView();
}); });
}); });
precisionSpan.append(precision); precisionTimerTableData.append(precision);
$timerConfig.append(precisionSpan); timerTableRow.append('<td></td>');
timerTableRow.append(precisionTimerTableData);
// Alarm // Alarm
var alarmSpan = $('<span class="osd_tip"></span>'); timerTableRow = $('<tr />');
alarmSpan.attr('title', chrome.i18n.getMessage('osdTimerAlarmTooltip')); timerTable.append(timerTableRow);
alarmSpan.append('<label for="timerAlarm_' + tim.index + '" class="char-label">' + chrome.i18n.getMessage('osdTimerAlarm') + '</label>'); var alarmTimerTableData = $('<td class="osd_tip"></td>');
alarmTimerTableData.attr('title', chrome.i18n.getMessage('osdTimerAlarmTooltip'));
alarmTimerTableData.append('<label for="timerAlarm_' + tim.index + '" class="char-label">' + chrome.i18n.getMessage('osdTimerAlarm') + '</label>');
var alarm = $('<input class="timer-option osd_tip" name="alarm" type="number" min=0 id="timerAlarm_' + tim.index + '"/>'); var alarm = $('<input class="timer-option osd_tip" name="alarm" type="number" min=0 id="timerAlarm_' + tim.index + '"/>');
alarm[0].value = tim.alarm; alarm[0].value = tim.alarm;
alarm.blur(function(e) { alarm.blur(function(e) {
@ -1217,8 +1226,9 @@ TABS.osd.initialize = function (callback) {
updateOsdView(); updateOsdView();
}); });
}); });
alarmSpan.append(alarm); alarmTimerTableData.append(alarm);
$timerConfig.append(alarmSpan); timerTableRow.append('<td></td>');
timerTableRow.append(alarmTimerTableData);
$timers.append($timerConfig); $timers.append($timerConfig);
} }