-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathmain.js
60 lines (52 loc) · 1.56 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
52
53
54
55
56
57
58
59
60
//FONT
document.querySelector('html').style.fontfamily =
'-apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif';
//GET PIECES FROM STORAGE
chrome.storage.sync.get('pieces', function (data) {
if (data['pieces'] != 'none_pieces') {
Pieces.chooseStyleAndApply(data['pieces']);
}
});
//GET BOARD FROM STORAGE
chrome.storage.sync.get('board', function (data) {
if (data['board'] != 'none_board') {
Boards.chooseStyleAndApply(data['board']);
}
});
//METTRE A JOUR LES PIECES SI ACTION UTILISATEUR DANS HTML EXTENSION
chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
chrome.storage.sync.get('pieces', function (data) {
if (data['pieces'] == 'none_pieces') {
Pieces.unbindPieces();
Pieces.greatReset();
} else {
Pieces.chooseStyleAndApply(data['pieces']);
}
});
var board_select = document.getElementById('board_select');
chrome.storage.sync.get('board', function (data) {
if (data['board'] == 'none_board') {
Boards.greatReset();
} else {
Boards.chooseStyleAndApply(data['board']);
}
});
});
/*function ghostActivateState() {
chrome.storage.sync.get('desactivateGhostsCustomStyle', function(data) {
if (!data['desactivateGhostsCustomStyle']) {
return false
} else return true
})
}*/
document.addEventListener(
'mousedown',
function () {
chrome.storage.sync.get('pieces', function (data) {
if (data['pieces'] != 'none_pieces') {
Pieces.chooseStyleAndApply(data['pieces']);
}
});
},
false
);