Skip to content

Commit

Permalink
fix(#28): remove all duplicates of cleanInteger()
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoeBijl committed Jun 7, 2024
1 parent 329d651 commit f8b0464
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 22 deletions.
6 changes: 0 additions & 6 deletions extension/content_aircraftFlights.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,6 @@ function formatMoney(value){
function formatDate(date){
return date.substring(0, 4)+'-'+date.substring(4, 6)+'-'+date.substring(6, 8);
}
function cleanInteger(a){
a = a.replace(',','');
a = a.replace('.','');
a = a.replace(' AS$','');
return parseInt(a, 10);
}
function getServerName(){
let server = window.location.hostname
server = server.split('.');
Expand Down
8 changes: 1 addition & 7 deletions extension/content_flightInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function getFinancials(){
cmp = 'Total'
break;
}
let value = cleanInteger($(this).text());
let value = AES.cleanInteger($(this).text());
if(!data[contMargin]){
data[contMargin] = {}
}
Expand All @@ -160,12 +160,6 @@ function getFlightId(){
let b = a[1].split('&');
return parseInt(b[0],10);
}
function cleanInteger(a){
a = a.replace(',','');
a = a.replace('.','');
a = a.replace(' AS$','');
return parseInt(a, 10);
}
function getServerName(){
let server = window.location.hostname
server = server.split('.');
Expand Down
12 changes: 3 additions & 9 deletions extension/content_personelManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function displayPersonelManagement(){
chrome.storage.local.set({settings: settings}, function(){});
});
input.change(function(){
settings.personelManagement.value = cleanInteger(input.val());
settings.personelManagement.value = AES.cleanInteger(input.val());
chrome.storage.local.set({settings: settings}, function(){});
});

Expand Down Expand Up @@ -111,8 +111,8 @@ function priceUpdate(span){
}

let salaryInput = $(this).find('form input:eq(2)');
let salary = cleanInteger(salaryInput.val());
let average = cleanInteger($(this).find('td:eq(9)').text());
let salary = AES.cleanInteger(salaryInput.val());
let average = AES.cleanInteger($(this).find('td:eq(9)').text());
let salaryBtn = $(this).find('td:eq(8) > form .input-group-btn input');
let newSalary;
switch(type) {
Expand Down Expand Up @@ -158,12 +158,6 @@ function priceUpdate(span){
}
});
}
function cleanInteger(a){
a = a.replace(',','');
a = a.replace('.','');
a = a.replace(' AS$','');
return parseInt(a, 10);
}
function getAirline(){
let airline = $("#as-navbar-main-collapse ul li:eq(0) a:eq(0)").text().trim().replace(/[^A-Za-z0-9]/g, '');
return airline;
Expand Down

0 comments on commit f8b0464

Please sign in to comment.