@@ -24,8 +24,10 @@ var action_name_convert = {
2424} 
2525
2626async  function  start_recording ( ) { 
27-     idx  =  0 ; 
28-     recorded_actions  =  [ ] ;     
27+     let  res  =  await  browserAppData . storage . local . get ( 'recorded_actions' ) ;     
28+     recorded_actions  =  res . recorded_actions ; 
29+     idx  =  recorded_actions . length ; 
30+ 
2931} 
3032async  function  stop_recording ( ) { 
3133    // When there are 2 iframes. it saves 3 times. this is a temporary fix. Should be fixed properly 
@@ -118,7 +120,8 @@ async function fetchAIData(idx, command, value, url, document){
118120        value  =  10 ; 
119121    } 
120122    response [ 0 ] . short . value  =  value ; 
121-     if  ( value )  response [ 0 ] . data_set [ response [ 0 ] . data_set . length - 1 ] [ response [ 0 ] . data_set [ 0 ] . length - 1 ]  =  value ; 
123+     if  ( command  ===  'text' )  response [ 0 ] . data_set [ response [ 0 ] . data_set . length - 1 ] [ response [ 0 ] . data_set [ 0 ] . length - 1 ]  =  value ; 
124+     else  if  ( value )  response [ 0 ] . data_set [ response [ 0 ] . data_set . length - 1 ] [ response [ 0 ] . data_set [ 0 ] . length - 1 ]  =  value ; 
122125    recorded_actions [ idx ]  =  { 
123126        action : response [ 0 ] . short . action , 
124127        data_list : [ response [ 0 ] . short . value ] , 
@@ -139,7 +142,8 @@ async function record_action(command, value, url, document){
139142    if  ( Object . keys ( action_name_convert ) . includes ( command ) )  command  =  action_name_convert [ command ] 
140143    console . log ( "... Action recorder start" ) ; 
141144    idx  +=  1 ; 
142-     if  ( recorded_actions . length  ===  0  ||  recorded_actions . length  >  0  &&  recorded_actions [ 0 ] . action  !=  'go to link' ) { 
145+     if  ( recorded_actions . length  ===  0  ||  
146+         recorded_actions . length  >  0  &&  typeof  recorded_actions [ 0 ]  ==  'object'  &&  recorded_actions [ 0 ] . action  !=  'go to link' ) { 
143147        let  go_to_link  =  { 
144148            action : 'go to link' , 
145149            data_list : [ url ] , 
0 commit comments