Changeset 299 for binary-improvements/webserver
- Timestamp:
- Dec 14, 2016, 7:47:05 PM (8 years ago)
- Location:
- binary-improvements/webserver
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/webserver/css/style.css
r288 r299 135 135 .adminnavbar #serverstats #stats_time { 136 136 white-space: nowrap; 137 border-bottom: 1px dashed orange; 137 138 } 138 139 -
binary-improvements/webserver/js/stats.js
r251 r299 1 function DayName (days) { 2 var daynames = ["", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Bloodday"]; 3 return daynames[DayOfWeek(days)]; 4 } 5 6 function DayOfWeek (days) { 7 return days % 7 > 0 ? days % 7 : 7; 8 } 9 10 function GetDayStat (days) { 11 var daynames = ["", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Bloodday"]; 12 var dayOfWeek = days % 7 > 0 ? days % 7 : 7; 13 var result = ""; 14 // Show days til blood moon: 15 result += " (" + (7 - dayOfWeek) + " til blood moon)"; 16 // Show day of week (number): 17 result += " (DoW: " + dayOfWeek + ")"; 18 // Show day of week (name): 19 result += " (" + daynames[dayOfWeek] + ")"; 20 return result; 21 } 22 23 function FormatServerTime (gametime) { 24 var time = "Day " + gametime.days; 25 time += " (" + DayName (gametime.days) + "), "; 26 if (gametime.hours < 10) 27 time += "0"; 28 time += gametime.hours; 29 time += ":"; 30 if (gametime.minutes < 10) 31 time += "0"; 32 time += gametime.minutes; 33 return time; 34 } 35 36 function TimeTitle (gametime) { 37 var daynames = ["", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Bloodday"]; 38 var dayOfWeek = DayOfWeek (gametime.days); 39 var result = ""; 40 // Show days til blood moon: 41 result += (7 - dayOfWeek) + " days til blood moon\n"; 42 // Show day of week (number): 43 result += "Day of week: " + dayOfWeek + "\n"; 44 // Show day of week (name): 45 //result += daynames[dayOfWeek]; 46 return result; 47 } 48 1 49 function StartStatsModule () { 2 50 var updateGameTimeEvent = function() { 3 51 $.getJSON( "../api/getstats") 4 52 .done(function(data) { 5 var time = "Day " + data.gametime.days + ", "; 6 if (data.gametime.hours < 10) 7 time += "0"; 8 time += data.gametime.hours; 9 time += ":"; 10 if (data.gametime.minutes < 10) 11 time += "0"; 12 time += data.gametime.minutes; 53 var time = FormatServerTime (data.gametime); 13 54 14 55 $("#stats_time").html (time); 56 $("#stats_time").prop ("title", TimeTitle (data.gametime)); 15 57 $("#stats_players").html (data.players); 16 58 $("#stats_hostiles").html (data.hostiles); … … 31 73 $.getJSON( "../api/getwebuiupdates?latestLine=" + lastLogLine) 32 74 .done(function(data) { 33 var time = "Day " + data.gametime.days + ", "; 34 if (data.gametime.hours < 10) 35 time += "0"; 36 time += data.gametime.hours; 37 time += ":"; 38 if (data.gametime.minutes < 10) 39 time += "0"; 40 time += data.gametime.minutes; 75 var time = FormatServerTime (data.gametime); 41 76 42 77 $("#stats_time").html (time); 78 $("#stats_time").prop ("title", TimeTitle (data.gametime)); 43 79 $("#stats_players").html (data.players); 44 80 $("#stats_hostiles").html (data.hostiles);
Note:
See TracChangeset
for help on using the changeset viewer.