Changeset 515 in tmcsimulator for trunk/webapps
- Timestamp:
- 11/08/2019 11:49:12 AM (6 years ago)
- Location:
- trunk/webapps/einotebook/scripts
- Files:
-
- 4 edited
-
Event.js (modified) (3 diffs)
-
Incident.js (modified) (2 diffs)
-
Incidents.js (modified) (2 diffs)
-
LoadEvents.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/webapps/einotebook/scripts/Event.js
r418 r515 146 146 function html() 147 147 { 148 //console.log("building html for event: ", this.eventHeaderID, incidentColor[this.incident.number]);148 //console.log("building html for event: ", this.eventHeaderID, this.incident.color); //incidentColor[this.incident.number]); 149 149 150 150 return "<table class='event'>" + 151 151 "<tr>" + 152 "<td class='eventHeader' style='background-color:" + incidentColor[this.incident.number]+ "'" +152 "<td class='eventHeader' style='background-color:" + this.incident.color + "'" + 153 153 "id='" + this.eventHeaderID + "'>" + 154 154 this.headerHTML() + "</td>" + 155 155 "</tr>" + 156 156 "<tr>" + 157 "<td class='eventData' style='background-color:" + incidentColor[this.incident.number]+ "' id='" + this.dataID + "'>" +157 "<td class='eventData' style='background-color:" + this.incident.color + "' id='" + this.dataID + "'>" + 158 158 (this.expanded ? this.dataHTML() : "") + 159 159 "</td>" + … … 187 187 events.doc.getElementById(this.eventHeaderID).style.color = "black"; 188 188 events.doc.getElementById(this.dataID).style.color = "black"; 189 events.doc.getElementById(this.dataID).style.backgroundColor = incidentColor[this.incident.number];189 events.doc.getElementById(this.dataID).style.backgroundColor = this.incident.color; 190 190 191 191 // IF this event is expanded THEN … … 220 220 function normalize() 221 221 { 222 var myColor = incidentColor[this.incident.number];222 var myColor = this.incident.color; 223 223 events.doc.getElementById(this.eventHeaderID).style.backgroundColor = "white"; 224 224 events.doc.getElementById(this.eventHeaderID).style.borderColor = "black"; -
trunk/webapps/einotebook/scripts/Incident.js
r468 r515 6 6 * @param summary {String} 7 7 */ 8 function Incident(time, number, title, summary )8 function Incident(time, number, title, summary, color) 9 9 { 10 10 //========== public read-only members ==========// … … 13 13 this.title = title; 14 14 this.summary = summary; 15 this.expanded = true; 15 this.color = color; /* hex color code for background of this incident */ 16 16 17 17 //========== public methods ==========// -
trunk/webapps/einotebook/scripts/Incidents.js
r468 r515 7 7 //========== public members ==========/ 8 8 incidents.doc = null; 9 incidents.colorpallette = [ 10 "#d8f0f3", // PowderBlue 11 "#dfecdf", // DarkSeaGreen 12 "#fff5cc", // CornSilk 13 "#ffe8e6", // MistyRose 14 "#ffffcc", // Dark Orange 15 "#d8f0f3" ]; 9 16 10 17 //========== public methods ==========// 11 18 incidents.get = incidents_get; 19 incidents.collapseAll = incidents_collapseAll; 20 incidents.expandAll = incidents_expandAll; 12 21 incidents.add = incidents_add; 22 incidents.size = incidents_size; 13 23 14 24 //=========== method definitions ==========// … … 34 44 return incident; 35 45 } 46 /** 47 * Accessor to the number of incidents 48 */ 49 function incidents_size() 50 { 51 return this.length; 52 } 53 54 /** 55 * Collapses each Incident. 56 */ 57 function incidents_collapseAll() 58 { 59 // FOR each incident 60 for (var i = 0; i < this.length; i++) 61 { 62 // IF the incident is expanded THEN 63 if (this[i].expanded) 64 { 65 // collapse incident 66 this[i].expandAction(); 67 } 68 } 69 } 70 71 /** 72 * Expands each incident. 73 */ 74 function incidents_expandAll() 75 { 76 // FOR each incident 77 for (var i = 0; i < this.length; i++) 78 { 79 // IF incident is collapsed THEN 80 if (!this[i].expanded) 81 { 82 // expand incident 83 this[i].expandAction(); 84 } 85 } 86 } 36 87 37 88 /** -
trunk/webapps/einotebook/scripts/LoadEvents.js
r468 r515 42 42 if (incidents.get(incidentNum) == undefined) 43 43 { 44 // prepare title field 44 45 incidentTitle = currEvt.childNodes[child].textContent; 46 // select a color from the pallette 47 var palletteSize = incidents.colorpallette.length; 48 var currColor = incidents.colorpallette[incidents.size()]; // modulo palleteSize 45 49 // Construct the incident 46 var theIncident = new Incident(evtTime, incidentNum, incidentTitle, "" );50 var theIncident = new Incident(evtTime, incidentNum, incidentTitle, "", currColor); 47 51 // Add the incident to the list of incidents 48 52 incidents.add(theIncident);
Note: See TracChangeset
for help on using the changeset viewer.
