-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbackground.js
44 lines (41 loc) · 1.02 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
//Set up default values in storage during installation
chrome.runtime.onInstalled.addListener(function () {
chrome.storage.sync.set(
{
pieces: 'neo',
board: 'green',
sounds: 'chessdotcomdefault',
desactivateGhostsCustomStyle: false,
},
function () {}
);
});
//METTRE A JOUR LES PIECES SI ACTION UTILISATEUR DANS HTML EXTENSION
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
if (request.sounds_init) {
chrome.scripting.executeScript({
target: { tabId: request.tab },
world: 'MAIN',
func: () => {
(function () {
this.window.site.sound.sounds.clear();
})();
},
});
}
});
//Block audio files from network
/*chrome.webRequest.onBeforeRequest.addListener(
function() {
return {cancel: true};
},
{
urls: ["https://lichess1.org/assets/_Iu1lae/sound/standard/*.ogg"]
},
["blocking"]
);
Permissions:
"<all_urls>",
"webRequest",
"webRequestBlocking"
*/