Skip to content

Commit ff5913b

Browse files
authored
Language sort optionlist at LED tab (#3178)
* Sort 2 optionlist using sortSelect * Update led_strip.js Do the suggestion to code (and remove some blank lines)
1 parent b0f7ef6 commit ff5913b

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

src/js/tabs/led_strip.js

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const led_strip = {
66
directions: ['n', 'e', 's', 'w', 'u', 'd'],
77
};
88

9-
109
led_strip.initialize = function (callback, scrollPosition) {
1110
let selectedColorIndex = null;
1211
let selectedModeColor = null;
@@ -34,7 +33,6 @@ led_strip.initialize = function (callback, scrollPosition) {
3433
MSP.send_message(MSPCodes.MSP_LED_STRIP_MODECOLOR, false, false, load_html);
3534
}
3635

37-
3836
function load_html() {
3937
$('#content').load("./tabs/led_strip.html", process_html);
4038
}
@@ -186,7 +184,6 @@ led_strip.initialize = function (callback, scrollPosition) {
186184
});
187185

188186
updateBulkCmd();
189-
190187
});
191188

192189
// Color sliders
@@ -217,7 +214,6 @@ led_strip.initialize = function (callback, scrollPosition) {
217214
}
218215
}
219216

220-
221217
setColorSliders(selectedColorIndex);
222218

223219
$(this).addClass('btnOn');
@@ -396,6 +392,9 @@ led_strip.initialize = function (callback, scrollPosition) {
396392
},
397393
});
398394

395+
// Sort the element, if need to group, do it by lexical sort, ie. by naming of (the translated) selection text
396+
$('#ledStripFunctionSelect').sortSelect(i18n.getMessage("ledStripFunctionNoneOption"));
397+
399398
// UI: select LED function from drop-down
400399
$('.functionSelect').on('change', function() {
401400
clearModeColorSelection();
@@ -405,6 +404,9 @@ led_strip.initialize = function (callback, scrollPosition) {
405404
updateBulkCmd();
406405
});
407406

407+
// Sort the element, if need to group, do it by lexical sort, ie. by naming of (the translated) selection text
408+
$('#ledStripModeColorsModeSelect').sortSelect(i18n.getMessage("ledStripModeColorsModeOrientation"));
409+
408410
// UI: select mode from drop-down
409411
$('.modeSelect').on('change', function() {
410412

@@ -425,8 +427,7 @@ led_strip.initialize = function (callback, scrollPosition) {
425427
$('.mode_colors').each(function() { setModeBackgroundColor($(this)); });
426428
});
427429

428-
function toggleSwitch(that, letter)
429-
{
430+
function toggleSwitch(that, letter) {
430431
if ($(that).is(':checked')) {
431432
$('.ui-selected').find('.wire').each(function() {
432433
if ($(this).text() != "") {
@@ -528,8 +529,6 @@ led_strip.initialize = function (callback, scrollPosition) {
528529
}
529530
});
530531

531-
532-
533532
$('.mainGrid').disableSelection();
534533

535534
$('.gPoint').each(function(){
@@ -563,7 +562,6 @@ led_strip.initialize = function (callback, scrollPosition) {
563562
}
564563

565564
$(this).addClass(`color-${led.color}`);
566-
567565
});
568566

569567
$('a.save').on('click', function () {
@@ -582,7 +580,6 @@ led_strip.initialize = function (callback, scrollPosition) {
582580
GUI.log(i18n.getMessage('ledStripEepromSaved'));
583581
});
584582
}
585-
586583
});
587584

588585
colorDefineSliders.hide();
@@ -601,12 +598,6 @@ led_strip.initialize = function (callback, scrollPosition) {
601598
GUI.content_ready(callback);
602599
}
603600

604-
605-
606-
607-
608-
609-
610601
function findLed(x, y) {
611602
for (let ledIndex = 0; ledIndex < FC.LED_STRIP.length; ledIndex++) {
612603
const led = FC.LED_STRIP[ledIndex];
@@ -617,7 +608,6 @@ led_strip.initialize = function (callback, scrollPosition) {
617608
return undefined;
618609
}
619610

620-
621611
function updateBulkCmd() {
622612
const ledStripLength = FC.LED_STRIP.length;
623613

@@ -943,7 +933,6 @@ led_strip.initialize = function (callback, scrollPosition) {
943933
}
944934
}
945935

946-
947936
// refresh color buttons
948937
$('.colors').children().each(function() { setBackgroundColor($(this)); });
949938
$('.overlay-color').each(function() { setBackgroundColor($(this)); });
@@ -1005,7 +994,6 @@ led_strip.initialize = function (callback, scrollPosition) {
1005994
// only fire events when all values are set
1006995
if (change)
1007996
sliders.trigger('input');
1008-
1009997
}
1010998

1011999
function HsvToColor(input) {

src/tabs/led_strip.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939

4040
<div class="select">
4141
<span class="color_section" i18n="ledStripFunctionTitle"></span>
42-
<select class="functionSelect">
42+
<select id="ledStripFunctionSelect" class="functionSelect">
4343
<option value="" i18n="ledStripFunctionNoneOption"></option>
4444
<option value="function-c" i18n="ledStripFunctionColorOption"></option>
4545
<option value="function-f" i18n="ledStripFunctionModesOption"></option>
@@ -112,7 +112,7 @@
112112
<div class="mode_colors">
113113
<div class="section" i18n="ledStripModeColorsTitle"></div>
114114

115-
<select class="modeSelect">
115+
<select id="ledStripModeColorsModeSelect" class="modeSelect">
116116
<option value="0" i18n="ledStripModeColorsModeOrientation"></option>
117117
<option value="1" i18n="ledStripModeColorsModeHeadfree"></option>
118118
<option value="2" i18n="ledStripModeColorsModeHorizon"></option>

0 commit comments

Comments
 (0)