Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/common/functions_utility.js
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | function stringifiedTeamListToPlayerData(stringifiedTeamList) | ||||
return playerData; | return playerData; | ||||
} | } | ||||
function translateMapTitle(mapTitle) | function translateMapTitle(mapTitle) | ||||
{ | { | ||||
return mapTitle == "random" ? translateWithContext("map selection", "Random") : translate(mapTitle); | return mapTitle == "random" ? translateWithContext("map selection", "Random") : translate(mapTitle); | ||||
} | } | ||||
/** | |||||
* Convert time in milliseconds to [hh:]mm:ss string representation. | |||||
* @param time Time period in milliseconds (integer) | |||||
* @return String representing time period | |||||
*/ | |||||
function timeToString(time) | |||||
{ | |||||
return Engine.FormatMillisecondsIntoDateStringGMT(time, time < 1000 * 60 * 60 ? | |||||
translate("mm:ss") : translate("HH:mm:ss")); | |||||
} | |||||
function removeDupes(array) | function removeDupes(array) | ||||
{ | { | ||||
// loop backwards to make splice operations cheaper | // loop backwards to make splice operations cheaper | ||||
let i = array.length; | let i = array.length; | ||||
while (i--) | while (i--) | ||||
if (array.indexOf(array[i]) != i) | if (array.indexOf(array[i]) != i) | ||||
array.splice(i, 1); | array.splice(i, 1); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 113 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator