-
Notifications
You must be signed in to change notification settings - Fork 6
/
background.js
50 lines (50 loc) · 1.64 KB
/
background.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
chrome.runtime.onInstalled.addListener(function() {
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
chrome.declarativeContent.onPageChanged.addRules([{
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: {hostEquals: "stadia.google.com"},
}),
new chrome.declarativeContent.PageStateMatcher({
pageUrl: {hostEquals: "html5gamepad.com"},
}),
],
actions: [new chrome.declarativeContent.ShowPageAction()]
}]);
});
const startParams = {
"stickRadius": 50,
"buttonDiameter": 70,
"buttonBorderLeftOffset": 30,
"buttonBorderRightOffset": 30,
"buttonBorderTopOffset": 80,
"buttonBorderBottomOffset": 30,
"opacity": 255,
"enableColors": false,
"enableDrawSticks" : false,
"disableTouchStadia": false,
"buttonConfig": null,
"firstRun": true
};
chrome.storage.sync.get([
"stickRadius",
"buttonDiameter",
"buttonBorderLeftOffset",
"buttonBorderRightOffset",
"buttonBorderTopOffset",
"buttonBorderBottomOffset",
"opacity",
"enableColors",
"enableDrawSticks",
"disableTouchStadia",
"buttonConfig",
"firstRun"
], function(settings) {
for(const key of Object.keys(settings)){
startParams[key] = settings[key];
}
chrome.storage.sync.set(startParams, function() {
console.log("TouchStadia: Set start params!");
});
});
});