672672 }
673673}
674674
675+ function htmlCheckbox ( id , text = "" , extra = "" , type = "checkbox" ) {
676+ return `
677+ <label class="form-${ type } ">
678+ <input type="checkbox" id="${ id } " ${ extra } >
679+ <i class="form-icon"></i>
680+ ${ text }
681+ </label>
682+ ` ;
683+ }
684+
675685function getTrackList ( ) {
676686 Util . showModal ( "Loading Track List..." ) ;
677687 domTracks . innerHTML = "" ;
729739 <h2>GPS Tracks</h2>` ;
730740
731741 if ( trackList . length > 0 ) {
732- html += `
733- <input type="checkbox" id="select-all">
734- <i class="form-icon"></i>
735- <span>Select all</span>
736- ` ;
742+ html += htmlCheckbox ( "select-all" , "Select all" ) ;
737743 html += `<div class="accordion">` ;
738744 trackList . forEach ( ( track , index ) => {
739745 const trackData = trackLineToObject ( track . info . headers , track . info . l ) ;
@@ -745,8 +751,7 @@ <h2>GPS Tracks</h2>`;
745751 html += `
746752 <div class="accordion-item">
747753 <div class="horizontal">
748- <input type="checkbox" id="track-download-${ track . number } " class="select-checkbox">
749- <i class="form-icon"></i>
754+ ${ htmlCheckbox ( "track-download-" + track . number , undefined , "class='select-checkbox'" ) }
750755 <div class="vertical">
751756 <input type="checkbox" id="accordion-track-${ track . number } " name="accordion-tracks" hidden>
752757 <label class="accordion-header" for="accordion-track-${ track . number } " data-track-index="${ index } ">
@@ -784,11 +789,12 @@ <h2>Batch Operations</h2>
784789 </div>
785790 <h2>Settings</h2>
786791 <div class="form-group">
787- <label class="form-switch">
788- <input type="checkbox" id="settings-allow-no-gps" ${ localStorage . getItem ( "recorder-allow-no-gps" ) == "true" ? "checked" : "" } >
789- <i class="form-icon"></i>
790- Include GPX/KML entries even when there's no GPS info
791- </label>
792+ ${ htmlCheckbox (
793+ "settings-allow-no-gps" ,
794+ "Include GPX/KML entries even when there's no GPS info" ,
795+ localStorage . getItem ( "recorder-allow-no-gps" ) == "true" ? "checked" : "" ,
796+ "switch" ,
797+ ) }
792798 </div>
793799 <div class="form-group">
794800 <label class="form-label">Units</label>
0 commit comments