@@ -686,42 +686,33 @@ async function getFeatures() {
686686 for ( var optionPlace in feature . options ) {
687687 var option = feature . options [ optionPlace ] ;
688688 var input = document . createElement ( "input" ) ;
689+ input . type = [ "text" , "checkbox" , "number" , "color" ] [ option . type || 0 ] ;
689690 input . dataset . id = option . id ;
690691 input . dataset . feature = feature . id ;
691- input . placeholder = option . name ;
692- input . type = [ "text" , "checkbox" , "number" , "color" ] [ option . type || 0 ] ;
693692 var optionData = ( await chrome . storage . sync . get ( option . id ) ) [ option . id ] ;
694693 input . value = optionData || "" ;
694+ input . placeholder = `Enter ${ input . type } ` ;
695+ var optionDiv = document . createElement ( "div" )
696+ optionDiv . className = "option" ;
697+ var label = document . createElement ( "label" ) ;
698+ label . textContent = option . name ;
699+ optionDiv . appendChild ( label )
700+
695701 if ( input . type === "checkbox" ) {
702+ input . checked = optionData || false ;
696703 var specialLabel = document . createElement ( "label" ) ;
697704 specialLabel . className = "special-switch" ;
698- input . className = "checkbox"
705+ input . classList . add = "checkbox"
699706 var span = document . createElement ( "span" ) ;
700707 span . className = "slider round" ;
701708 specialLabel . appendChild ( input ) ;
702709 specialLabel . appendChild ( span ) ;
710+ optionDiv . appendChild ( specialLabel )
703711 } else {
704- div . appendChild ( input ) ;
705- }
706- if ( input . type === "checkbox" ) {
707- let table = document . createElement ( "table" )
708- let tr = document . createElement ( "tr" )
709- table . appendChild ( tr )
710-
711- let td1 = document . createElement ( "td" )
712- tr . appendChild ( td1 )
713- let td2 = document . createElement ( "td" )
714- tr . appendChild ( td2 )
715-
716- div . appendChild ( table )
717-
718- var label = document . createElement ( "label" ) ;
719- label . textContent = option . name ;
720- label . style . marginLeft = "0px"
721- td1 . appendChild ( label ) ;
722- td2 . appendChild ( specialLabel )
723- input . checked = optionData || false ;
712+ optionDiv . appendChild ( input )
724713 }
714+ div . appendChild ( optionDiv )
715+
725716 input . dataset . validation = btoa (
726717 JSON . stringify ( option . validation || [ ] )
727718 ) ;
0 commit comments