-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
51 lines (42 loc) · 1.44 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
const defaultColor = {
'N. Virginia': '#3cb44b',
Ohio: '#e6194b',
'N. California': '#e58e00',
Oregon: '#4363d8',
'Cape Town': '#16ab3e',
'Hong Kong': '#008080',
Mumbai: '#8a7299',
Seoul: '#9a6324',
Singapore: '#ccc8a0',
Sydney: '#800000',
Tokyo: '#669975',
Central: '#f58231',
Frankfurt: '#911eb4',
Ireland: '#31a8a8',
London: '#f032e6',
Milan: '#a30f88',
Paris: '#83ac08',
Stockholm: '#c89898',
Bahrain: '#808000',
'São Paulo': '#b2977b'
}
setTimeout(() => {
const region = document.querySelector('[data-testid="awsc-nav-regions-menu-button"]>span').innerText;
console.log(region);
chrome.storage.local.get(region, (results)=>{
let color = results[region];
if(color===undefined){
color = defaultColor[region]
}
if(color===undefined){
return;
}
document.querySelector("#awsc-top-level-nav").style.backgroundColor=color;
// Feel free to uncomment and modify the code below to change the color of other elements based on the acct number...
// It's just a starter, so you'll have to modify it to work for your use case.. DIY other methods if you want.
// const accountNumber = document.getElementById("menu--account").children[0].children[0].children[0].children[1].innerText.replace(/-/g, "");
// if (accountNumber=="123456789012"){
// document.querySelector('[aria-controls="menu--account"]').style.backgroundColor="#FFA7C3";
// }
})
}, 3000);