Changeset 418 in tmcsimulator for trunk/webapps/einotebook/script/script.js


Ignore:
Timestamp:
06/20/2019 03:46:03 PM (7 years ago)
Author:
jdalbey
Message:

Fix #124

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/webapps/einotebook/script/script.js

    r415 r418  
    3535function highlightLatestEvent()  
    3636{ 
    37         var currentEventArray = Script.events.getLastExecutedEvent(readCookie("time")); 
     37    Script.events.setEmphasis();  // Set text colors on all events 
    3838 
    39         // IF the old event is has not been set THEN 
    40         if (typeof highlightLatestEvent.oldEventArray == 'undefined') 
    41         { 
    42                 highlightLatestEvent.oldEventArray = []; /* set up array of old events */ 
    43                 var currentEvent = new Object();  
    44                 highlightLatestEvent.oldEventArray.push(currentEvent); 
    45                 highlightLatestEvent.oldEventArray[0].id = Event.invalidID; 
    46         } 
    47  
    48         // IF a current event exists THEN 
    49         if (currentEventArray !== null) 
    50         { 
    51                 var found = false; /* check if a current event is found in the old event array */ 
    52  
    53                 /* traverse the array of current event to check  
    54                 if there is event already in the old event array */ 
    55                 // IF there is a new current event THEN  
    56                 for (j=0; j<highlightLatestEvent.oldEventArray.length; j++) { 
    57                         var oldEvent = highlightLatestEvent.oldEventArray[j]; 
    58                         found = false; 
    59                         for (i=0; i<currentEventArray.length; i++) { 
    60                                 var currentEvent = currentEventArray[i]; 
    61                                 if (oldEvent.id === currentEvent.id) 
    62                                 { 
    63                                         found = true;    
    64                                         break;           
    65                                 }  
    66                         } 
    67                         /* unhighlight all the events that are no longer current */ 
    68                         if (!found && oldEvent.id !== Event.invalidID) { 
    69                                 oldEvent.unhighlight(); 
    70                         }                
    71                 } 
    72  
    73                 /* highlight the current event in the array */ 
    74                 for (i=0; i<currentEventArray.length; i++) { 
    75                         currentEventArray[i].highlight(); 
    76                 } 
    77  
    78                 /* update the old events array with current event array */ 
    79                 highlightLatestEvent.oldEventArray = currentEventArray; 
     39    var currentEventArray = Script.events.getLastExecutedEvent(readCookie("time")); 
     40        /* highlight the items in the current event array */ 
     41    for (i=0; i<currentEventArray.length; i++)  
     42    { 
     43                currentEventArray[i].highlight(); 
    8044        } 
    8145 
Note: See TracChangeset for help on using the changeset viewer.