@@ -62,8 +62,12 @@ window.onload = function () {
6262 ui_day_scale : 1 ,
6363 ui_day_positionX : 0 ,
6464 ui_day_positionY : 0 ,
65- ui_date_date : "0" ,
65+ ui_date_date : false ,
6666 ui_date_orientation : false ,
67+ ui_date_year : "2" ,
68+ ui_date_order : "0" ,
69+ ui_date_monthName : false ,
70+ ui_date_allCaps : false ,
6771 ui_date_delimiter : "0" ,
6872 ui_date_scale : 1 ,
6973 ui_date_positionX : 0 ,
@@ -185,8 +189,12 @@ window.onload = function () {
185189 dayFolder . close ( ) ;
186190
187191 const dateFolder = gui . addFolder ( "Date" ) ;
188- dateFolder . add ( options , "ui_date_date" , optionsToDict ( config . general . properties . ui_date_date . options ) ) . name ( "Day" ) . onChange ( updateMask ) ;
192+ dateFolder . add ( options , "ui_date_date" ) . name ( "Day" ) . onChange ( updateMask ) ;
189193 dateFolder . add ( options , "ui_date_orientation" ) . name ( "Vertical Orientation" ) . onChange ( updateMask ) ;
194+ dateFolder . add ( options , "ui_date_year" , optionsToDict ( config . general . properties . ui_date_year . options ) ) . name ( "Year" ) . onChange ( updateMask ) ;
195+ dateFolder . add ( options , "ui_date_order" , optionsToDict ( config . general . properties . ui_date_order . options ) ) . name ( "Order" ) . onChange ( updateMask ) ;
196+ dateFolder . add ( options , "ui_date_monthName" ) . name ( "Month Name" ) . onChange ( updateMask ) ;
197+ dateFolder . add ( options , "ui_date_allCaps" ) . name ( "All CAPS" ) . onChange ( updateMask ) ;
190198 dateFolder . add ( options , "ui_date_delimiter" , optionsToDict ( config . general . properties . ui_date_delimiter . options ) ) . name ( "Delimiter" ) . onChange ( updateMask ) ;
191199 dateFolder . add ( options , "ui_date_scale" ) . min ( 0 ) . max ( 10 ) . step ( 1 ) . name ( "Scale" ) . onChange ( updateMask ) ;
192200 const datePositionFolder = dateFolder . addFolder ( "Position" ) ;
@@ -287,7 +295,8 @@ window.onload = function () {
287295 options . ui_logo_positionY = properties . ui_logo_positiony . value ;
288296 if ( properties . ui_logo_preservecolor )
289297 options . ui_logo_preserveColor = properties . ui_logo_preservecolor . value ;
290- if ( properties . ui_logo_logo || properties . ui_logo_customlogo || properties . ui_logo_scale || properties . ui_logo_positionx || properties . ui_logo_positiony || properties . ui_logo_preservecolor )
298+ if ( properties . ui_logo_logo || properties . ui_logo_customlogo || properties . ui_logo_scale ||
299+ properties . ui_logo_positionx || properties . ui_logo_positiony || properties . ui_logo_preservecolor )
291300 updateLogo ( ) ;
292301
293302 if ( properties . ui_clock_clock )
@@ -306,7 +315,8 @@ window.onload = function () {
306315 options . ui_clock_positionX = properties . ui_clock_positionx . value ;
307316 if ( properties . ui_clock_positiony )
308317 options . ui_clock_positionY = properties . ui_clock_positiony . value ;
309- if ( properties . ui_clock_clock || properties . ui_clock_24hourformat || properties . ui_clock_daylightsaving || properties . ui_clock_scale || properties . ui_clock_positionx || properties . ui_clock_positiony )
318+ if ( properties . ui_clock_clock || properties . ui_clock_24hourformat || properties . ui_clock_daylightsaving ||
319+ properties . ui_clock_scale || properties . ui_clock_positionx || properties . ui_clock_positiony )
310320 updateMask ( ) ;
311321
312322 if ( properties . ui_day_day )
@@ -321,13 +331,22 @@ window.onload = function () {
321331 options . ui_day_positionX = properties . ui_day_positionx . value ;
322332 if ( properties . ui_day_positiony )
323333 options . ui_day_positionY = properties . ui_day_positiony . value ;
324- if ( properties . ui_day_day || properties . ui_day_allcaps || properties . ui_day_orientation || properties . ui_day_scale || properties . ui_day_positionx || properties . ui_day_positiony )
334+ if ( properties . ui_day_day || properties . ui_day_allcaps || properties . ui_day_orientation ||
335+ properties . ui_day_scale || properties . ui_day_positionx || properties . ui_day_positiony )
325336 updateMask ( ) ;
326337
327338 if ( properties . ui_date_date )
328339 options . ui_date_date = properties . ui_date_date . value ;
329340 if ( properties . ui_date_orientation )
330341 options . ui_date_orientation = properties . ui_date_orientation . value ;
342+ if ( properties . ui_date_year )
343+ options . ui_date_year = properties . ui_date_year . value ;
344+ if ( properties . ui_date_order )
345+ options . ui_date_order = properties . ui_date_order . value ;
346+ if ( properties . ui_date_monthname )
347+ options . ui_date_monthName = properties . ui_date_monthname . value ;
348+ if ( properties . ui_date_allcaps )
349+ options . ui_date_allCaps = properties . ui_date_allcaps . value ;
331350 if ( properties . ui_date_delimiter )
332351 options . ui_date_delimiter = properties . ui_date_delimiter . value ;
333352 if ( properties . ui_date_scale )
@@ -336,7 +355,10 @@ window.onload = function () {
336355 options . ui_date_positionX = properties . ui_date_positionx . value ;
337356 if ( properties . ui_date_positiony )
338357 options . ui_date_positionY = properties . ui_date_positiony . value ;
339- if ( properties . ui_date_date || properties . ui_date_orientation || properties . ui_date_delimiter || properties . ui_date_scale || properties . ui_date_positionx || properties . ui_date_positiony )
358+ if ( properties . ui_date_date || properties . ui_date_orientation || properties . ui_date_year ||
359+ properties . ui_date_order || properties . ui_date_monthname || properties . ui_date_allcaps ||
360+ properties . ui_date_delimiter || properties . ui_date_scale || properties . ui_date_positionx
361+ || properties . ui_date_positiony )
340362 updateMask ( ) ;
341363
342364 if ( properties . ui_message_message )
@@ -349,7 +371,8 @@ window.onload = function () {
349371 options . ui_message_positionX = properties . ui_message_positionx . value ;
350372 if ( properties . ui_message_positiony )
351373 options . ui_message_positionY = properties . ui_message_positiony . value ;
352- if ( properties . ui_message_message || properties . ui_message_text || properties . ui_message_scale || properties . ui_message_positionx || properties . ui_message_positiony )
374+ if ( properties . ui_message_message || properties . ui_message_text || properties . ui_message_scale ||
375+ properties . ui_message_positionx || properties . ui_message_positiony )
353376 updateMask ( ) ;
354377
355378 if ( properties . ui_other_codescommaseparated ) {
@@ -368,6 +391,8 @@ window.onload = function () {
368391 } , false ) ;
369392
370393 //MARK: Variables
394+ let months = [ "January" , "February" , "March" , "April" , "May" , "June" , "July" , "August" , "September" , "October" , "November" , "December" ] ,
395+ dateDelimiters = [ "" , " " , "-" , "." , "/" ] ;
371396 let days = [ "Sunday" , "Monday" , "Tuesday" , "Wednesday" , "Thursday" , "Friday" , "Saturday" ] ;
372397 let fonts = [ "monospace" , "consolas" , "courier-bold" , "neo-matrix" ] ;
373398 let charsets = [
@@ -523,22 +548,45 @@ window.onload = function () {
523548 }
524549 }
525550
526- // if (options.ui_date_date != "0") {
527- // var dayText = options.ui_day_allCaps ? days[day].toUpperCase() : days[day];
528- // if (options.ui_day_day == "2")
529- // dayText = dayText.substring(0, 3);
530- // if (options.ui_day_orientation)
531- // dayText = dayText.split("").join("\\n");
532- // if (options.ui_day_scale > 0) {
533- // let bb = getTextBoundingBox(dayText, options.ui_day_scale);
534- // let center = [Math.floor((columns - bb[0]) / 2), Math.floor((rows - bb[1]) / 2)];
535- // drawTextOnMask(dayText, center[0] + options.ui_day_positionX, center[1] + options.ui_date_positionY, options.ui_day_scale);
536- // } else {
537- // let cc = getCharsCount(dayText);
538- // let center = [Math.floor((columns - cc[0]) / 2), Math.floor((rows - cc[1]) / 2)];
539- // drawTextOnMatrix(dayText, center[0] + options.ui_day_positionX, center[1] + options.ui_date_positionY);
540- // }
541- // }
551+ if ( options . ui_date_date ) {
552+ var dateText = date . toString ( ) , monthText , yearText = "" , completeDate ;
553+ if ( dateText . length < 2 )
554+ dateText = "0" + dateText ;
555+ if ( options . ui_date_monthName ) {
556+ monthText = months [ month ] ;
557+ if ( options . ui_date_allCaps )
558+ monthText = monthText . toUpperCase ( ) ;
559+ } else {
560+ monthText = month . toString ( ) ;
561+ if ( monthText . length < 2 )
562+ monthText = "0" + monthText ;
563+ }
564+ switch ( options . ui_date_year ) {
565+ case "1" : {
566+ yearText = year . toString ( ) . substring ( 2 , 4 ) ;
567+ break ;
568+ }
569+ case "2" : {
570+ yearText = year . toString ( ) ;
571+ break ;
572+ }
573+ }
574+
575+ let delimiter = options . ui_date_orientation ? "" : dateDelimiters [ parseInt ( options . ui_date_delimiter ) ] ;
576+ completeDate = yearText + ( yearText . length > 0 ? delimiter : "" ) + ( options . ui_date_order == "0" ? monthText + delimiter + dateText : dateText + delimiter + monthText ) ;
577+ if ( options . ui_date_orientation )
578+ completeDate = completeDate . split ( "" ) . join ( "\\n" ) ;
579+
580+ if ( options . ui_date_scale > 0 ) {
581+ let bb = getTextBoundingBox ( completeDate , options . ui_date_scale ) ;
582+ let center = [ Math . floor ( ( columns - bb [ 0 ] ) / 2 ) , Math . floor ( ( rows - bb [ 1 ] ) / 2 ) ] ;
583+ drawTextOnMask ( completeDate , center [ 0 ] + options . ui_date_positionX , center [ 1 ] + options . ui_date_positionY , options . ui_date_scale ) ;
584+ } else {
585+ let cc = getCharsCount ( completeDate ) ;
586+ let center = [ Math . floor ( ( columns - cc [ 0 ] ) / 2 ) , Math . floor ( ( rows - cc [ 1 ] ) / 2 ) ] ;
587+ drawTextOnMatrix ( completeDate , center [ 0 ] + options . ui_date_positionX , center [ 1 ] + options . ui_date_positionY ) ;
588+ }
589+ }
542590
543591 if ( options . ui_message_message ) {
544592 if ( options . ui_message_scale > 0 ) {
0 commit comments