Changeset 418 in tmcsimulator
- Timestamp:
- 06/20/2019 03:46:03 PM (7 years ago)
- Location:
- trunk/webapps/einotebook
- Files:
-
- 3 edited
-
script/script.js (modified) (1 diff)
-
scripts/Event.js (modified) (4 diffs)
-
scripts/Events.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/einotebook/script/script.js
r415 r418 35 35 function highlightLatestEvent() 36 36 { 37 var currentEventArray = Script.events.getLastExecutedEvent(readCookie("time")); 37 Script.events.setEmphasis(); // Set text colors on all events 38 38 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(); 80 44 } 81 45 -
trunk/webapps/einotebook/scripts/Event.js
r364 r418 33 33 this.highlight = highlight; 34 34 this.unhighlight = unhighlight; 35 this.normalize = normalize; 35 36 this.focus = focus; 36 37 … … 184 185 events.doc.getElementById(this.eventHeaderID).style.borderColor = "blue"; 185 186 events.doc.getElementById(this.eventHeaderID).style.backgroundColor = "yellow"; 187 events.doc.getElementById(this.eventHeaderID).style.color = "black"; 188 events.doc.getElementById(this.dataID).style.color = "black"; 189 events.doc.getElementById(this.dataID).style.backgroundColor = incidentColor[this.incident.number]; 186 190 187 191 // IF this event is expanded THEN … … 194 198 events.doc.getElementById(this.dataID).style.border = "none"; 195 199 } 196 200 197 201 } 198 202 … … 211 215 events.doc.getElementById(this.dataID).style.color = "gray"; 212 216 } 217 /** 218 * Normalize this Event: provide normal background and text colors. 219 */ 220 function normalize() 221 { 222 var myColor = incidentColor[this.incident.number]; 223 events.doc.getElementById(this.eventHeaderID).style.backgroundColor = "white"; 224 events.doc.getElementById(this.eventHeaderID).style.borderColor = "black"; 225 events.doc.getElementById(this.eventHeaderID).style.color = "black"; 226 events.doc.getElementById(this.dataID).style.color = "black"; 227 events.doc.getElementById(this.dataID).style.backgroundColor = myColor; 228 events.doc.getElementById(this.eventHeaderID).style.backgroundColor = myColor; 229 } 230 213 231 214 232 /** -
trunk/webapps/einotebook/scripts/Events.js
r415 r418 25 25 events.expandAllProperties = events_expandAllProperties; 26 26 events.expandAllEvaluations = events_expandAllEvaluations; 27 events.setEmphasis = events_setEmphasis; 27 28 events.expandAll = events_expandAll; 28 29 events.collapseAll = events_collapseAll; … … 300 301 events.expandAllEvents(); 301 302 } 303 304 /** Set emphasis for all events. 305 Change color of text of expired events so they appear disabled, and future 306 events appear normal. 307 */ 308 function events_setEmphasis() 309 { 310 var currentTime = readCookie("time"); 311 // FOR each Event 312 for (var i = 0; i < this.length - 1; i++) 313 { 314 // Change color of those before current time 315 if (this[i].time.getSeconds() <= currentTime) 316 { 317 this[i].unhighlight(); 318 } 319 else 320 { 321 this[i].normalize(); // normal colors for everything else 322 } 323 } 324 } 325 302 326 303 327 /**
Note: See TracChangeset
for help on using the changeset viewer.
