@@ -192,10 +192,22 @@ var control = (function(){
192192helper . e ( ".control-header-search-engine-custom-url" ) . disabled = true ;
193193} ;
194194} ;
195+ var _theme = function ( ) {
196+ if ( state . get ( ) . layout . theme . random . active ) {
197+ helper . eA ( "input[name='control-layout-theme-style']" ) . forEach ( function ( arrayItem , index ) {
198+ arrayItem . disabled = false ;
199+ } ) ;
200+ } else {
201+ helper . eA ( "input[name='control-layout-theme-style']" ) . forEach ( function ( arrayItem , index ) {
202+ arrayItem . disabled = true ;
203+ } ) ;
204+ } ;
205+ } ;
195206_edit ( ) ;
196207_date ( ) ;
197208_clock ( ) ;
198209_search ( ) ;
210+ _theme ( ) ;
199211} ;
200212
201213var _bind = function ( ) {
@@ -224,12 +236,23 @@ var control = (function(){
224236} , false ) ;
225237helper . e ( ".control-layout-theme-random" ) . addEventListener ( "change" , function ( ) {
226238state . change ( {
227- path : "layout.theme.random" ,
239+ path : "layout.theme.random.active " ,
228240value : this . checked
229241} ) ;
230242theme . render ( ) ;
243+ dependents ( ) ;
231244data . save ( ) ;
232245} , false ) ;
246+ helper . eA ( "input[name='control-layout-theme-style']" ) . forEach ( function ( arrayItem , index ) {
247+ arrayItem . addEventListener ( "change" , function ( ) {
248+ state . change ( {
249+ path : "layout.theme.random.style" ,
250+ value : this . value
251+ } ) ;
252+ render ( ) ;
253+ data . save ( ) ;
254+ } , false ) ;
255+ } ) ;
233256helper . e ( ".control-link-new-tab" ) . addEventListener ( "change" , function ( ) {
234257state . change ( {
235258path : "link.newTab" ,
@@ -492,7 +515,8 @@ var control = (function(){
492515var update = function ( ) {
493516helper . e ( ".control-edit" ) . checked = state . get ( ) . edit . active ;
494517helper . e ( ".control-layout-theme" ) . value = helper . rgbToHex ( state . get ( ) . layout . theme . current ) ;
495- helper . e ( ".control-layout-theme-random" ) . checked = state . get ( ) . layout . theme . random ;
518+ helper . e ( ".control-layout-theme-random" ) . checked = state . get ( ) . layout . theme . random . active ;
519+ helper . e ( ".control-layout-theme-style-" + state . get ( ) . layout . theme . random . style ) . checked = true ;
496520helper . e ( ".control-link-new-tab" ) . value = state . get ( ) . link . style . newTab ;
497521helper . e ( ".control-link-style-" + state . get ( ) . link . style ) . checked = true ;
498522helper . e ( ".control-link-sort-" + state . get ( ) . link . sort ) . checked = true ;
0 commit comments