Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoeBijl committed May 27, 2024
0 parents commit 60e3481
Show file tree
Hide file tree
Showing 22 changed files with 6,349 additions and 0 deletions.
7 changes: 7 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Names should be added to this file with this pattern:
#
# Name <email address>
#
# Please keep the list sorted.

Martynas Jurkus
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 The AES Authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
125 changes: 125 additions & 0 deletions extension/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

'use strict';
//Functions
function setDefaultSettings(){
//Add default settings

let aesSettings = {
invPricing:setDefaultInvPricingSettings(),
general:setDefaultGeneralSettings(),
schedule:setDefaultScheduleSettings()
};
chrome.storage.local.get(['settings'], function(result) {
let settings = result.settings;
if(!settings){
settings = aesSettings;
chrome.storage.local.set({settings: aesSettings}, function() {

});
}
});
//
}

function setDefaultScheduleSettings(){
//auto settings
let schedule = {
autoExtract:0
};
//Cmp setttings
return schedule;
}
function setDefaultGeneralSettings(){
//auto settings
let general = {
defaultDashboard:'general'
};
//Cmp setttings
return general;
}
function setDefaultInvPricingSettings(){
//auto settings
let invPricing = {
autoAnalysisSave:1,
autoPriceUpdate:0,
autoClose:0,
recommendation:{},
historyTable:{
showNow:1,
showOnlyPricing:0,
numberOfDates:"5"
}
};
//Cmp setttings
let steps = [
{
min:0,
max:40,
name:'Drop High',
step:-8
},
{
min:40,
max:60,
name:'Drop Medium',
step: -4
},
{
min:60,
max:70,
name:'Drop Low',
step: -2
},
{
min:70,
max:80,
name:'Keep',
step: 0
},
{
min:80,
max:90,
name:'Raise Low',
step: 1
},
{
min:90,
max:99,
name:'Raise Medium',
step: 2
},
{
min:99,
max:100,
name:'Raise High',
step: 5
}
];
let cmps = ['Y','C','F','Cargo'];
cmps.forEach(function(cmp){
invPricing.recommendation[cmp] = {
maxPrice:200,
minPrice:60,
steps:steps
};
});
return invPricing;
}


//MAIN

chrome.runtime.onInstalled.addListener(function() {
setDefaultSettings();
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [new chrome.declarativeContent.PageStateMatcher({
pageUrl: {hostContains: '.airlinesim.aero'},
})],
actions: [new chrome.declarativeContent.ShowPageAction()]
}]);
});
});
Loading

0 comments on commit 60e3481

Please sign in to comment.