Skip to content

Commit e483810

Browse files
authored
feat: v0.6.8 update (#30)
* chore: add documentation links * fix: properly align currency in the aircraft profit dashboard * feat: add currency format helper * chore: load helpers in /action/ pages * fix(#12): change indicator color based on positive/negative values * fix: check for value in fltmng_getAircraftId function * fix(#11): properly format large numbers in flightInfo * fix(#14): add table width css * fix(#13): add some improved colours for dark mode * fix(#10): right align flight info currency columns * chore: cleanup the manifest content_scripts * fix: filter out NaN dates for “Schedule extract 'days ago'” * fix(#16): check date type for route management data * fix: prevent NaN dates * fix: filter NaN dates in getRouteAnalysisImportantDates * feat: move getAirlineCode and getServerName to helper.js * chore: change arrow function to method * feat: move formatDate to helpers.js as formatDateString fix: check if date is provided, else return * feat: move formatWeekDate to helpers.js as formatDateStringWeek * feat: move getDateDiff to helpers.js * chore: fix typo and add credits for myself * chore: bump version number * style: convert line endings to LF * chore: inventory analysis js file style (#24) * fix: only push dates if they’re integers * style: format according to .editorconfig * feat: renovate inventory analysis (#25) Fixes: - data comparison resulting in invalid results - no new flight pair data being written - Several components have been refactored and/or ported to vanilla JavaScript: Features: - settings are now loaded on page load - getServer() is now loaded from AES (helpers.js) - validation of the inventory settings is now in its own file / its own component (instead of an object) UI clean-up: - columns with numbers are right aligned - historical data now starts with newest data on the left - table cells no longer wrap, giving a cleaner more comprehensible look Commits: * feat: move cleanInteger to helpers.js * refactor: getFlights * split out into multiple functions * port to vanilla * add jsdoc * refactor: getPriceDetails * port to vanilla * add jsdoc * split into multiple functions * refactor: inventory initialisation * refactor: displayInventory * displayInventory now uses await to get local storage * feat: fix historic data table styling / reverse order * fix: get settings on page load * refactor: remove getServer() * refactor: use booleans instead of numbers * refactor: pull inventory setting validation into its own class * The “content_inventory” file is quite long as it is. Pulling this validation out into its own file makes it easier to read. * refactor: use early return when errors occur * chore: add pricingDataObjectExample * fix: correctly show price analysis * fix(#26): replace getDate() with AES.getServerDate() (#27) Removes all the duplicate getDate() functions with one centralised getServerDate() helper function. * fix: remove redundant helper functions (#29) * fix(#28): remove all duplicates of cleanInteger() * fix(#28): remove duplicates of getDateDiff * fix(#28): remove duplicates of formatDate formatDate has been replaced by AES.formatDateString * fix: simplify cleanInteger * fix: correct date extraction Apparently the footer date element is not consistently styled across all pages. This corrects for that. * style: apply .editorconfig to content_dashboard * feat: add AES menu (#32) * feat: add AES menu Adds a menu item to the main game menu. Provides easy access to the forum topic and reporting bugs. * fix: consistently align icons in menu * feat: add support for menu dividers and headers * feat: add a few menu items * fix: correctly escape url * feat: add support for modal toggle menuitems * feat(#33): add about screen (#34) * feat(#33): add about window * feat(#33): add logo to about screen * feat(#33): improve dialog styling * feat(#33): simplify code / improve close button * fix: correct heading colour in about screen
1 parent 6a8b3e9 commit e483810

16 files changed

+5512
-5054
lines changed

Diff for: README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AirlineSim Enhancement Suite
22

3-
The AirlineSime Enhancement Suite (AES) offers a set of tools to help CEOs build their airlines.
3+
The AirlineSim Enhancement Suite (AES) offers a set of tools to help CEOs build their airlines.
44

55
## Features
66

@@ -18,7 +18,6 @@ Marcipanas wrote [a guide](https://docs.google.com/document/d/1hzMHb3hTBXSZNtuDK
1818
## Installation
1919

2020
Supported platforms: chromium based browsers (Chrome, Edge, etc)
21-
2221
Please follow [racsofp’s guide](https://forums.airlinesim.aero/t/manual-installation-of-the-ase-airlinesim-enhancement-suite-chrome-extension/24671)
2322

2423
## History
@@ -34,3 +33,4 @@ Sources: the [original forum thread](https://forums.airlinesim.aero/t/introducin
3433
- Marcipanas for the original development
3534
- racsofp for their update and installation documentation
3635
- Robert73 for the updated manifest file
36+
- Zoë Bijl for the continued development

Diff for: docs/pricingDataObjectExample.js

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
"20240403": {
2+
"data": {
3+
"C": {
4+
"analysisPrice": 0,
5+
"analysisPricePoint": 0,
6+
"currentPrice": 467,
7+
"currentPricePoint": 100,
8+
"recommendation": 0,
9+
"totalBkd": 0,
10+
"totalCap": 0,
11+
"useCurrentPrice": 0,
12+
"valid": 0
13+
},
14+
"Cargo": {
15+
"analysisPrice": 139,
16+
"analysisPricePoint": 100,
17+
"currentPrice": 139,
18+
"currentPricePoint": 100,
19+
"index": 39,
20+
"newPrice": 128,
21+
"newPriceChange": -8,
22+
"newPricePoint": 92,
23+
"recType": "bad",
24+
"recommendation": "Drop High",
25+
"totalBkd": 13,
26+
"totalCap": 72,
27+
"useCurrentPrice": 1,
28+
"valid": 1
29+
},
30+
"F": {
31+
"analysisPrice": 0,
32+
"analysisPricePoint": 0,
33+
"currentPrice": 859,
34+
"currentPricePoint": 100,
35+
"recommendation": 0,
36+
"totalBkd": 0,
37+
"totalCap": 0,
38+
"useCurrentPrice": 0,
39+
"valid": 0
40+
},
41+
"Y": {
42+
"analysisPrice": 0,
43+
"analysisPricePoint": 0,
44+
"currentPrice": 203,
45+
"currentPricePoint": 100,
46+
"recommendation": 0,
47+
"totalBkd": 0,
48+
"totalCap": 0,
49+
"useCurrentPrice": 0,
50+
"valid": 0
51+
}
52+
},
53+
"date": 20240403,
54+
"pricingUpdated": 1,
55+
"updateTime": "14:36 UTC"
56+
}

Diff for: extension/content_aircraftFlights.js

+3-36
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function displayFlightProfit(){
119119

120120
if(value.data){
121121
td.push(formatMoney(value.data.money.CM5.Total));
122-
td.push($('<td></td>').text(formatDate(value.data.date)+' '+value.data.time));
122+
td.push($('<td></td>').text(AES.formatDateString(value.data.date)+' '+value.data.time));
123123
} else {
124124
td.push('<td></td>');
125125
td.push('<td></td>');
@@ -137,7 +137,7 @@ function buildTable(){
137137
row.push($('<tr></tr>').append('<th>Total flights</th>','<td>'+aircraftFlightData.totalFlights+'</td>'));
138138
row.push($('<tr></tr>').append('<th>Finished flights</th>','<td>'+aircraftFlightData.finishedFlights+'</td>'));
139139
row.push($('<tr></tr>').append('<th>Finished flights with profit/loss extract</th>','<td>'+aircraftFlightData.profitFlights+'</td>'));
140-
row.push($('<tr></tr>').append('<th>Data save time</th>','<td>'+formatDate(aircraftFlightData.date)+' '+aircraftFlightData.time+'</td>'));
140+
row.push($('<tr></tr>').append('<th>Data save time</th>','<td>'+AES.formatDateString(aircraftFlightData.date)+' '+aircraftFlightData.time+'</td>'));
141141

142142
let tbody = $('<tbody></tbody>').append(row);
143143
return $('<table class="table table-bordered table-striped table-hover"></table>').append(tbody);
@@ -146,7 +146,7 @@ function getData(){
146146
//Aircraft ID
147147
let aircraftId = getAircraftId();
148148
let aircraftInfo = getAircraftInfo();
149-
let date = getDate();
149+
let date = AES.getServerDate()
150150
let server = getServerName();
151151
let flights = getFlights();
152152
let flightsStats = getFlightsStats(flights);
@@ -235,39 +235,6 @@ function formatMoney(value){
235235

236236
return container
237237
}
238-
function formatDate(date){
239-
return date.substring(0, 4)+'-'+date.substring(4, 6)+'-'+date.substring(6, 8);
240-
}
241-
function getDate(){
242-
let a = $(".as-footer-line-element:has('.fa-clock-o')").text().trim();
243-
let b = a.split(" ");
244-
//For date
245-
let dateTemp = b[0].split("-");
246-
let date;
247-
if(dateTemp.length == 1){
248-
//German
249-
dateTemp = dateTemp[0].split(".");
250-
date = dateTemp.map(function(value){
251-
return value.replace(/[^A-Za-z0-9]/g, '');
252-
});
253-
date = date[2] + date[1] + date[0];
254-
} else {
255-
//English
256-
date = dateTemp.map(function(value){
257-
return value.replace(/[^A-Za-z0-9]/g, '');
258-
});
259-
date = date[0] + date[1] + date[2];
260-
}
261-
//For time
262-
let time = b[b.length-2] +' '+b[b.length-1];
263-
return {date:date,time:time};
264-
}
265-
function cleanInteger(a){
266-
a = a.replace(',','');
267-
a = a.replace('.','');
268-
a = a.replace(' AS$','');
269-
return parseInt(a, 10);
270-
}
271238
function getServerName(){
272239
let server = window.location.hostname
273240
server = server.split('.');

0 commit comments

Comments
 (0)