Last active
August 27, 2017 18:20
-
-
Save borg1622/044d2926959a6c4281b0675b4c440230 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const LBS_2_KG = 2.5; | |
const REALISM_MAX_FUEL_CAPACITY_LBS = 200000000; | |
const BLINK_TEXT_DUR_TOT = 1500; | |
const BLINK_TEXT_DUR_IN = 500; | |
const BLINK_TEXT_DUR_OUT = 500; | |
const SEAT_PRICE_MAX_PROFIT_FACTOR = 1.749; | |
const SEAT_PRICE_MAX_ECONOMY = 20000; | |
const SEAT_PRICE_MAX_BUSINESS = 25000; | |
const SEAT_PRICE_MAX_FIRST = 45000; | |
const FUEL_PRICE_HOTDEAL = 250; | |
const FUEL_PRICE_GOOD = 350; | |
const FUEL_PRICE_AVERAGE = 800; | |
const FUEL_LEVEL_PCT_DANGER = 20; | |
const FUEL_LEVEL_PCT_WARNING = 20; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AM2Enh = AM2Enh || {}; | |
AM2Enh.dict = {}; | |
AM2Enh.dict["Fuel cost"] = ["Fuel cost","Brændstof pris","Treibstoffkosten"]; | |
AM2Enh.dict["Active routes"] = [ "Active routes","Aktive ruter","Aktive Routen" ]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* extend JavaScript's Math.round function by (optional) precision argument */ | |
Math.oldRound = Math.round; | |
Math.round = function(number, precision) { | |
var retVal; | |
if (precision !== undefined && precision > 0) { | |
var factor = Math.pow(10, precision); | |
var tempNumber = number * factor; | |
var roundedTempNumber = Math.oldRound(tempNumber); | |
retVal = roundedTempNumber / factor; | |
} else { | |
retVal = Math.oldRound(number); | |
} | |
return retVal; | |
}; | |
/* extend JavaScript's Math.floor function by (optional) precision argument */ | |
Math.oldFloor = Math.floor; | |
Math.floor = function(number, precision) { | |
var retVal; | |
if (precision !== undefined && precision > 0) { | |
var factor = Math.pow(10, precision); | |
var tempNumber = number * factor; | |
var roundedTempNumber = Math.oldFloor(tempNumber); | |
retVal = roundedTempNumber / factor; | |
} else { | |
retVal = Math.oldFloor(number); | |
} | |
return retVal; | |
}; | |
/* Checks if a string ends with the specified string... */ | |
if (typeof String.prototype.endsWith != 'function') { | |
String.prototype.endsWith = function (needle) { | |
return this.slice(-needle.length) == needle; | |
}; | |
} | |
/* search in an HTML-SELECT Option Array (containing OPTION-Elements) for specified 'needle' | |
on success return value is index value of found OPTION Element */ | |
function matchPreselection(optionsArray, needle) { | |
var selection = 1; // default value | |
if (optionsArray.length > 0 && needle !== undefined) { | |
for (var option of optionsArray) { | |
if (option.value == needle) { | |
selection = option.index; | |
break; | |
} | |
} | |
} else { | |
selection = 0; // error value | |
} | |
return selection; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment