From d2edfb1de2b0568597af988cfb6a68f6e56ce301 Mon Sep 17 00:00:00 2001 From: Darren Lines Date: Sun, 9 Jan 2022 14:11:24 +0000 Subject: [PATCH] Updated to allow switch names of up to 4 characters --- js/settings.js | 1 + tabs/osd.html | 8 ++++---- tabs/osd.js | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/js/settings.js b/js/settings.js index 148eb003..41250caf 100644 --- a/js/settings.js +++ b/js/settings.js @@ -53,6 +53,7 @@ var Settings = (function () { } } else if (s.setting.type == 'string') { input.val(s.value); + input.attr('maxlength', s.setting.max); } else if (s.setting.type == 'float') { input.attr('type', 'number'); diff --git a/tabs/osd.html b/tabs/osd.html index 19231259..193c4292 100644 --- a/tabs/osd.html +++ b/tabs/osd.html @@ -241,25 +241,25 @@
diff --git a/tabs/osd.js b/tabs/osd.js index ad13e521..4f6a5b19 100644 --- a/tabs/osd.js +++ b/tabs/osd.js @@ -1698,25 +1698,25 @@ OSD.constants = { name: 'SWITCH_INDICATOR_0', id: 130, positionable: true, - preview: 'A' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) + preview: 'SWI1' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) }, { name: 'SWITCH_INDICATOR_1', id: 131, positionable: true, - preview: 'B' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) + preview: 'SWI2' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) }, { name: 'SWITCH_INDICATOR_2', id: 132, positionable: true, - preview: 'C' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) + preview: 'SWI3' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) }, { name: 'SWITCH_INDICATOR_3', id: 133, positionable: true, - preview: 'D' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) + preview: 'SWI4' + FONT.symbol(SYM.SWITCH_INDICATOR_HIGH) } ] }, @@ -2878,13 +2878,15 @@ TABS.osd.initialize = function (callback) { $(".osdSwitchInd_channel option").each(function() { $(this).text("Ch " + $(this).text()); }); - - $('.osdSwitchIndChar').on('keyup', function() { - let testExp = new RegExp('^[A-Za-z]'); - if (testExp.test($(this).val())) { - $(this).val($(this).val().toUpperCase()); + + // Make sure that the switch hint only contains A to Z + $('.osdSwitchIndName').on('keyup', function() { + let testExp = new RegExp('^[A-Za-z0-9]'); + let testText = $(this).val(); + if (testExp.test(testText.slice(-1))) { + $(this).val(testText.toUpperCase()); } else { - $(this).val(""); + $(this).val(testText.slice(0, -1)); } });