Skip to content

Commit 0a3d911

Browse files
committed
UM settings page update.
- capitalize every word in parameters - replace - and _ to space for legibility Swapped includes in FX.cpp
1 parent 917cd96 commit 0a3d911

File tree

4 files changed

+178
-176
lines changed

4 files changed

+178
-176
lines changed

wled00/FX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
Modified heavily for WLED
2525
*/
2626

27-
#include "FX.h"
2827
#include "wled.h"
28+
#include "FX.h"
2929
#include "fcn_declare.h"
3030

3131
#define IBN 5100

wled00/data/settings_um.htm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@
105105
}
106106
}
107107
function initCap(s) {
108-
if (typeof s !== 'string') return ''
109-
return s.charAt(0).toUpperCase() + s.slice(1)
108+
if (typeof s !== 'string') return '';
109+
// https://www.freecodecamp.org/news/how-to-capitalize-words-in-javascript/
110+
return s.replace(/[\W_]/g,' ').replace(/(^\w{1})|(\s+\w{1})/g, l=>l.toUpperCase()); // replace - and _ with space, capitalize every 1st letter
110111
}
111112
function addField(k,f,o,a=false) { //key, field, (sub)object, isArray
112113
if (isO(o)) {

0 commit comments

Comments
 (0)