File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -13,9 +13,11 @@ let clock_info = require("clock_info");
1313
1414// Load the clock infos
1515let clockInfoItems = clock_info . load ( ) ;
16- if ( clockInfoItems [ 0 ] . items [ 6 ] ) { // TODO: Should maybe be more robust against changes to clock info, i.e. search for "clock" among items.
17- let clockItem = clockInfoItems [ 0 ] . items . pop ( ) ;
18- clockInfoItems [ 0 ] . items . unshift ( clockItem ) ;
16+ let clockInfoClockIdx = clockInfoItems [ 0 ] . items . findIndex ( c => c . name == "Clock" ) ;
17+ if ( clockInfoClockIdx > 0 ) { // pull the clock to the front (if it exists and not there already)
18+ let clockInfoClock = clockInfoItems [ 0 ] . items [ clockInfoClockIdx ] ;
19+ clockInfoItems [ 0 ] . items . splice ( clockInfoClockIdx , 1 ) ; // remove
20+ clockInfoItems [ 0 ] . items . unshift ( clockInfoClock ) ; // add to front
1921}
2022// Add the
2123let clockInfoMenu = clock_info . addInteractive ( clockInfoItems , {
You can’t perform that action at this time.
0 commit comments